/[gli]/branches/overhaul/src/Partitioning.py
Gentoo

Diff of /branches/overhaul/src/Partitioning.py

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

Revision 1546 Revision 1547
228 # figure out start/end sectors 228 # figure out start/end sectors
229 start = free_part['start'] + self._megabytes_to_sectors(pregap) 229 start = free_part['start'] + self._megabytes_to_sectors(pregap)
230 end = start + self._megabytes_to_sectors(mb) 230 end = start + self._megabytes_to_sectors(mb)
231 newpart = self._parted_disk.partition_new(types[parttype], fstype, start, end) 231 newpart = self._parted_disk.partition_new(types[parttype], fstype, start, end)
232 constraint = self._parted_disk.dev.constraint_any() 232 constraint = self._parted_disk.dev.constraint_any()
233 constraint.start_range.set_start(start)
234 constraint.start_range.set_end(start)
235 self._parted_disk.add_partition(newpart, constraint) 233 self._parted_disk.add_partition(newpart, constraint)
236 self._parted_disk.commit() 234 self._parted_disk.commit()
237 self.set_partitions_from_disk() 235 self.set_partitions_from_disk()
238 236
239 ## 237 ##
309 self._device = device 307 self._device = device
310 self._start = parted_part.geom.start 308 self._start = parted_part.geom.start
311 self._end = parted_part.geom.end 309 self._end = parted_part.geom.end
312 self._type = "" 310 self._type = ""
313 self._minor = parted_part.num 311 self._minor = parted_part.num
314 self._part_mb = float((self._end - self._start + 1) * device._geometry['sector_size'] / MEGABYTE) 312 self._mb = float((self._end - self._start + 1) * device._geometry['sector_size'] / MEGABYTE)
315 self._part_name = "" 313 self._part_name = ""
316 self._resizeable = False 314 self._resizeable = False
317 315
318 # determine the /dev node that refers to this partition 316 # determine the /dev node that refers to this partition
319 tmpdevice = device.get_device() 317 tmpdevice = device.get_device()
334 # Add additional partition identification code here 332 # Add additional partition identification code here
335 pass 333 pass
336 if parted_part.type == 2: self._type = "extended" 334 if parted_part.type == 2: self._type = "extended"
337 if device._parted_disk.type.check_feature(parted.DISK_TYPE_PARTITION_NAME): 335 if device._parted_disk.type.check_feature(parted.DISK_TYPE_PARTITION_NAME):
338 self._part_name = parted_part.get_name() 336 self._part_name = parted_part.get_name()
339
340 # The 10 is completely arbitrary. If flags seem to be missed, this number should be increased 337 # The 10 is completely arbitrary. If flags seem to be missed, this number should be increased
341 for flag in range(0, 10): 338 for flag in range(0, 10):
342 if parted_part.is_flag_available(flag) and parted_part.get_flag(flag): 339 if parted_part.is_flag_available(flag) and parted_part.get_flag(flag):
343 self._flags.append(flag) 340 self._flags.append(flag)
341
344 if type == "ext2" or type == "ext3": 342 if type == "ext2" or type == "ext3":
345 block_size = long(string.strip(commands.getoutput("dumpe2fs -h " + self._devnode + r" 2>&1 | grep -e '^Block size:' | sed -e 's/^Block size:\s\+//'"))) 343 block_size = long(string.strip(commands.getoutput("dumpe2fs -h " + self._devnode + r" 2>&1 | grep -e '^Block size:' | sed -e 's/^Block size:\s\+//'")))
346 free_blocks = long(string.strip(commands.getoutput("dumpe2fs -h " + self._devnode + r" 2>&1 | grep -e '^Free blocks:' | sed -e 's/^Free blocks:\s\+//'"))) 344 free_blocks = long(string.strip(commands.getoutput("dumpe2fs -h " + self._devnode + r" 2>&1 | grep -e '^Free blocks:' | sed -e 's/^Free blocks:\s\+//'")))
347 free_bytes = long(block_size * free_blocks) 345 free_bytes = long(block_size * free_blocks)
348 # can't hurt to pad (the +50) it a bit since this is really just a guess 346 # can't hurt to pad (the +50) it a bit since this is really just a guess

Legend:
Removed from v.1546  
changed lines
  Added in v.1547

  ViewVC Help
Powered by ViewVC 1.1.20