From: Davidlohr Bueso <dave@xxxxxxx> This function allows users to obtain the device's 512-byte sector count. Signed-off-by: Davidlohr Bueso <dave@xxxxxxx> --- shlibs/blkid/docs/libblkid-sections.txt | 1 + shlibs/blkid/src/blkid.h.in | 1 + shlibs/blkid/src/blkid.sym | 1 + shlibs/blkid/src/probe.c | 11 +++++++++++ 4 files changed, 14 insertions(+), 0 deletions(-) diff --git a/shlibs/blkid/docs/libblkid-sections.txt b/shlibs/blkid/docs/libblkid-sections.txt index c8b0045..47675f4 100644 --- a/shlibs/blkid/docs/libblkid-sections.txt +++ b/shlibs/blkid/docs/libblkid-sections.txt @@ -42,6 +42,7 @@ blkid_new_probe blkid_new_probe_from_filename blkid_probe_get_devno blkid_probe_get_sectorsize +blkid_probe_get_sectors blkid_probe_get_size blkid_probe_set_device blkid_reset_probe diff --git a/shlibs/blkid/src/blkid.h.in b/shlibs/blkid/src/blkid.h.in index 7fa2fde..95ce910 100644 --- a/shlibs/blkid/src/blkid.h.in +++ b/shlibs/blkid/src/blkid.h.in @@ -203,6 +203,7 @@ extern int blkid_probe_is_wholedisk(blkid_probe pr); extern blkid_loff_t blkid_probe_get_size(blkid_probe pr); extern blkid_loff_t blkid_probe_get_offset(blkid_probe pr); extern unsigned int blkid_probe_get_sectorsize(blkid_probe pr); +extern unsigned long long blkid_probe_get_sectors(blkid_probe pr); extern int blkid_probe_get_fd(blkid_probe pr); diff --git a/shlibs/blkid/src/blkid.sym b/shlibs/blkid/src/blkid.sym index 4085d2c..f6e488a 100644 --- a/shlibs/blkid/src/blkid.sym +++ b/shlibs/blkid/src/blkid.sym @@ -100,6 +100,7 @@ global: blkid_probe_get_devno; blkid_probe_get_partitions; blkid_probe_get_sectorsize; + blkid_probe_get_sectors; blkid_probe_get_size; blkid_probe_get_topology; blkid_probe_invert_partitions_filter; diff --git a/shlibs/blkid/src/probe.c b/shlibs/blkid/src/probe.c index a748f2e..4483e54 100644 --- a/shlibs/blkid/src/probe.c +++ b/shlibs/blkid/src/probe.c @@ -1188,6 +1188,17 @@ unsigned int blkid_probe_get_sectorsize(blkid_probe pr) } /** + * blkid_probe_get_sectors: + * @pr: probe + * + * Returns: sector count in bytes or -1 in case of error. + */ +unsigned long long blkid_probe_get_sectors(blkid_probe pr) +{ + return pr ? pr->size >> 9 : -1; +} + +/** * blkid_probe_numof_values: * @pr: probe * -- 1.7.1 -- To unsubscribe from this list: send the line "unsubscribe util-linux-ng" in the body of a message to majordomo@xxxxxxxxxxxxxxx More majordomo info at http://vger.kernel.org/majordomo-info.html