public inbox for linux-nfs@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH] umount: make it sensitive to -v
@ 2014-10-24 10:03 Karel Zak
  2014-10-24 13:37 ` Steve Dickson
  0 siblings, 1 reply; 2+ messages in thread
From: Karel Zak @ 2014-10-24 10:03 UTC (permalink / raw)
  To: linux-nfs; +Cc: Steve Dickson, Karel Zak

Let's print verbose messages like original non-libmount version.

Addresses: https://bugzilla.redhat.com/show_bug.cgi?id=923582
Signed-off-by: Karel Zak <kzak@redhat.com>
---
 utils/mount/mount_libmount.c | 14 +++++++++++++-
 1 file changed, 13 insertions(+), 1 deletion(-)

diff --git a/utils/mount/mount_libmount.c b/utils/mount/mount_libmount.c
index 6f85dc9..fa46d54 100644
--- a/utils/mount/mount_libmount.c
+++ b/utils/mount/mount_libmount.c
@@ -174,7 +174,7 @@ static int umount_main(struct libmnt_context *cxt, int argc, char **argv)
 {
 	int rc, c;
 	char *spec = NULL, *opts = NULL;
-	int ret = EX_FAIL;
+	int ret = EX_FAIL, verbose = 0;
 
 	static const struct option longopts[] = {
 		{ "force", 0, 0, 'f' },
@@ -201,6 +201,8 @@ static int umount_main(struct libmnt_context *cxt, int argc, char **argv)
 		return EX_USAGE;
 	}
 
+	verbose = mnt_context_is_verbose(cxt);
+
 	if (optind < argc)
 		spec = argv[optind++];
 
@@ -228,6 +230,10 @@ static int umount_main(struct libmnt_context *cxt, int argc, char **argv)
 		goto err;
 	}
 
+	if (verbose)
+		printf(_("%s: %s mount point detected\n"), spec,
+					mnt_context_get_fstype(cxt));
+
 	opts = retrieve_mount_options(mnt_context_get_fs(cxt));
 
 	if (!mnt_context_is_lazy(cxt)) {
@@ -263,6 +269,12 @@ static int umount_main(struct libmnt_context *cxt, int argc, char **argv)
 	}
 	ret = EX_SUCCESS;
 err:
+	if (verbose) {
+		if (ret == EX_SUCCESS)
+			printf(_("%s: umounted\n"), spec);
+		else
+			printf(_("%s: umount failed\n"), spec);
+	}
 	free(opts);
 	return ret;
 }
-- 
1.9.3


^ permalink raw reply related	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2014-10-24 13:37 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2014-10-24 10:03 [PATCH] umount: make it sensitive to -v Karel Zak
2014-10-24 13:37 ` Steve Dickson

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox