Re: [PATCH 4/6] Fix estimate of LUKS header size for newly encrypted devices. (#493575)

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

 



Looks good, though I would like to see a way to not hardcode the size of the LUKS header

On 04/14/2009 01:16 PM, David Lehman wrote:
---
  storage/devices.py |    9 +++++----
  1 files changed, 5 insertions(+), 4 deletions(-)

diff --git a/storage/devices.py b/storage/devices.py
index 49ad902..89595d7 100644
--- a/storage/devices.py
+++ b/storage/devices.py
@@ -1426,10 +1426,11 @@ class LUKSDevice(DMCryptDevice):

      @property
      def size(self):
-        size = super(LUKSDevice, self).size
-        if not size:
-            # break off 2KB for the LUKS header
-            size = float(self.slave.size) - (2.0 / 1024)
+        if not self.exists or not self.partedDevice:
+            # the LUKS header takes up 4040 512-byte sectors w/ a 512-bit key
+            size = float(self.slave.size) - ((4040 * 2.0) / 1024)
+        else:
+            size = self.partedDevice.getSize()
          return size

      def create(self, intf=None):


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

_______________________________________________
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