[PATCH 31/47] Read CHS values from Device.biosGeometry property

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



The old pyparted had CHS values as properties directly on the
PedDevice.  The new pyparted API gives a 3-tuple for the CHS
values via the biosGeometry and hardwareGeometry properties.
---
 autopart.py                |    3 ++-
 iw/partition_dialog_gui.py |    2 +-
 iw/partition_gui.py        |   13 ++++++-------
 3 files changed, 9 insertions(+), 9 deletions(-)

diff --git a/autopart.py b/autopart.py
index 350cf32..a445f34 100644
--- a/autopart.py
+++ b/autopart.py
@@ -710,7 +710,8 @@ def growParts(diskset, requests, newParts):
             growList = growable[drive]
 
             sectorSize = diskset.disks[drive].device.sectorSize
-            cylsectors = diskset.disks[drive].device.biosGeometry.sectors*diskset.disks[drive].device.biosGeometry.heads
+            (cylinders, heads, sectors) = diskset.disks[drive].device.biosGeometry
+            cylsectors = sectors * heads
 
             # sort in order of request size, consider biggest first
             n = 0
diff --git a/iw/partition_dialog_gui.py b/iw/partition_dialog_gui.py
index 77bbdb3..04e45db 100644
--- a/iw/partition_dialog_gui.py
+++ b/iw/partition_dialog_gui.py
@@ -384,7 +384,7 @@ class PartitionEditor:
 		lbl = createAlignedLabel(_("_Start Cylinder:"))
                 maintable.attach(lbl, 0, 1, row, row + 1)
 
-                maxcyl = self.diskset.disks[origrequest.drive[0]].device.cylinders
+                (maxcyl, h, s) = self.diskset.disks[origrequest.drive[0]].device.biosGeometry
                 cylAdj = gtk.Adjustment(value=origrequest.start,
                                         lower=origrequest.start,
                                         upper=maxcyl,
diff --git a/iw/partition_gui.py b/iw/partition_gui.py
index 15fbe7b..5517f57 100644
--- a/iw/partition_gui.py
+++ b/iw/partition_gui.py
@@ -154,9 +154,8 @@ class DiskStripeSlice:
 
     def update(self):
         disk = self.parent.getDisk()
-        totalSectors = float(disk.device.heads
-                             * disk.device.sectors
-                             * disk.device.cylinders)
+        (cylinders, heads, sectors) = disk.device.biosGeometry
+        totalSectors = float(heads * sectors * cylinders)
 
         # XXX hack but will work for now
         if gtk.gdk.screen_width() > 640:
@@ -317,11 +316,10 @@ class DiskStripeGraph:
                                       size_points=9)
 	show_geometry = 0
 	if show_geometry:
+	    (cylinders, heads, sectors) = disk.device.biosGeometry
 	    drivetext = _("Drive %s (Geom: %s/%s/%s) "
 			 "(Model: %s)") % ('/dev/' + drive,
-					   disk.device.cylinders,
-					   disk.device.heads,
-					   disk.device.sectors,
+					   cylinders, heads, sectors,
 					   disk.device.model)
 	else:
 	    drivetext = _("Drive %s (%-0.f MB) "
@@ -826,7 +824,8 @@ class PartitionWindow(InstallWindow):
             parent = self.tree.append(drvparent)
             self.tree[parent]['Device'] = '/dev/%s' % (drive,)
             self.tree[parent]['PyObject'] = str('/dev/%s' % (drive,))
-            sectorsPerCyl = disk.device.heads * disk.device.sectors
+            (cylinders, heads, sectors) = disk.device.biosGeometry
+            sectorsPerCyl = heads * sectors
 
             extendedParent = None
             part = disk.next_partition()
-- 
1.6.1.3

_______________________________________________
Anaconda-devel-list mailing list
Anaconda-devel-list@xxxxxxxxxx
https://www.redhat.com/mailman/listinfo/anaconda-devel-list

[Index of Archives]     [Kickstart]     [Fedora Users]     [Fedora Legacy List]     [Fedora Maintainers]     [Fedora Desktop]     [Fedora SELinux]     [Big List of Linux Books]     [Yosemite News]     [Yosemite Photos]     [KDE Users]     [Fedora Tools]
  Powered by Linux