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>
blkid_probe_get_wholedisk_devno
blkid_probe_is_wholedisk
blkid_probe_set_device
+blkid_probe_set_sectorsize
blkid_probe_step_back
blkid_reset_probe
</SECTION>
__ul_attribute__((nonnull));
extern unsigned int blkid_probe_get_sectorsize(blkid_probe pr)
__ul_attribute__((nonnull));
+extern int blkid_probe_set_sectorsize(blkid_probe pr, unsigned int sz)
+ __ul_attribute__((nonnull));
extern blkid_loff_t blkid_probe_get_sectors(blkid_probe pr)
__ul_attribute__((nonnull));
BLKID_2.25 {
blkid_partlist_get_partition_by_partno;
} BLKID_2.23;
+
+BLKID_2.30 {
+ blkid_probe_set_sectorsize;
+} BLKID_2.25;
return pr->blkssz;
}
+/**
+ * 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