[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[CRYPTO-LUKS v1 12/19] cryptodisk: Rename total_length field in grub_cry
From: |
Glenn Washburn |
Subject: |
[CRYPTO-LUKS v1 12/19] cryptodisk: Rename total_length field in grub_cryptodisk_t to total_sectors. |
Date: |
Fri, 31 Jul 2020 07:01:53 -0500 |
This makes the 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>
---
grub-core/disk/cryptodisk.c | 2 +-
grub-core/disk/geli.c | 2 +-
grub-core/disk/luks.c | 2 +-
grub-core/disk/luks2.c | 4 ++--
include/grub/cryptodisk.h | 2 +-
5 files changed, 6 insertions(+), 6 deletions(-)
diff --git a/grub-core/disk/cryptodisk.c b/grub-core/disk/cryptodisk.c
index 014a8a95b..9399849b6 100644
--- a/grub-core/disk/cryptodisk.c
+++ b/grub-core/disk/cryptodisk.c
@@ -705,7 +705,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++;
diff --git a/grub-core/disk/geli.c b/grub-core/disk/geli.c
index e9d23299a..4ec875821 100644
--- a/grub-core/disk/geli.c
+++ b/grub-core/disk/geli.c
@@ -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;
diff --git a/grub-core/disk/luks.c b/grub-core/disk/luks.c
index a1ac078d1..b1db3d137 100644
--- a/grub-core/disk/luks.c
+++ b/grub-core/disk/luks.c
@@ -113,7 +113,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 = LOG_SECTOR_SIZE;
- newdev->total_length = grub_disk_get_size (disk) - newdev->offset;
+ newdev->total_sectors = grub_disk_get_size (disk) - newdev->offset;
grub_memcpy (newdev->uuid, header.uuid, sizeof (newdev->uuid));
newdev->modname = "luks";
diff --git a/grub-core/disk/luks2.c b/grub-core/disk/luks2.c
index 5e4ce858e..28d9fe0e0 100644
--- a/grub-core/disk/luks2.c
+++ b/grub-core/disk/luks2.c
@@ -610,10 +610,10 @@ luks2_recover_key (grub_disk_t source,
* Convert to cryptodisk sized sectors from source disk sized sectors
* before subtracting the offset, which is in cryptodisk sized sectors.
*/
- crypt->total_length = (grub_disk_get_size (source) >>
(crypt->log_sector_size - source->log_sector_size))
+ crypt->total_sectors = (grub_disk_get_size (source) >>
(crypt->log_sector_size - source->log_sector_size))
- crypt->offset;
else
- crypt->total_length = grub_strtoull (segment.size, NULL, 10) >>
crypt->log_sector_size;
+ crypt->total_sectors = grub_strtoull (segment.size, NULL, 10) >>
crypt->log_sector_size;
ret = luks2_decrypt_key (candidate_key, source, crypt, &keyslot,
(const grub_uint8_t *) passphrase, grub_strlen
(passphrase));
diff --git a/include/grub/cryptodisk.h b/include/grub/cryptodisk.h
index 06653a622..f9e42796e 100644
--- a/include/grub/cryptodisk.h
+++ b/include/grub/cryptodisk.h
@@ -67,7 +67,7 @@ struct grub_cryptodisk
char *source;
grub_disk_addr_t offset;
- grub_disk_addr_t total_length;
+ grub_disk_addr_t total_sectors;
grub_disk_t source_disk;
int ref;
grub_crypto_cipher_handle_t cipher;
--
2.25.1
- [CRYPTO-LUKS v1 03/19] cryptodisk: Incorrect calculation of start sector for grub_disk_read in grub_cryptodisk_read., (continued)
- [CRYPTO-LUKS v1 03/19] cryptodisk: Incorrect calculation of start sector for grub_disk_read in grub_cryptodisk_read., Glenn Washburn, 2020/07/31
- [CRYPTO-LUKS v1 04/19] cryptodisk: Add more verbosity when reading/writing cryptodisks., Glenn Washburn, 2020/07/31
- [CRYPTO-LUKS v1 05/19] luks2: Add support for LUKS2 in (proc)/luks_script, Glenn Washburn, 2020/07/31
- [CRYPTO-LUKS v1 06/19] luks2: Rename source disk variabled named 'disk' to 'source' as in luks.c., Glenn Washburn, 2020/07/31
- [CRYPTO-LUKS v1 07/19] luks2: grub_cryptodisk_t->total_length is the max number of device native sectors., Glenn Washburn, 2020/07/31
- [CRYPTO-LUKS v1 08/19] cryptodisk, luks: Allow special processing for comparing UUIDs., Glenn Washburn, 2020/07/31
- [CRYPTO-LUKS v1 09/19] cryptodisk: Unregister cryptomount command when removing module., Glenn Washburn, 2020/07/31
- [CRYPTO-LUKS v1 10/19] fs: Fix block lists not being able to address to end of disk sometimes., Glenn Washburn, 2020/07/31
- [CRYPTO-LUKS v1 11/19] cryptodisk: Properly handle non-512 byte sized sectors., Glenn Washburn, 2020/07/31
- [CRYPTO-LUKS v1 12/19] cryptodisk: Rename total_length field in grub_cryptodisk_t to total_sectors.,
Glenn Washburn <=
- [CRYPTO-LUKS v1 13/19] fs: Allow number of blocks in block list to be optional, where length will be defaulted to the length of the device., Glenn Washburn, 2020/07/31
- [CRYPTO-LUKS v1 14/19] loopback: Add procfs entry 'loopbacks' to output configured loopback devices., Glenn Washburn, 2020/07/31
- [CRYPTO-LUKS v1 15/19] cryptodisk, luks2: Add header line to procfs entry and crypto and source device names., Glenn Washburn, 2020/07/31
- [CRYPTO-LUKS v1 16/19] cryptodisk: Add a couple comments noting the usage of a couple fields in grub_cryptodisk_t as is done for grub_disk_t., Glenn Washburn, 2020/07/31
- [CRYPTO-LUKS v1 17/19] luks2: Ensure that bit fields of grub_luks2_digest_t in luks2_parse_digest are initialized before returning., Glenn Washburn, 2020/07/31
- [CRYPTO-LUKS v1 18/19] luks2: Fix use of incorrect index and some error messages., Glenn Washburn, 2020/07/31
- [CRYPTO-LUKS v1 19/19] cryptodisk: Rename offset in grub_cryptodisk_t to offset_sectors to improve readability., Glenn Washburn, 2020/07/31
- Re: [CRYPTO-LUKS v1 00/19] Fixes and improvements for cryptodisks+luks2 and a few other things., Patrick Steinhardt, 2020/07/31