From: Karel Zak Date: Tue, 15 Sep 2009 20:55:05 +0000 (+0200) Subject: libblkid: allow to read in sectors X-Git-Url: https://err.no/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=ce011388e1e7afa16b8051cdb870ebd9064017d5;p=util-linux libblkid: allow to read in sectors Signed-off-by: Karel Zak --- diff --git a/shlibs/blkid/src/blkidP.h b/shlibs/blkid/src/blkidP.h index b6fa5634..6187e1ee 100644 --- a/shlibs/blkid/src/blkidP.h +++ b/shlibs/blkid/src/blkidP.h @@ -371,6 +371,8 @@ 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 unsigned char *blkid_probe_get_sector(blkid_probe pr, unsigned int sector); + extern int blkid_probe_get_dimension(blkid_probe pr, blkid_loff_t *off, blkid_loff_t *size); diff --git a/shlibs/blkid/src/probe.c b/shlibs/blkid/src/probe.c index d3da7165..b72bcb40 100644 --- a/shlibs/blkid/src/probe.c +++ b/shlibs/blkid/src/probe.c @@ -720,6 +720,13 @@ done: return count ? 0 : 1; } +/* same sa blkid_probe_get_buffer() but works with 512-sectors */ +unsigned char *blkid_probe_get_sector(blkid_probe pr, unsigned int sector) +{ + return pr ? blkid_probe_get_buffer(pr, + ((blkid_loff_t) sector) << 9, 0x200) : NULL; +} + struct blkid_prval *blkid_probe_assign_value( blkid_probe pr, const char *name) {