From 56e961e270fd4b34015a688781dcc6b970c0e318 Mon Sep 17 00:00:00 2001 From: Karel Zak Date: Wed, 10 Mar 2010 15:50:45 +0100 Subject: [PATCH] libblkid: add blkid_probe_get_{offset,fd} functions Signed-off-by: Karel Zak --- shlibs/blkid/src/blkid.h.in | 3 +++ shlibs/blkid/src/blkid.sym | 6 ++++-- shlibs/blkid/src/probe.c | 24 ++++++++++++++++++++++++ 3 files changed, 31 insertions(+), 2 deletions(-) diff --git a/shlibs/blkid/src/blkid.h.in b/shlibs/blkid/src/blkid.h.in index edeb8b57..07001a3a 100644 --- a/shlibs/blkid/src/blkid.h.in +++ b/shlibs/blkid/src/blkid.h.in @@ -198,8 +198,11 @@ extern int blkid_probe_set_device(blkid_probe pr, int fd, extern dev_t blkid_probe_get_devno(blkid_probe pr); extern blkid_loff_t blkid_probe_get_size(blkid_probe pr); +extern blkid_loff_t blkid_probe_get_offset(blkid_probe pr); extern unsigned int blkid_probe_get_sectorsize(blkid_probe pr); +extern int blkid_probe_get_fd(blkid_probe pr); + /* * superblocks probing */ diff --git a/shlibs/blkid/src/blkid.sym b/shlibs/blkid/src/blkid.sym index dfde6891..a80e8739 100644 --- a/shlibs/blkid/src/blkid.sym +++ b/shlibs/blkid/src/blkid.sym @@ -120,7 +120,9 @@ global: */ BLKID_2.18 { global: - blkid_probe_all_removable; - blkid_partlist_devno_to_partition; blkid_partition_get_flags; + blkid_partlist_devno_to_partition; + blkid_probe_all_removable; + blkid_probe_get_fd; + blkid_probe_get_offset; } BLKID_2.17; diff --git a/shlibs/blkid/src/probe.c b/shlibs/blkid/src/probe.c index 4ca215b0..6d61386c 100644 --- a/shlibs/blkid/src/probe.c +++ b/shlibs/blkid/src/probe.c @@ -990,6 +990,30 @@ blkid_loff_t blkid_probe_get_size(blkid_probe pr) return pr ? pr->size : -1; } +/** + * blkid_probe_get_offset: + * @pr: probe + * + * This function returns offset of probing area as defined by blkid_probe_set_device(). + * + * Returns: offset in bytes or -1 in case of error. + */ +blkid_loff_t blkid_probe_get_offset(blkid_probe pr) +{ + return pr ? pr->off : -1; +} + +/** + * blkid_probe_get_fd: + * @pr: probe + * + * Returns: file descriptor for assigned device/file. + */ +int blkid_probe_get_fd(blkid_probe pr) +{ + return pr ? pr->fd : -1; +} + /** * blkid_probe_get_sectorsize: * @pr: probe -- 2.39.5