mirror of
https://gitlab.com/cryptsetup/cryptsetup.git
synced 2025-12-06 00:10:04 +01:00
Mark all sizes in status and dump output in the correct units.
NOTE: This is possibly an incompatible change as it changes text output. Since the support of --sector-size option, the description "sectors" became ambiguous as it usually means 512-byte sectors (device-mapper unit). Major confusion occurs when the sector size is 4096 bytes while units display is in 512-bytes. Unfortunately, there is no clear compatible way, so this patch adds [512-byte units] marker and also additional byte size value. All other fields that display units are changed to use the "[units]" format. The integrity format is also unified with the common style with ':' as a separator. Fixes: #884.
This commit is contained in:
@@ -742,7 +742,7 @@ int BITLK_dump(struct crypt_device *cd, struct device *device, struct bitlk_meta
|
||||
log_std(cd, "Description: \t%s\n", params->description);
|
||||
log_std(cd, "Cipher name: \t%s\n", params->cipher);
|
||||
log_std(cd, "Cipher mode: \t%s\n", params->cipher_mode);
|
||||
log_std(cd, "Cipher key: \t%u bits\n", params->key_size);
|
||||
log_std(cd, "Cipher key: \t%u [bits]\n", params->key_size);
|
||||
|
||||
log_std(cd, "\n");
|
||||
|
||||
|
||||
@@ -83,23 +83,26 @@ int INTEGRITY_read_sb(struct crypt_device *cd,
|
||||
int INTEGRITY_dump(struct crypt_device *cd, struct device *device, uint64_t offset)
|
||||
{
|
||||
struct superblock sb;
|
||||
uint64_t sector_size;
|
||||
int r;
|
||||
|
||||
r = INTEGRITY_read_superblock(cd, device, offset, &sb);
|
||||
if (r)
|
||||
return r;
|
||||
|
||||
log_std(cd, "Info for integrity device %s.\n", device_path(device));
|
||||
log_std(cd, "superblock_version %d\n", (unsigned)sb.version);
|
||||
log_std(cd, "log2_interleave_sectors %d\n", sb.log2_interleave_sectors);
|
||||
log_std(cd, "integrity_tag_size %u\n", sb.integrity_tag_size);
|
||||
log_std(cd, "journal_sections %u\n", sb.journal_sections);
|
||||
log_std(cd, "provided_data_sectors %" PRIu64 "\n", sb.provided_data_sectors);
|
||||
log_std(cd, "sector_size %u\n", SECTOR_SIZE << sb.log2_sectors_per_block);
|
||||
sector_size = SECTOR_SIZE << sb.log2_sectors_per_block;
|
||||
log_std(cd, "INTEGRITY header information for %s.\n", device_path(device));
|
||||
log_std(cd, "version: %d\n", (unsigned)sb.version);
|
||||
log_std(cd, "tag size: %u [bytes]\n", sb.integrity_tag_size);
|
||||
log_std(cd, "sector size: %" PRIu64 " [bytes]\n", sector_size);
|
||||
log_std(cd, "data size: %" PRIu64 " [512-byte units] (%" PRIu64 " [bytes])\n",
|
||||
sb.provided_data_sectors, sb.provided_data_sectors * SECTOR_SIZE);
|
||||
if (sb.version >= SB_VERSION_2 && (sb.flags & SB_FLAG_RECALCULATING))
|
||||
log_std(cd, "recalc_sector %" PRIu64 "\n", sb.recalc_sector);
|
||||
log_std(cd, "log2_blocks_per_bitmap %u\n", sb.log2_blocks_per_bitmap_bit);
|
||||
log_std(cd, "flags %s%s%s%s%s\n",
|
||||
log_std(cd, "recalculate sector: %" PRIu64 "\n", sb.recalc_sector);
|
||||
log_std(cd, "journal sections: %u\n", sb.journal_sections);
|
||||
log_std(cd, "log2 interleave sectors: %d\n", sb.log2_interleave_sectors);
|
||||
log_std(cd, "log2 blocks per bitmap: %u\n", sb.log2_blocks_per_bitmap_bit);
|
||||
log_std(cd, "flags: %s%s%s%s%s\n",
|
||||
sb.flags & SB_FLAG_HAVE_JOURNAL_MAC ? "have_journal_mac " : "",
|
||||
sb.flags & SB_FLAG_RECALCULATING ? "recalculating " : "",
|
||||
sb.flags & SB_FLAG_DIRTY_BITMAP ? "dirty_bitmap " : "",
|
||||
|
||||
@@ -411,13 +411,13 @@ int VERITY_dump(struct crypt_device *cd,
|
||||
verity_blocks += rs_blocks;
|
||||
}
|
||||
|
||||
log_std(cd, "VERITY header information for %s\n", device_path(crypt_metadata_device(cd)));
|
||||
log_std(cd, "VERITY header information for %s.\n", device_path(crypt_metadata_device(cd)));
|
||||
log_std(cd, "UUID: \t%s\n", crypt_get_uuid(cd) ?: "");
|
||||
log_std(cd, "Hash type: \t%u\n", verity_hdr->hash_type);
|
||||
log_std(cd, "Data blocks: \t%" PRIu64 "\n", verity_hdr->data_size);
|
||||
log_std(cd, "Data block size: \t%u\n", verity_hdr->data_block_size);
|
||||
log_std(cd, "Data block size: \t%u [bytes]\n", verity_hdr->data_block_size);
|
||||
log_std(cd, "Hash blocks: \t%" PRIu64 "\n", hash_blocks);
|
||||
log_std(cd, "Hash block size: \t%u\n", verity_hdr->hash_block_size);
|
||||
log_std(cd, "Hash block size: \t%u [bytes]\n", verity_hdr->hash_block_size);
|
||||
log_std(cd, "Hash algorithm: \t%s\n", verity_hdr->hash_name);
|
||||
if (fec_device && fec_blocks) {
|
||||
log_std(cd, "FEC RS roots: \t%" PRIu32 "\n", verity_hdr->fec_roots);
|
||||
|
||||
Reference in New Issue
Block a user