* [LTP] [PATCH] inotify: modernize with SAFE_ wrappers and fix minor style issues
@ 2026-02-07 17:06 Jinseok Kim
2026-02-11 9:11 ` Andrea Cervesato via ltp
` (2 more replies)
0 siblings, 3 replies; 6+ messages in thread
From: Jinseok Kim @ 2026-02-07 17:06 UTC (permalink / raw)
To: ltp
These are small cleanups to align with current LTP style:
- Use SAFE_ wrappers instead of manual calls
- Remove trailing comma in tst_res() for cleaner logs
Signed-off-by: Jinseok Kim <always.starving0@gmail.com>
---
testcases/kernel/syscalls/inotify/inotify02.c | 21 ++++---------------
1 file changed, 4 insertions(+), 17 deletions(-)
diff --git a/testcases/kernel/syscalls/inotify/inotify02.c b/testcases/kernel/syscalls/inotify/inotify02.c
index 709a92830..314c1bd49 100644
--- a/testcases/kernel/syscalls/inotify/inotify02.c
+++ b/testcases/kernel/syscalls/inotify/inotify02.c
@@ -64,11 +64,7 @@ void verify_inotify(void)
strcpy(event_set[test_cnt].name, "");
test_cnt++;
- if ((fd = creat(FILE_NAME1, 0755)) == -1) {
- tst_brk(TBROK | TERRNO,
- "creat(\"%s\", 755) failed", FILE_NAME1);
- }
-
+ fd = SAFE_CREAT(FILE_NAME1, 0755);
event_set[test_cnt].mask = IN_CREATE;
strcpy(event_set[test_cnt].name, FILE_NAME1);
test_cnt++;
@@ -89,11 +85,7 @@ void verify_inotify(void)
strcpy(event_set[test_cnt].name, FILE_NAME2);
test_cnt++;
- if (getcwd(fname1, BUF_SIZE) == NULL) {
- tst_brk(TBROK | TERRNO,
- "getcwd(%p, %d) failed", fname1, BUF_SIZE);
- }
-
+ SAFE_GETCWD(fname1, BUF_SIZE);
snprintf(fname2, BUF_SIZE, "%s.rename1", fname1);
SAFE_RENAME(fname1, fname2);
event_set[test_cnt].mask = IN_MOVE_SELF;
@@ -120,12 +112,7 @@ void verify_inotify(void)
test_cnt++;
int len, i = 0, test_num = 0;
- if ((len = read(fd_notify, event_buf, EVENT_BUF_LEN)) == -1) {
- tst_brk(TBROK | TERRNO,
- "read(%d, buf, %zu) failed",
- fd_notify, EVENT_BUF_LEN);
-
- }
+ len = SAFE_READ(0, fd_notify, event_buf, EVENT_BUF_LEN);
while (i < len) {
struct inotify_event *event;
@@ -208,7 +195,7 @@ static void cleanup(void)
{
if (reap_wd && myinotify_rm_watch(fd_notify, wd) < 0) {
tst_res(TWARN,
- "inotify_rm_watch (%d, %d) failed,", fd_notify, wd);
+ "inotify_rm_watch (%d, %d) failed", fd_notify, wd);
}
if (fd_notify > 0)
--
2.43.0
--
Mailing list info: https://lists.linux.it/listinfo/ltp
^ permalink raw reply related [flat|nested] 6+ messages in thread
* Re: [LTP] [PATCH] inotify: modernize with SAFE_ wrappers and fix minor style issues
2026-02-07 17:06 [LTP] [PATCH] inotify: modernize with SAFE_ wrappers and fix minor style issues Jinseok Kim
@ 2026-02-11 9:11 ` Andrea Cervesato via ltp
2026-02-11 10:12 ` Jinseok Kim
2026-02-11 16:31 ` Cyril Hrubis
2026-02-20 12:09 ` Andrea Cervesato via ltp
2 siblings, 1 reply; 6+ messages in thread
From: Andrea Cervesato via ltp @ 2026-02-11 9:11 UTC (permalink / raw)
To: Jinseok Kim, ltp
Hi!
> + len = SAFE_READ(0, fd_notify, event_buf, EVENT_BUF_LEN);
is there a reason why you set `len_strict` to zero in the SAFE_READ()
macro?
Kind regards,
--
Andrea Cervesato
SUSE QE Automation Engineer Linux
andrea.cervesato@suse.com
--
Mailing list info: https://lists.linux.it/listinfo/ltp
^ permalink raw reply [flat|nested] 6+ messages in thread
* [LTP] [PATCH] inotify: modernize with SAFE_ wrappers and fix minor style issues
2026-02-11 9:11 ` Andrea Cervesato via ltp
@ 2026-02-11 10:12 ` Jinseok Kim
2026-02-11 10:25 ` Andrea Cervesato via ltp
0 siblings, 1 reply; 6+ messages in thread
From: Jinseok Kim @ 2026-02-11 10:12 UTC (permalink / raw)
To: ltp
Hi Andrea,
Thanks for the review!
I set len_strict=0 intentionally.
With len_strict=1, SAFE_READ would trigger TBROK on partial reads (e.g.
240 bytes when EVENT_BUF_LEN=32768), which are normal and expected for
an inotify fd.
len_strict=0 still catches real read errors (ret=-1), while allowing
partial reads so the test can continue processing the events.
Thanks,
Jinseok.
--
Mailing list info: https://lists.linux.it/listinfo/ltp
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [LTP] [PATCH] inotify: modernize with SAFE_ wrappers and fix minor style issues
2026-02-11 10:12 ` Jinseok Kim
@ 2026-02-11 10:25 ` Andrea Cervesato via ltp
0 siblings, 0 replies; 6+ messages in thread
From: Andrea Cervesato via ltp @ 2026-02-11 10:25 UTC (permalink / raw)
To: Jinseok Kim, ltp
+1
This patch will be merged when it will receive a second review tag.
Thanks
--
Andrea Cervesato
SUSE QE Automation Engineer Linux
andrea.cervesato@suse.com
--
Mailing list info: https://lists.linux.it/listinfo/ltp
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [LTP] [PATCH] inotify: modernize with SAFE_ wrappers and fix minor style issues
2026-02-07 17:06 [LTP] [PATCH] inotify: modernize with SAFE_ wrappers and fix minor style issues Jinseok Kim
2026-02-11 9:11 ` Andrea Cervesato via ltp
@ 2026-02-11 16:31 ` Cyril Hrubis
2026-02-20 12:09 ` Andrea Cervesato via ltp
2 siblings, 0 replies; 6+ messages in thread
From: Cyril Hrubis @ 2026-02-11 16:31 UTC (permalink / raw)
To: Jinseok Kim; +Cc: ltp
Hi!
Looks obviously correct to me:
Reviewed-by: Cyril Hrubis <chrubis@suse.cz>
--
Cyril Hrubis
chrubis@suse.cz
--
Mailing list info: https://lists.linux.it/listinfo/ltp
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [LTP] [PATCH] inotify: modernize with SAFE_ wrappers and fix minor style issues
2026-02-07 17:06 [LTP] [PATCH] inotify: modernize with SAFE_ wrappers and fix minor style issues Jinseok Kim
2026-02-11 9:11 ` Andrea Cervesato via ltp
2026-02-11 16:31 ` Cyril Hrubis
@ 2026-02-20 12:09 ` Andrea Cervesato via ltp
2 siblings, 0 replies; 6+ messages in thread
From: Andrea Cervesato via ltp @ 2026-02-20 12:09 UTC (permalink / raw)
To: Jinseok Kim, ltp
Merged, thanks!
--
Mailing list info: https://lists.linux.it/listinfo/ltp
^ permalink raw reply [flat|nested] 6+ messages in thread
end of thread, other threads:[~2026-02-20 12:10 UTC | newest]
Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-02-07 17:06 [LTP] [PATCH] inotify: modernize with SAFE_ wrappers and fix minor style issues Jinseok Kim
2026-02-11 9:11 ` Andrea Cervesato via ltp
2026-02-11 10:12 ` Jinseok Kim
2026-02-11 10:25 ` Andrea Cervesato via ltp
2026-02-11 16:31 ` Cyril Hrubis
2026-02-20 12:09 ` Andrea Cervesato via ltp
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox