diff options
author | Karel Zak | 2012-10-09 11:56:35 +0200 |
---|---|---|
committer | Karel Zak | 2012-10-09 11:56:35 +0200 |
commit | 84600ddc6d34d88c9aa6e0a6145457f14d71acf7 (patch) | |
tree | b277a4e356490d75c22f304b9e982c7a8a4ae48f /sys-utils/mount.c | |
parent | libmount: fix umount file.img (diff) | |
download | kernel-qcow2-util-linux-84600ddc6d34d88c9aa6e0a6145457f14d71acf7.tar.gz kernel-qcow2-util-linux-84600ddc6d34d88c9aa6e0a6145457f14d71acf7.tar.xz kernel-qcow2-util-linux-84600ddc6d34d88c9aa6e0a6145457f14d71acf7.zip |
mount: add verbose messages
Addresses: https://bugzilla.redhat.com/show_bug.cgi?id=864227
Signed-off-by: Karel Zak <kzak@redhat.com>
Diffstat (limited to 'sys-utils/mount.c')
-rw-r--r-- | sys-utils/mount.c | 26 |
1 files changed, 25 insertions, 1 deletions
diff --git a/sys-utils/mount.c b/sys-utils/mount.c index 0ac3d9083..a6d046ba6 100644 --- a/sys-utils/mount.c +++ b/sys-utils/mount.c @@ -230,6 +230,29 @@ static int mount_all(struct libmnt_context *cxt) return rc; } +static void success_message(struct libmnt_context *cxt) +{ + unsigned long mflags = 0; + const char *tgt, *src; + + if (mnt_context_helper_executed(cxt) + || mnt_context_get_status(cxt) != 1) + return; + + mnt_context_get_mflags(cxt, &mflags); + tgt = mnt_context_get_target(cxt); + src = mnt_context_get_source(cxt); + + if (mflags & MS_MOVE) + warnx(_("%s moved to %s"), src, tgt); + else if (mflags & MS_BIND) + warnx(_("%s binded on %s"), src, tgt); + else if (mflags & MS_PROPAGATION) + warnx(_("%s propagation flags changed"), tgt); + else + warnx(_("%s mounted on %s"), src, tgt); +} + /* * Handles generic errors like ENOMEM, ... * @@ -294,7 +317,6 @@ static void selinux_warning(struct libmnt_context *cxt, const char *tgt) # define selinux_warning(_x, _y) #endif - /* * rc = 0 success * <0 error (usually -errno or -1) @@ -949,6 +971,8 @@ int main(int argc, char **argv) rc = mnt_context_mount(cxt); rc = mk_exit_code(cxt, rc); + if (rc == MOUNT_EX_SUCCESS && mnt_context_is_verbose(cxt)) + success_message(cxt); done: mnt_free_context(cxt); mnt_free_table(fstab); |