public inbox for ltp@lists.linux.it
 help / color / mirror / Atom feed
From: Murphy Zhou <jencce.kernel@gmail.com>
To: ltp@lists.linux.it
Subject: [LTP] [PATCH v2] safe_mount: safe_umount: print debug info about the operation
Date: Wed,  7 Jun 2023 20:36:53 +0800	[thread overview]
Message-ID: <20230607123653.3897079-1-jencce.kernel@gmail.com> (raw)

Make the source and the target to mount/umount visible. It's
good for debugging.

Signed-off-by: Murphy Zhou <jencce.kernel@gmail.com>
---
 lib/safe_macros.c | 15 +++++++++++++++
 1 file changed, 15 insertions(+)

diff --git a/lib/safe_macros.c b/lib/safe_macros.c
index af6dd0716..6add92f06 100644
--- a/lib/safe_macros.c
+++ b/lib/safe_macros.c
@@ -898,7 +898,15 @@ int safe_mount(const char *file, const int lineno, void (*cleanup_fn)(void),
 	       const void *data)
 {
 	int rval = -1;
+	char mpath[PATH_MAX];
 
+	if (!realpath(target, mpath))
+		tst_brkm_(file, lineno, TBROK | TERRNO, cleanup_fn,
+			"realpath(%s, s) failed", target);
+
+	tst_resm_(file, lineno, TINFO,
+		"Mounting %s to %s fstyp=%s flags=%lx",
+		source, mpath, filesystemtype, mountflags);
 	/*
 	 * Don't try using the kernel's NTFS driver when mounting NTFS, since
 	 * the kernel's NTFS driver doesn't have proper write support.
@@ -948,6 +956,13 @@ int safe_umount(const char *file, const int lineno, void (*cleanup_fn)(void),
 		const char *target)
 {
 	int rval;
+	char mpath[PATH_MAX];
+
+	if (!realpath(target, mpath))
+		tst_brkm_(file, lineno, TBROK | TERRNO, cleanup_fn,
+			"realpath(%s, s) failed", target);
+
+	tst_resm_(file, lineno, TINFO, "Umounting %s", mpath);
 
 	rval = tst_umount(target);
 
-- 
2.31.1


-- 
Mailing list info: https://lists.linux.it/listinfo/ltp

             reply	other threads:[~2023-06-07 12:37 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-06-07 12:36 Murphy Zhou [this message]
2023-06-08  6:06 ` [LTP] [PATCH v2] safe_mount: safe_umount: print debug info about the operation Li Wang
2023-06-08 15:49 ` Martin Doucha

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20230607123653.3897079-1-jencce.kernel@gmail.com \
    --to=jencce.kernel@gmail.com \
    --cc=ltp@lists.linux.it \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox