From: Jinseok Kim <always.starving0@gmail.com>
To: andrea.cervesato@suse.com, chrubis@suse.cz
Cc: ltp@lists.linux.it
Subject: [LTP] [PATCH v2 2/2] inotify: fix make check findings
Date: Sat, 14 Mar 2026 01:05:16 +0900 [thread overview]
Message-ID: <20260313160520.39745-2-always.starving0@gmail.com> (raw)
In-Reply-To: <20260313160520.39745-1-always.starving0@gmail.com>
Fix various issues reported by `make check` in inotify syscall tests:
- Fix SPDX license comment style
- Make local functions and variables static
- Replace DIR_MODE macro with an octal permission value
- Fix minor style and prototype issues
Signed-off-by: Jinseok Kim <always.starving0@gmail.com>
---
testcases/kernel/syscalls/inotify/inotify.h | 5 +++--
testcases/kernel/syscalls/inotify/inotify01.c | 4 +++-
testcases/kernel/syscalls/inotify/inotify02.c | 8 +++++---
testcases/kernel/syscalls/inotify/inotify03.c | 5 +++--
testcases/kernel/syscalls/inotify/inotify04.c | 13 ++++++-------
testcases/kernel/syscalls/inotify/inotify05.c | 2 +-
testcases/kernel/syscalls/inotify/inotify07.c | 8 ++++----
testcases/kernel/syscalls/inotify/inotify08.c | 5 +++--
testcases/kernel/syscalls/inotify/inotify10.c | 8 ++++----
9 files changed, 32 insertions(+), 26 deletions(-)
diff --git a/testcases/kernel/syscalls/inotify/inotify.h b/testcases/kernel/syscalls/inotify/inotify.h
index dbf814902..7ac4f4908 100644
--- a/testcases/kernel/syscalls/inotify/inotify.h
+++ b/testcases/kernel/syscalls/inotify/inotify.h
@@ -1,4 +1,4 @@
-// SPDX-License-Identifier: GPL-2.0-or-later
+/* SPDX-License-Identifier: GPL-2.0-or-later */
/*
* inotify testcase common definitions.
*
@@ -51,7 +51,8 @@ static inline int safe_myinotify_init(const char *file, const int lineno, int fd
#define SAFE_MYINOTIFY_INIT1(flags) \
safe_myinotify_init(__FILE__, __LINE__, myinotify_init1(flags))
-static inline int safe_myinotify_watch(const char *file, const int lineno, int wd, int fd, const char* fname, const char* mask)
+static inline int safe_myinotify_watch(const char *file, const int lineno, int wd,
+ int fd, const char *fname, const char *mask)
{
if (wd < 0) {
tst_brk(TBROK | TERRNO,
diff --git a/testcases/kernel/syscalls/inotify/inotify01.c b/testcases/kernel/syscalls/inotify/inotify01.c
index 972b1025e..12aadf862 100644
--- a/testcases/kernel/syscalls/inotify/inotify01.c
+++ b/testcases/kernel/syscalls/inotify/inotify01.c
@@ -40,7 +40,7 @@ static unsigned int event_set[EVENT_MAX];
static char event_buf[EVENT_BUF_LEN];
-void verify_inotify(void)
+static void verify_inotify(void)
{
int test_cnt = 0;
@@ -79,6 +79,7 @@ void verify_inotify(void)
* get list of events
*/
int len, i = 0, test_num = 0;
+
len = SAFE_READ(0, fd_notify, event_buf, EVENT_BUF_LEN);
/*
@@ -86,6 +87,7 @@ void verify_inotify(void)
*/
while (i < len) {
struct inotify_event *event;
+
event = (struct inotify_event *)&event_buf[i];
if (test_num >= test_cnt) {
tst_res(TFAIL,
diff --git a/testcases/kernel/syscalls/inotify/inotify02.c b/testcases/kernel/syscalls/inotify/inotify02.c
index 423676bf9..67e01d14a 100644
--- a/testcases/kernel/syscalls/inotify/inotify02.c
+++ b/testcases/kernel/syscalls/inotify/inotify02.c
@@ -43,6 +43,7 @@ struct event_t {
char name[BUF_SIZE];
unsigned int mask;
};
+
#define FILE_NAME1 "test_file1"
#define FILE_NAME2 "test_file2"
@@ -50,7 +51,7 @@ static struct event_t event_set[EVENT_MAX];
static char event_buf[EVENT_BUF_LEN];
-void verify_inotify(void)
+static void verify_inotify(void)
{
unsigned int stored_cookie = UINT_MAX;
@@ -112,10 +113,12 @@ void verify_inotify(void)
test_cnt++;
int len, i = 0, test_num = 0;
+
len = SAFE_READ(0, fd_notify, event_buf, EVENT_BUF_LEN);
while (i < len) {
struct inotify_event *event;
+
event = (struct inotify_event *)&event_buf[i];
if (test_num >= test_cnt) {
tst_res(TFAIL,
@@ -125,8 +128,7 @@ void verify_inotify(void)
event->cookie, event->len, event->len,
event->name);
- } else if ((event_set[test_num].mask == event->mask)
- &&
+ } else if ((event_set[test_num].mask == event->mask) &&
(!strncmp
(event_set[test_num].name, event->name,
event->len))) {
diff --git a/testcases/kernel/syscalls/inotify/inotify03.c b/testcases/kernel/syscalls/inotify/inotify03.c
index a7974dd57..8a5103bd8 100644
--- a/testcases/kernel/syscalls/inotify/inotify03.c
+++ b/testcases/kernel/syscalls/inotify/inotify03.c
@@ -40,12 +40,12 @@ static unsigned int event_set[EVENT_MAX];
static char event_buf[EVENT_BUF_LEN];
-#define DIR_MODE (S_IRWXU | S_IRUSR | S_IXUSR | S_IRGRP | S_IXGRP)
+#define DIR_MODE 0750
static char *mntpoint = "mntpoint";
static int mount_flag;
-void verify_inotify(void)
+static void verify_inotify(void)
{
int ret;
int len, i, test_num;
@@ -81,6 +81,7 @@ void verify_inotify(void)
i = 0;
while (i < len) {
struct inotify_event *event;
+
event = (struct inotify_event *)&event_buf[i];
if (test_num >= (test_cnt - 1)) {
tst_res(TFAIL,
diff --git a/testcases/kernel/syscalls/inotify/inotify04.c b/testcases/kernel/syscalls/inotify/inotify04.c
index 2d7f34bae..ed6ba5d36 100644
--- a/testcases/kernel/syscalls/inotify/inotify04.c
+++ b/testcases/kernel/syscalls/inotify/inotify04.c
@@ -35,7 +35,6 @@
/* reasonable guess as to size of 1024 events */
#define EVENT_BUF_LEN (EVENT_MAX * (EVENT_SIZE + 16))
-
#define BUF_SIZE 256
struct event_t {
@@ -46,11 +45,11 @@ struct event_t {
#define TEST_DIR "test_dir"
#define TEST_FILE "test_file"
-struct event_t event_set[EVENT_MAX];
+static struct event_t event_set[EVENT_MAX];
-char event_buf[EVENT_BUF_LEN];
+static char event_buf[EVENT_BUF_LEN];
-int fd_notify, reap_wd_file, reap_wd_dir, wd_dir, wd_file;
+static int fd_notify, reap_wd_file, reap_wd_dir, wd_dir, wd_file;
static void cleanup(void)
{
@@ -73,7 +72,7 @@ static void setup(void)
fd_notify = SAFE_MYINOTIFY_INIT();
}
-void verify_inotify(void)
+static void verify_inotify(void)
{
int i = 0, test_num = 0, len;
int test_cnt = 0;
@@ -122,6 +121,7 @@ void verify_inotify(void)
while (i < len) {
struct inotify_event *event;
+
event = (struct inotify_event *)&event_buf[i];
if (test_num >= test_cnt) {
tst_res(TFAIL,
@@ -130,8 +130,7 @@ void verify_inotify(void)
"name=\"%.*s\"", event->wd, event->mask,
event->cookie, event->len, event->len, event->name);
- } else if ((event_set[test_num].mask == event->mask)
- &&
+ } else if ((event_set[test_num].mask == event->mask) &&
(!strncmp
(event_set[test_num].name, event->name,
event->len))) {
diff --git a/testcases/kernel/syscalls/inotify/inotify05.c b/testcases/kernel/syscalls/inotify/inotify05.c
index 82a4c7bdc..1a38056f0 100644
--- a/testcases/kernel/syscalls/inotify/inotify05.c
+++ b/testcases/kernel/syscalls/inotify/inotify05.c
@@ -36,7 +36,7 @@ static int max_events;
static char event_buf[EVENT_BUF_LEN];
-void verify_inotify(void)
+static void verify_inotify(void)
{
int i;
int len, stop;
diff --git a/testcases/kernel/syscalls/inotify/inotify07.c b/testcases/kernel/syscalls/inotify/inotify07.c
index f0acd9e91..3da45fc6c 100644
--- a/testcases/kernel/syscalls/inotify/inotify07.c
+++ b/testcases/kernel/syscalls/inotify/inotify07.c
@@ -65,7 +65,7 @@ static const char mntpoint[] = OVL_BASE_MNTPOINT;
static struct event_t event_set[EVENT_MAX];
static char event_buf[EVENT_BUF_LEN];
-void verify_inotify(void)
+static void verify_inotify(void)
{
int test_cnt = 0;
@@ -89,10 +89,11 @@ void verify_inotify(void)
test_cnt++;
int len = SAFE_READ(0, fd_notify, event_buf, EVENT_BUF_LEN);
-
int i = 0, test_num = 0;
+
while (i < len) {
struct inotify_event *event;
+
event = (struct inotify_event *)&event_buf[i];
if (test_num >= test_cnt) {
tst_res(TFAIL,
@@ -101,8 +102,7 @@ void verify_inotify(void)
"name=\"%.*s\"", event->wd, event->mask,
event->cookie, event->len, event->len,
event->name);
- } else if ((event_set[test_num].mask == event->mask)
- &&
+ } else if ((event_set[test_num].mask == event->mask) &&
(!strncmp
(event_set[test_num].name, event->name,
event->len))) {
diff --git a/testcases/kernel/syscalls/inotify/inotify08.c b/testcases/kernel/syscalls/inotify/inotify08.c
index e0837cac3..154654ce3 100644
--- a/testcases/kernel/syscalls/inotify/inotify08.c
+++ b/testcases/kernel/syscalls/inotify/inotify08.c
@@ -63,7 +63,7 @@ static const char mntpoint[] = OVL_BASE_MNTPOINT;
static struct event_t event_set[EVENT_MAX];
static char event_buf[EVENT_BUF_LEN];
-void verify_inotify(void)
+static void verify_inotify(void)
{
int test_cnt = 0;
@@ -87,10 +87,11 @@ void verify_inotify(void)
SAFE_TOUCH(OVL_UPPER"/"FILE_NAME, 0644, NULL);
int len = SAFE_READ(0, fd_notify, event_buf, EVENT_BUF_LEN);
-
int i = 0, test_num = 0;
+
while (i < len) {
struct inotify_event *event;
+
event = (struct inotify_event *)&event_buf[i];
if (test_num >= test_cnt) {
tst_res(TFAIL,
diff --git a/testcases/kernel/syscalls/inotify/inotify10.c b/testcases/kernel/syscalls/inotify/inotify10.c
index 0a94ead15..80b7a825b 100644
--- a/testcases/kernel/syscalls/inotify/inotify10.c
+++ b/testcases/kernel/syscalls/inotify/inotify10.c
@@ -32,7 +32,6 @@
#define EVENT_SIZE (sizeof(struct inotify_event))
#define EVENT_BUF_LEN (EVENT_MAX * (EVENT_SIZE + 16))
-
#define BUF_SIZE 256
struct event_t {
@@ -75,11 +74,11 @@ static struct tcase {
},
};
-struct event_t event_set[EVENT_MAX];
+static struct event_t event_set[EVENT_MAX];
-char event_buf[EVENT_BUF_LEN];
+static char event_buf[EVENT_BUF_LEN];
-int fd_notify, fd_notify_other;
+static int fd_notify, fd_notify_other;
static void verify_inotify(unsigned int n)
{
@@ -150,6 +149,7 @@ static void verify_inotify(unsigned int n)
while (i < len) {
struct event_t *expected = &event_set[test_num];
struct inotify_event *event;
+
event = (struct inotify_event *)&event_buf[i];
if (test_num >= test_cnt) {
tst_res(TFAIL,
--
2.43.0
--
Mailing list info: https://lists.linux.it/listinfo/ltp
next prev parent reply other threads:[~2026-03-13 16:07 UTC|newest]
Thread overview: 15+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-03-01 16:57 [LTP] [PATCH] inotify: clean up build and make check findings Jinseok Kim
2026-03-03 15:46 ` Andrea Cervesato via ltp
2026-03-06 7:20 ` Jinseok Kim
2026-03-06 11:28 ` Cyril Hrubis
2026-03-09 14:48 ` Jinseok Kim
2026-03-13 16:05 ` [LTP] [PATCH v2 1/2] inotify: replace strcpy() with snprintf() Jinseok Kim
2026-03-13 16:05 ` Jinseok Kim [this message]
2026-03-16 12:31 ` [LTP] [PATCH v2 2/2] inotify: fix make check findings Andrea Cervesato via ltp
2026-05-12 15:38 ` Jinseok Kim
2026-03-16 12:30 ` [LTP] [PATCH v2 1/2] inotify: replace strcpy() with snprintf() Andrea Cervesato via ltp
2026-03-16 15:44 ` [LTP] [PATCH v3] " Jinseok Kim
2026-03-17 9:39 ` Andrea Cervesato via ltp
2026-03-17 17:00 ` Jinseok Kim
2026-03-18 13:40 ` Andrea Cervesato via ltp
2026-05-12 15:34 ` Jinseok Kim
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=20260313160520.39745-2-always.starving0@gmail.com \
--to=always.starving0@gmail.com \
--cc=andrea.cervesato@suse.com \
--cc=chrubis@suse.cz \
--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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.