summaryrefslogtreecommitdiffstats
path: root/libmount/samples/mount.c
diff options
context:
space:
mode:
authorKarel Zak2011-06-23 16:06:27 +0200
committerKarel Zak2011-06-23 16:06:27 +0200
commit2576b4e7821339f79bc25660f86291b55c0c6486 (patch)
tree98ce8e58f7eabc379a811df968d4a3a9b3e55ab4 /libmount/samples/mount.c
parentlibmount: cleanup return codes in mount sample (diff)
downloadkernel-qcow2-util-linux-2576b4e7821339f79bc25660f86291b55c0c6486.tar.gz
kernel-qcow2-util-linux-2576b4e7821339f79bc25660f86291b55c0c6486.tar.xz
kernel-qcow2-util-linux-2576b4e7821339f79bc25660f86291b55c0c6486.zip
libmount: allow to convert /dev/loopN to backing filename
Signed-off-by: Karel Zak <kzak@redhat.com>
Diffstat (limited to 'libmount/samples/mount.c')
-rw-r--r--libmount/samples/mount.c7
1 files changed, 4 insertions, 3 deletions
diff --git a/libmount/samples/mount.c b/libmount/samples/mount.c
index 76956d5ab..e01612144 100644
--- a/libmount/samples/mount.c
+++ b/libmount/samples/mount.c
@@ -118,13 +118,13 @@ static void print_all(struct libmnt_context *cxt, char *pattern, int show_label)
const char *type = mnt_fs_get_fstype(fs);
const char *src = mnt_fs_get_source(fs);
const char *optstr = mnt_fs_get_options(fs);
+ char *xsrc;
if (type && pattern && !mnt_match_fstype(type, pattern))
continue;
- /* TODO: print loop backing file instead of device name */
-
- printf ("%s on %s", src ? : "none", mnt_fs_get_target(fs));
+ xsrc = mnt_pretty_path(src, cache);
+ printf ("%s on %s", xsrc, mnt_fs_get_target(fs));
if (type)
printf (" type %s", type);
if (optstr)
@@ -135,6 +135,7 @@ static void print_all(struct libmnt_context *cxt, char *pattern, int show_label)
printf (" [%s]", lb);
}
fputc('\n', stdout);
+ free(xsrc);
}
mnt_free_cache(cache);