libblkid: add generic function for binary data

Signed-off-by: Karel Zak <kzak@redhat.com>
This commit is contained in:
Karel Zak 2009-09-15 23:00:12 +02:00
parent ce011388e1
commit 22571ebbf4
2 changed files with 25 additions and 0 deletions

View 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);

View 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