summaryrefslogtreecommitdiff
path: root/shlibs/blkid/src
diff options
context:
space:
mode:
authorDavidlohr Bueso <dave@gnu.org>2010-11-11 10:34:52 -0300
committerKarel Zak <kzak@redhat.com>2010-11-15 10:02:24 +0100
commite8ae49476e5391fc477adb75d891c6b43543ded8 (patch)
tree809840eb0a4bed73b0c910ecbadb955732fbf290 /shlibs/blkid/src
parenta4a27b06e88cadbbd3bc5a14b50a9ff70646b7d7 (diff)
downloadutil-linux-old-e8ae49476e5391fc477adb75d891c6b43543ded8.tar.gz
libblkid: add blkid_probe_get_sectors()
This function allows users to obtain the device's 512-byte sector count. Signed-off-by: Davidlohr Bueso <dave@gnu.org> Signed-off-by: Karel Zak <kzak@redhat.com>
Diffstat (limited to 'shlibs/blkid/src')
-rw-r--r--shlibs/blkid/src/blkid.h.in1
-rw-r--r--shlibs/blkid/src/blkid.sym1
-rw-r--r--shlibs/blkid/src/probe.c11
3 files changed, 13 insertions, 0 deletions
diff --git a/shlibs/blkid/src/blkid.h.in b/shlibs/blkid/src/blkid.h.in
index 7fa2fde6..46cbeb23 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 blkid_loff_t 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 4085d2ce..f6e488a9 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 a748f2e2..3698b99b 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: 512-byte sector count or -1 in case of error.
+ */
+blkid_loff_t blkid_probe_get_sectors(blkid_probe pr)
+{
+ return pr ? pr->size >> 9 : -1;
+}
+
+/**
* blkid_probe_numof_values:
* @pr: probe
*