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:
Milan Broz
2024-12-02 16:11:43 +01:00
parent ea39aecba3
commit f8788f347e
11 changed files with 82 additions and 75 deletions

View File

@@ -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);