]> err.no Git - util-linux/commitdiff
libblkid: allow to change dimension of probing area
authorKarel Zak <kzak@redhat.com>
Tue, 15 Sep 2009 20:53:25 +0000 (22:53 +0200)
committerKarel Zak <kzak@redhat.com>
Wed, 16 Sep 2009 08:57:23 +0000 (10:57 +0200)
Signed-off-by: Karel Zak <kzak@redhat.com>
shlibs/blkid/src/blkidP.h
shlibs/blkid/src/probe.c

index de26ab135017b3823042142a2a548ed16791f9bc..b6fa563459d20abb0053375cad2757c97f1e5765 100644 (file)
@@ -371,6 +371,12 @@ extern void blkid_free_dev(blkid_dev dev);
 unsigned char *blkid_probe_get_buffer(blkid_probe pr,
                                 blkid_loff_t off, blkid_loff_t len);
 
+extern int blkid_probe_get_dimension(blkid_probe pr,
+                       blkid_loff_t *off, blkid_loff_t *size);
+
+extern int blkid_probe_set_dimension(blkid_probe pr,
+                       blkid_loff_t off, blkid_loff_t size);
+
 /* returns superblok according to 'struct blkid_idmag' */
 #define blkid_probe_get_sb(_pr, _mag, type) \
                        ((type *) blkid_probe_get_buffer((_pr),\
index a3d08114e304cc93a7c2e7d9c20d65bb246e6c46..d3da7165b9275dc9dc1045d86eaecd433f074f8e 100644 (file)
@@ -509,6 +509,39 @@ int blkid_probe_set_device(blkid_probe pr, int fd,
        return 0;
 }
 
+int blkid_probe_get_dimension(blkid_probe pr,
+               blkid_loff_t *off, blkid_loff_t *size)
+{
+       if (!pr)
+               return -1;
+
+       *off = pr->off;
+       *size = pr->size;
+       return 0;
+}
+
+int blkid_probe_set_dimension(blkid_probe pr,
+               blkid_loff_t off, blkid_loff_t size)
+{
+       if (!pr)
+               return -1;
+
+       DBG(DEBUG_LOWPROBE, printf(
+               "changing probing area: size=%llu, off=%llu "
+               "-to-> size=%llu, off=%llu\n",
+               (unsigned long long) pr->size,
+               (unsigned long long) pr->off,
+               (unsigned long long) size,
+               (unsigned long long) off));
+
+       pr->off = off;
+       pr->size = size;
+
+       blkid_probe_reset_buffer(pr);
+
+       return 0;
+}
+
 /**
  * blkid_do_probe:
  * @pr: prober