]> err.no Git - util-linux/commitdiff
libblkid: add blkid_probe_get_sectors()
authorDavidlohr Bueso <dave@gnu.org>
Thu, 11 Nov 2010 13:34:52 +0000 (10:34 -0300)
committerKarel Zak <kzak@redhat.com>
Mon, 15 Nov 2010 09:02:24 +0000 (10:02 +0100)
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>
shlibs/blkid/docs/libblkid-sections.txt
shlibs/blkid/src/blkid.h.in
shlibs/blkid/src/blkid.sym
shlibs/blkid/src/probe.c

index c8b0045d47aa6ececb0f9d92e3554cd19ae9267a..47675f4ae383f2db08a0c20d4cf6b98eef9bde03 100644 (file)
@@ -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
index 7fa2fde6bd06d5fa34526f364ab6639f167cf73d..46cbeb23b10fa031d302e4b7544bd39bf6733edf 100644 (file)
@@ -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);
 
index 4085d2cee5f5f0c43119e66bb72d762a449880d7..f6e488a9cdfccc2d2b845bc472ca38f64a8638af 100644 (file)
@@ -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;
index a748f2e249dbcd682cbc7d46788a30f7e4d2d604..3698b99b3bfa5d6b4f0c2d27b64965b8f0f20c27 100644 (file)
@@ -1187,6 +1187,17 @@ unsigned int blkid_probe_get_sectorsize(blkid_probe pr)
        return pr->blkssz;
 }
 
+/**
+ * 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