From: Li Wang <liwang@redhat.com>
To: ltp@lists.linux.it
Subject: [LTP] [PATCH v2 2/2] lib: mount tmpfs name as ltp-tmpfs
Date: Mon, 5 Jul 2021 16:25:27 +0800 [thread overview]
Message-ID: <20210705082527.855688-2-liwang@redhat.com> (raw)
In-Reply-To: <20210705082527.855688-1-liwang@redhat.com>
Given a specific name as "ltp-tmpfs" instead of the "/dev/loopX"
string in order to make "tmpfs" filesystem more evident.
Achieve that in get_device_name() function.
Suggested-by: Cyril Hrubis <chrubis@suse.cz>
Signed-off-by: Li Wang <liwang@redhat.com>
---
Notes:
V1 --> V2
* create a function get_device_name()
lib/tst_test.c | 12 ++++++++++--
1 file changed, 10 insertions(+), 2 deletions(-)
diff --git a/lib/tst_test.c b/lib/tst_test.c
index 93761868e..b85134709 100644
--- a/lib/tst_test.c
+++ b/lib/tst_test.c
@@ -907,6 +907,14 @@ static char *limit_tmpfs_mount_size(const char *mnt_data,
return buf;
}
+static const char *get_device_name(const char *fs_type)
+{
+ if (!strcmp(fs_type, "tmpfs"))
+ return "ltp-tmpfs";
+ else
+ return tdev.dev;
+}
+
static void prepare_device(void)
{
char *mnt_data, buf[1024];
@@ -926,8 +934,8 @@ static void prepare_device(void)
mnt_data = limit_tmpfs_mount_size(tst_test->mnt_data,
buf, sizeof(buf), tdev.fs_type);
- SAFE_MOUNT(tdev.dev, tst_test->mntpoint, tdev.fs_type,
- tst_test->mnt_flags, mnt_data);
+ SAFE_MOUNT(get_device_name(tdev.fs_type), tst_test->mntpoint,
+ tdev.fs_type, tst_test->mnt_flags, mnt_data);
mntpoint_mounted = 1;
}
}
--
2.31.1
next prev parent reply other threads:[~2021-07-05 8:25 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2021-07-05 8:25 [LTP] [PATCH v2 1/2] lib: limit the size of tmpfs in LTP Li Wang
2021-07-05 8:25 ` Li Wang [this message]
2021-07-07 9:32 ` [LTP] [PATCH v2 2/2] lib: mount tmpfs name as ltp-tmpfs Cyril Hrubis
2021-07-07 9:31 ` [LTP] [PATCH v2 1/2] lib: limit the size of tmpfs in LTP Cyril Hrubis
2021-07-08 2:50 ` Li Wang
2021-07-08 6:36 ` Li Wang
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=20210705082527.855688-2-liwang@redhat.com \
--to=liwang@redhat.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