wic: Update/rename/delete mount-related code

The wic code inherited a basic image-creation flow based on mounting
loop devices, but wic doesn't actually mount anything, so rename parts
of the code dealing with mounting to something more appropriate, and
remove related unused code.

(From OE-Core rev: 94e15c18c011b0d7d71276cd4566be2417c2c6be)

Signed-off-by: Tom Zanussi <tom.zanussi@linux.intel.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
This commit is contained in:
Tom Zanussi
2014-08-08 10:09:12 -05:00
committed by Richard Purdie
parent bd0dd4489e
commit 4d1f5ee6d1
4 changed files with 22 additions and 106 deletions

View File

@@ -33,11 +33,9 @@ MBR_OVERHEAD = 1
SECTOR_SIZE = 512
class PartitionedMount:
def __init__(self, mountdir):
def __init__(self):
self.disks = {}
self.partitions = []
self.mountOrder = []
self.unmountOrder = []
self.parted = find_binary_path("parted")
# Size of a sector used in calculations
self.sector_size = SECTOR_SIZE
@@ -102,7 +100,6 @@ class PartitionedMount:
'label': label, # Partition label
'disk_name': disk_name, # physical disk name holding partition
'device': None, # kpartx device node for partition
'mount': None, # Mount object
'num': None, # Partition number
'boot': boot, # Bootable flag
'align': align, # Partition alignment
@@ -303,17 +300,6 @@ class PartitionedMount:
self.__run_parted(["-s", d['disk'].device, "set",
"%d" % p['num'], "lba", "off"])
def __calculate_mountorder(self):
msger.debug("Calculating mount order")
for p in self.partitions:
if p['mountpoint']:
self.mountOrder.append(p['mountpoint'])
self.unmountOrder.append(p['mountpoint'])
self.mountOrder.sort()
self.unmountOrder.sort()
self.unmountOrder.reverse()
def cleanup(self):
if self.disks:
for dev in self.disks.keys():
@@ -323,23 +309,6 @@ class PartitionedMount:
except:
pass
def unmount(self):
for mp in self.unmountOrder:
if mp == 'swap':
continue
p = None
for p1 in self.partitions:
if p1['mountpoint'] == mp:
p = p1
break
if p['mount'] != None:
try:
p['mount'].cleanup()
except:
pass
p['mount'] = None
def __install_partition(self, num, source_file, start, size):
"""
Install source_file contents into a partition.
@@ -375,13 +344,11 @@ class PartitionedMount:
self.__install_partition(p['num'], p['source_file'],
p['start'], p['size'])
def mount(self):
def create(self):
for dev in self.disks.keys():
d = self.disks[dev]
d['disk'].create()
self.__format_disks()
self.__calculate_mountorder()
return