Re: [PATCH 3/9] Use new functions for conversion between size and sector count.

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

 



-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

On Wed, 4 Nov 2009, David Lehman wrote:

On Wed, 2009-11-04 at 09:28 -0500, Chris Lumens wrote:
+def sectorsToSize(sectors, sectorSize):
+    """ Convert length in sectors to size in MB.
+
+        Arguments:
+
+            sectors     -   sector count
+            sectorSize  -   sector size for the device, in bytes
+    """
+    return (sectors * sectorSize) / (1024.0 * 1024.0)

parted.Device has a getSize() method that already covers this one.  You
can even pass it a unit to return the size in, MB by default.

parted.Device.getSize returns the size of the entire device -- we need
to be able to convert an arbitrary number of sectors to a size.

Rather than on parted.Device, this could just be a utility method at the
parted module level.

- -- David Cantrell <dcantrell@xxxxxxxxxx>
Red Hat / Honolulu, HI

-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.10 (GNU/Linux)

iEYEARECAAYFAkryBMAACgkQ5hsjjIy1VkmHxwCgmJOB7QhpdYDOZE550dJPlV1l
EN4AniQ+8OOMWdIGzh+y5M4/TKz2uJaD
=FG7d
-----END PGP SIGNATURE-----

_______________________________________________
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