]> git.proxmox.com Git - grub2.git/commitdiff
cryptodisk: Rename "total_length" field in grub_cryptodisk_t to "total_sectors"
authorGlenn Washburn <development@efficientek.com>
Sat, 7 Nov 2020 04:44:21 +0000 (22:44 -0600)
committerDaniel Kiper <daniel.kiper@oracle.com>
Fri, 20 Nov 2020 14:33:41 +0000 (15:33 +0100)
This creates an alignment with grub_disk_t naming of the same field and is
more intuitive as to how it should be used.

Signed-off-by: Glenn Washburn <development@efficientek.com>
Reviewed-by: Patrick Steinhardt <ps@pks.im>
Reviewed-by: Daniel Kiper <daniel.kiper@oracle.com>
grub-core/disk/cryptodisk.c
grub-core/disk/geli.c
grub-core/disk/luks.c
grub-core/disk/luks2.c
include/grub/cryptodisk.h

index a3d672f683f6cbf81ca74acb41142bc8ccd08f30..3703da221b939b1af1abb2c1448e7c1149f36218 100644 (file)
@@ -699,7 +699,7 @@ grub_cryptodisk_open (const char *name, grub_disk_t disk)
     }
 
   disk->data = dev;
-  disk->total_sectors = dev->total_length;
+  disk->total_sectors = dev->total_sectors;
   disk->max_agglomerate = GRUB_DISK_MAX_MAX_AGGLOMERATE;
   disk->id = dev->id;
   dev->ref++;
index e9d23299a538d48c2165fa507b59a96ce692782c..4ec875821d683405e57acb6858b863ac1f2a423d 100644 (file)
@@ -391,7 +391,7 @@ configure_ciphers (grub_disk_t disk, const char *check_uuid,
 
   newdev->modname = "geli";
 
-  newdev->total_length = grub_disk_get_size (disk) - 1;
+  newdev->total_sectors = grub_disk_get_size (disk) - 1;
   grub_memcpy (newdev->uuid, uuid, sizeof (newdev->uuid));
   COMPILE_TIME_ASSERT (sizeof (newdev->uuid) >= 32 * 2 + 1);
   return newdev;
index 59702067a084a6b4fb42b37d0c86c8a8e9290520..429db4ad8841da70317d08ca3033f794d51f3f07 100644 (file)
@@ -125,7 +125,7 @@ configure_ciphers (grub_disk_t disk, const char *check_uuid,
   newdev->offset = grub_be_to_cpu32 (header.payloadOffset);
   newdev->source_disk = NULL;
   newdev->log_sector_size = 9;
-  newdev->total_length = grub_disk_get_size (disk) - newdev->offset;
+  newdev->total_sectors = grub_disk_get_size (disk) - newdev->offset;
   grub_memcpy (newdev->uuid, uuid, sizeof (uuid));
   newdev->modname = "luks";
 
index 31d7166fc101c2bdc0e8dcf6f8fad2e3af5683d3..3173a098d45e970102a3e1b283ee5a6d3a7bd7cf 100644 (file)
@@ -609,9 +609,9 @@ luks2_recover_key (grub_disk_t disk,
       crypt->log_sector_size = sizeof (unsigned int) * 8
                - __builtin_clz ((unsigned int) segment.sector_size) - 1;
       if (grub_strcmp (segment.size, "dynamic") == 0)
-       crypt->total_length = grub_disk_get_size (disk) - crypt->offset;
+       crypt->total_sectors = grub_disk_get_size (disk) - crypt->offset;
       else
-       crypt->total_length = grub_strtoull (segment.size, NULL, 10);
+       crypt->total_sectors = grub_strtoull (segment.size, NULL, 10);
 
       ret = luks2_decrypt_key (candidate_key, disk, crypt, &keyslot,
                               (const grub_uint8_t *) passphrase, grub_strlen (passphrase));
index e1b21e78578780ef3a75ee3e0eb25ef2f688335a..6ed850bb5ec1d56f096023e701c2744e5b3f3c75 100644 (file)
@@ -67,7 +67,8 @@ struct grub_cryptodisk
 
   char *source;
   grub_disk_addr_t offset;
-  grub_disk_addr_t total_length;
+  /* Total number of encrypted sectors of size (1 << log_sector_size). */
+  grub_disk_addr_t total_sectors;
   grub_disk_t source_disk;
   int ref;
   grub_crypto_cipher_handle_t cipher;