From: Ritvik Gupta <ritvikfoss@gmail.com>
To: shuah@kernel.org
Cc: linux-kselftest@vger.kernel.org, linux-kernel@vger.kernel.org,
linux-kernel-mentees@lists.linuxfoundation.org,
skhan@linuxfoundation.org
Subject: [PATCH] selftests/mount: Use 'const' for filename parameters
Date: Mon, 24 Feb 2025 08:20:28 +0530 [thread overview]
Message-ID: <20250224025028.3407-1-ritvikfoss@gmail.com> (raw)
The filename parameter in write_file(), maybe_write_file(),
and vmaybe_write_file() is unmodified / read-only.
So, used 'const' to improve type safety.
Signed-off-by: Ritvik Gupta <ritvikfoss@gmail.com>
---
tools/testing/selftests/mount/unprivileged-remount-test.c | 6 +++---
1 file changed, 3 insertions(+), 3 deletions(-)
diff --git a/tools/testing/selftests/mount/unprivileged-remount-test.c b/tools/testing/selftests/mount/unprivileged-remount-test.c
index d2917054fe3a..e80ac76261e7 100644
--- a/tools/testing/selftests/mount/unprivileged-remount-test.c
+++ b/tools/testing/selftests/mount/unprivileged-remount-test.c
@@ -54,7 +54,7 @@ static void die(char *fmt, ...)
exit(EXIT_FAILURE);
}
-static void vmaybe_write_file(bool enoent_ok, char *filename, char *fmt, va_list ap)
+static void vmaybe_write_file(bool enoent_ok, const char *filename, char *fmt, va_list ap)
{
char buf[4096];
int fd;
@@ -92,7 +92,7 @@ static void vmaybe_write_file(bool enoent_ok, char *filename, char *fmt, va_list
}
}
-static void maybe_write_file(char *filename, char *fmt, ...)
+static void maybe_write_file(const char *filename, char *fmt, ...)
{
va_list ap;
@@ -102,7 +102,7 @@ static void maybe_write_file(char *filename, char *fmt, ...)
}
-static void write_file(char *filename, char *fmt, ...)
+static void write_file(const char *filename, char *fmt, ...)
{
va_list ap;
--
2.48.1
reply other threads:[~2025-02-24 2:50 UTC|newest]
Thread overview: [no followups] expand[flat|nested] mbox.gz Atom feed
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=20250224025028.3407-1-ritvikfoss@gmail.com \
--to=ritvikfoss@gmail.com \
--cc=linux-kernel-mentees@lists.linuxfoundation.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-kselftest@vger.kernel.org \
--cc=shuah@kernel.org \
--cc=skhan@linuxfoundation.org \
/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