summaryrefslogtreecommitdiffstats
path: root/scripts/lib/mic/utils/partitionedfs.py
diff options
context:
space:
mode:
authorTom Zanussi <tom.zanussi@linux.intel.com>2014-08-08 10:09:12 -0500
committerRichard Purdie <richard.purdie@linuxfoundation.org>2014-08-11 10:53:11 +0100
commit4d1f5ee6d1ae1eb7f60d58c4e960dde879ae0e7f (patch)
tree087941c279fec075d2213303253451fac6ffc385 /scripts/lib/mic/utils/partitionedfs.py
parentbd0dd4489e15700333185a6afc6ea53a397246fb (diff)
downloadpoky-4d1f5ee6d1ae1eb7f60d58c4e960dde879ae0e7f.tar.gz
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>
Diffstat (limited to 'scripts/lib/mic/utils/partitionedfs.py')
-rw-r--r--scripts/lib/mic/utils/partitionedfs.py37
1 files changed, 2 insertions, 35 deletions
diff --git a/scripts/lib/mic/utils/partitionedfs.py b/scripts/lib/mic/utils/partitionedfs.py
index 50536b4fce..43a38a9b14 100644
--- a/scripts/lib/mic/utils/partitionedfs.py
+++ b/scripts/lib/mic/utils/partitionedfs.py
@@ -33,11 +33,9 @@ MBR_OVERHEAD = 1
33SECTOR_SIZE = 512 33SECTOR_SIZE = 512
34 34
35class PartitionedMount: 35class PartitionedMount:
36 def __init__(self, mountdir): 36 def __init__(self):
37 self.disks = {} 37 self.disks = {}
38 self.partitions = [] 38 self.partitions = []
39 self.mountOrder = []
40 self.unmountOrder = []
41 self.parted = find_binary_path("parted") 39 self.parted = find_binary_path("parted")
42 # Size of a sector used in calculations 40 # Size of a sector used in calculations
43 self.sector_size = SECTOR_SIZE 41 self.sector_size = SECTOR_SIZE
@@ -102,7 +100,6 @@ class PartitionedMount:
102 'label': label, # Partition label 100 'label': label, # Partition label
103 'disk_name': disk_name, # physical disk name holding partition 101 'disk_name': disk_name, # physical disk name holding partition
104 'device': None, # kpartx device node for partition 102 'device': None, # kpartx device node for partition
105 'mount': None, # Mount object
106 'num': None, # Partition number 103 'num': None, # Partition number
107 'boot': boot, # Bootable flag 104 'boot': boot, # Bootable flag
108 'align': align, # Partition alignment 105 'align': align, # Partition alignment
@@ -303,17 +300,6 @@ class PartitionedMount:
303 self.__run_parted(["-s", d['disk'].device, "set", 300 self.__run_parted(["-s", d['disk'].device, "set",
304 "%d" % p['num'], "lba", "off"]) 301 "%d" % p['num'], "lba", "off"])
305 302
306 def __calculate_mountorder(self):
307 msger.debug("Calculating mount order")
308 for p in self.partitions:
309 if p['mountpoint']:
310 self.mountOrder.append(p['mountpoint'])
311 self.unmountOrder.append(p['mountpoint'])
312
313 self.mountOrder.sort()
314 self.unmountOrder.sort()
315 self.unmountOrder.reverse()
316
317 def cleanup(self): 303 def cleanup(self):
318 if self.disks: 304 if self.disks:
319 for dev in self.disks.keys(): 305 for dev in self.disks.keys():
@@ -323,23 +309,6 @@ class PartitionedMount:
323 except: 309 except:
324 pass 310 pass
325 311
326 def unmount(self):
327 for mp in self.unmountOrder:
328 if mp == 'swap':
329 continue
330 p = None
331 for p1 in self.partitions:
332 if p1['mountpoint'] == mp:
333 p = p1
334 break
335
336 if p['mount'] != None:
337 try:
338 p['mount'].cleanup()
339 except:
340 pass
341 p['mount'] = None
342
343 def __install_partition(self, num, source_file, start, size): 312 def __install_partition(self, num, source_file, start, size):
344 """ 313 """
345 Install source_file contents into a partition. 314 Install source_file contents into a partition.
@@ -375,13 +344,11 @@ class PartitionedMount:
375 self.__install_partition(p['num'], p['source_file'], 344 self.__install_partition(p['num'], p['source_file'],
376 p['start'], p['size']) 345 p['start'], p['size'])
377 346
378 def mount(self): 347 def create(self):
379 for dev in self.disks.keys(): 348 for dev in self.disks.keys():
380 d = self.disks[dev] 349 d = self.disks[dev]
381 d['disk'].create() 350 d['disk'].create()
382 351
383 self.__format_disks() 352 self.__format_disks()
384 353
385 self.__calculate_mountorder()
386
387 return 354 return