]> err.no Git - util-linux/commitdiff
libblkid: add generic function for binary data
authorKarel Zak <kzak@redhat.com>
Tue, 15 Sep 2009 21:00:12 +0000 (23:00 +0200)
committerKarel Zak <kzak@redhat.com>
Wed, 16 Sep 2009 08:57:24 +0000 (10:57 +0200)
Signed-off-by: Karel Zak <kzak@redhat.com>
shlibs/blkid/src/blkidP.h
shlibs/blkid/src/probe.c

index 6187e1eebf0ef2d0a5af1dec41af9341bf911a48..c5617044bcd0a5e3617e40ac3815f0604759cb8d 100644 (file)
@@ -401,6 +401,7 @@ extern int __blkid_probe_invert_filter(blkid_probe pr, int chain);
 extern int __blkid_probe_reset_filter(blkid_probe pr, int chain);
 extern int __blkid_probe_filter_types(blkid_probe pr, int chain, int flag, char *names[]);
 
+extern void *blkid_probe_get_binary_data(blkid_probe pr, struct blkid_chain *chn);
 
 extern int blkid_probe_set_value(blkid_probe pr, const char *name,
                 unsigned char *data, size_t len);
index b72bcb40a542ceba7e7573be8758a4292f6fc6a5..d466232272d28f1d1f91c51c35250bc917859d85 100644 (file)
@@ -237,6 +237,30 @@ struct blkid_chain *blkid_probe_get_chain(blkid_probe pr)
        return pr->cur_chain;
 }
 
+void *blkid_probe_get_binary_data(blkid_probe pr, struct blkid_chain *chn)
+{
+       int rc;
+
+       if (!pr && !chn)
+               return NULL;
+
+       pr->cur_chain = chn;
+       chn->binary = TRUE;
+
+       rc = chn->driver->probe(pr, chn);
+
+       chn->binary = FALSE;
+       pr->cur_chain = NULL;
+
+       if (rc < 0)
+               return NULL;
+
+       DBG(DEBUG_LOWPROBE,
+               printf("returning %s binary data\n", chn->driver->name));
+       return chn->data;
+}
+
+
 /**
  * blkid_reset_probe:
  * @pr: probe