From: Karel Zak Date: Tue, 15 Sep 2009 21:00:12 +0000 (+0200) Subject: libblkid: add generic function for binary data X-Git-Url: https://err.no/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=22571ebbf4e14fae1e90e6ebc0ec86193605a57a;p=util-linux libblkid: add generic function for binary data Signed-off-by: Karel Zak --- diff --git a/shlibs/blkid/src/blkidP.h b/shlibs/blkid/src/blkidP.h index 6187e1ee..c5617044 100644 --- a/shlibs/blkid/src/blkidP.h +++ b/shlibs/blkid/src/blkidP.h @@ -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); diff --git a/shlibs/blkid/src/probe.c b/shlibs/blkid/src/probe.c index b72bcb40..d4662322 100644 --- a/shlibs/blkid/src/probe.c +++ b/shlibs/blkid/src/probe.c @@ -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