diff options
author | Karel Zak | 2010-09-29 23:42:43 +0200 |
---|---|---|
committer | Karel Zak | 2011-01-03 12:28:43 +0100 |
commit | f58168ffb6facb095ec3c618513ed49d730d7488 (patch) | |
tree | eca263d97a5668f4c62c048ddb12687029639a81 /shlibs/mount/src/cache.c | |
parent | libmount: add mtab managment to context API (diff) | |
download | kernel-qcow2-util-linux-f58168ffb6facb095ec3c618513ed49d730d7488.tar.gz kernel-qcow2-util-linux-f58168ffb6facb095ec3c618513ed49d730d7488.tar.xz kernel-qcow2-util-linux-f58168ffb6facb095ec3c618513ed49d730d7488.zip |
libmount: add mount(2) and /sbin/mount.<type> support
Signed-off-by: Karel Zak <kzak@redhat.com>
Diffstat (limited to 'shlibs/mount/src/cache.c')
-rw-r--r-- | shlibs/mount/src/cache.c | 12 |
1 files changed, 9 insertions, 3 deletions
diff --git a/shlibs/mount/src/cache.c b/shlibs/mount/src/cache.c index fe05febaa..c8fd8e77e 100644 --- a/shlibs/mount/src/cache.c +++ b/shlibs/mount/src/cache.c @@ -402,16 +402,18 @@ char *mnt_cache_find_tag_value(mnt_cache *cache, /** * mnt_get_fstype: * @devname: device name + * @ambi: returns TRUE if probing result is ambivalent (optional argument) * @cache: cache for results or NULL * * Returns: fileststem type or NULL in case of error. The result has to be * deallocated by free() if @cache is NULL. */ -char *mnt_get_fstype(const char *devname, mnt_cache *cache) +char *mnt_get_fstype(const char *devname, int *ambi, mnt_cache *cache) { blkid_probe pr; const char *data; char *type = NULL; + int rc; if (cache) return mnt_cache_find_tag_value(cache, devname, "TYPE"); @@ -423,10 +425,14 @@ char *mnt_get_fstype(const char *devname, mnt_cache *cache) blkid_probe_set_superblocks_flags(pr, BLKID_SUBLKS_TYPE); - if (!blkid_do_safeprobe(pr) && - !blkid_probe_lookup_value(pr, "TYPE", &data, NULL)) + rc = blkid_do_safeprobe(pr); + + if (!rc && !blkid_probe_lookup_value(pr, "TYPE", &data, NULL)) type = strdup(data); + if (ambi) + *ambi = rc == -2 ? TRUE : FALSE; + blkid_free_probe(pr); return type; } |