diff options
author | Karel Zak | 2017-01-13 13:26:37 +0100 |
---|---|---|
committer | Karel Zak | 2017-01-13 13:26:37 +0100 |
commit | 76fab513b8f2c128a29c36cbc622d1a624b0be19 (patch) | |
tree | a1201a04ce757f3b6a60b7f056e7c0a48d0a3c04 /libblkid/src/probe.c | |
parent | libfdisk: change the way how apply user device properties (diff) | |
download | kernel-qcow2-util-linux-76fab513b8f2c128a29c36cbc622d1a624b0be19.tar.gz kernel-qcow2-util-linux-76fab513b8f2c128a29c36cbc622d1a624b0be19.tar.xz kernel-qcow2-util-linux-76fab513b8f2c128a29c36cbc622d1a624b0be19.zip |
libblkid: add blkid_probe_set_sectorsize()
The usual way is to use ioctl to ask block device for sector size, but
this is useless for disk images (regular files). And the default
(512-bytes) may be pretty wrong for disk images from 4K disks. Let's
support a way how to specify proper sector size.
Signed-off-by: Karel Zak <kzak@redhat.com>
Diffstat (limited to 'libblkid/src/probe.c')
-rw-r--r-- | libblkid/src/probe.c | 16 |
1 files changed, 16 insertions, 0 deletions
diff --git a/libblkid/src/probe.c b/libblkid/src/probe.c index ea50f5a6b..df90a82e0 100644 --- a/libblkid/src/probe.c +++ b/libblkid/src/probe.c @@ -1672,6 +1672,22 @@ unsigned int blkid_probe_get_sectorsize(blkid_probe pr) } /** + * blkid_probe_set_sectorsize: + * @pr: probe + * @sz: new size (to overwrite system default) + * + * Note that blkid_probe_set_device() resets this setting. Use it after + * blkid_probe_set_device() and before any probing call. + * + * Returns: 0 or <0 in case of error + */ +int blkid_probe_set_sectorsize(blkid_probe pr, unsigned int sz) +{ + pr->blkssz = sz; + return 0; +} + +/** * blkid_probe_get_sectors: * @pr: probe * |