mirror of
https://gitlab.com/cryptsetup/cryptsetup.git
synced 2025-12-05 16:00:05 +01:00
Add support for superblock BLOCK_SIZE property.
This commit is contained in:
committed by
Milan Broz
parent
f1eea3a4b3
commit
be5c5788d4
@@ -326,3 +326,16 @@ int blk_supported(void)
|
||||
#endif
|
||||
return r;
|
||||
}
|
||||
|
||||
unsigned blk_get_block_size(struct blkid_handle *h)
|
||||
{
|
||||
const char *data;
|
||||
unsigned block_size = 0;
|
||||
#ifdef HAVE_BLKID
|
||||
if (!blk_is_superblock(h) || !blkid_probe_has_value(h->pr, "BLOCK_SIZE") ||
|
||||
blkid_probe_lookup_value(h->pr, "BLOCK_SIZE", &data, NULL) ||
|
||||
sscanf(data, "%u", &block_size) != 1)
|
||||
block_size = 0;
|
||||
#endif
|
||||
return block_size;
|
||||
}
|
||||
|
||||
@@ -62,4 +62,6 @@ int blk_do_wipe(struct blkid_handle *h);
|
||||
|
||||
int blk_supported(void);
|
||||
|
||||
unsigned blk_get_block_size(struct blkid_handle *h);
|
||||
|
||||
#endif
|
||||
|
||||
Reference in New Issue
Block a user