From: Amir Goldstein <amir73il@gmail.com>
To: Petr Vorel <pvorel@suse.cz>
Cc: Matthew Bobrowski <repnop@google.com>, Jan Kara <jack@suse.cz>,
ltp@lists.linux.it
Subject: [LTP] [PATCH 2/6] syscalls/fanotify14: Add tests for FAN_REPORT_TARGET_FID and FAN_RENAME
Date: Thu, 14 Apr 2022 17:53:53 +0300 [thread overview]
Message-ID: <20220414145357.3184012-3-amir73il@gmail.com> (raw)
In-Reply-To: <20220414145357.3184012-1-amir73il@gmail.com>
Validate flag combinations:
1) FAN_REPORT_TARGET_FID requires FAN_REPORT_NAME and FAN_REPORT_FID
2) FAN_RENAME requires FAN_REPORT_NAME
Signed-off-by: Amir Goldstein <amir73il@gmail.com>
---
testcases/kernel/syscalls/fanotify/fanotify.h | 15 +++++++++++++++
testcases/kernel/syscalls/fanotify/fanotify14.c | 12 ++++++++++++
2 files changed, 27 insertions(+)
diff --git a/testcases/kernel/syscalls/fanotify/fanotify.h b/testcases/kernel/syscalls/fanotify/fanotify.h
index b2855d292..eb690e332 100644
--- a/testcases/kernel/syscalls/fanotify/fanotify.h
+++ b/testcases/kernel/syscalls/fanotify/fanotify.h
@@ -81,6 +81,11 @@ static inline int safe_fanotify_mark(const char *file, const int lineno,
#ifndef FAN_REPORT_PIDFD
#define FAN_REPORT_PIDFD 0x00000080
#endif
+#ifndef FAN_REPORT_TARGET_FID
+#define FAN_REPORT_TARGET_FID 0x00001000
+#define FAN_REPORT_DFID_NAME_TARGET (FAN_REPORT_DFID_NAME | \
+ FAN_REPORT_FID | FAN_REPORT_TARGET_FID)
+#endif
/* Non-uapi convenience macros */
#ifndef FAN_REPORT_DFID_NAME_FID
@@ -130,6 +135,9 @@ static inline int safe_fanotify_mark(const char *file, const int lineno,
#ifndef FAN_FS_ERROR
#define FAN_FS_ERROR 0x00008000
#endif
+#ifndef FAN_RENAME
+#define FAN_RENAME 0x10000000
+#endif
/* Additional error status codes that can be returned to userspace */
#ifndef FAN_NOPIDFD
@@ -185,6 +193,13 @@ typedef struct {
#define FAN_EVENT_INFO_TYPE_ERROR 5
#endif
+#ifndef FAN_EVENT_INFO_TYPE_OLD_DFID_NAME
+#define FAN_EVENT_INFO_TYPE_OLD_DFID_NAME 10
+#endif
+#ifndef FAN_EVENT_INFO_TYPE_NEW_DFID_NAME
+#define FAN_EVENT_INFO_TYPE_NEW_DFID_NAME 12
+#endif
+
#ifndef HAVE_STRUCT_FANOTIFY_EVENT_INFO_HEADER
struct fanotify_event_info_header {
uint8_t info_type;
diff --git a/testcases/kernel/syscalls/fanotify/fanotify14.c b/testcases/kernel/syscalls/fanotify/fanotify14.c
index 1944bcbb4..5d74b9b91 100644
--- a/testcases/kernel/syscalls/fanotify/fanotify14.c
+++ b/testcases/kernel/syscalls/fanotify/fanotify14.c
@@ -62,6 +62,18 @@ static struct test_case_t {
/* FAN_REPORT_NAME without FAN_REPORT_DIR_FID is not valid */
FAN_CLASS_NOTIF | FAN_REPORT_FID | FAN_REPORT_NAME, 0, 0
},
+ {
+ /* FAN_REPORT_TARGET_FID without FAN_REPORT_FID is not valid */
+ FAN_CLASS_NOTIF | FAN_REPORT_TARGET_FID | FAN_REPORT_DFID_NAME, 0, 0
+ },
+ {
+ /* FAN_REPORT_TARGET_FID without FAN_REPORT_NAME is not valid */
+ FAN_CLASS_NOTIF | FAN_REPORT_TARGET_FID | FAN_REPORT_DFID_FID, 0, 0
+ },
+ {
+ /* FAN_RENAME without FAN_REPORT_NAME is not valid */
+ FAN_CLASS_NOTIF | FAN_REPORT_DFID_FID, 0, FAN_RENAME
+ },
};
static void do_test(unsigned int number)
--
2.35.1
--
Mailing list info: https://lists.linux.it/listinfo/ltp
next prev parent reply other threads:[~2022-04-14 14:54 UTC|newest]
Thread overview: 11+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-04-14 14:53 [LTP] [PATCH 0/6] Fanotify tests for v5.17 features Amir Goldstein
2022-04-14 14:53 ` [LTP] [PATCH 1/6] syscalls/fcntl: New test for DN_RENAME (dnotify) Amir Goldstein
2022-04-14 15:12 ` Petr Vorel
2022-04-14 15:31 ` Amir Goldstein
2022-04-14 19:03 ` Petr Vorel
2022-04-14 14:53 ` Amir Goldstein [this message]
2022-04-14 14:53 ` [LTP] [PATCH 3/6] syscalls/fanotify16: Add test cases for FAN_REPORT_TARGET_FID Amir Goldstein
2022-04-14 14:53 ` [LTP] [PATCH 4/6] syscalls/fanotify16: Add test cases for FAN_RENAME Amir Goldstein
2022-04-14 14:53 ` [LTP] [PATCH 5/6] syscalls/fanotify16: Test FAN_RENAME with one watching directory Amir Goldstein
2022-04-14 14:53 ` [LTP] [PATCH 6/6] syscalls/fanotify16: Test FAN_RENAME with ignored mask Amir Goldstein
2022-04-19 5:39 ` [LTP] [PATCH 0/6] Fanotify tests for v5.17 features Petr Vorel
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=20220414145357.3184012-3-amir73il@gmail.com \
--to=amir73il@gmail.com \
--cc=jack@suse.cz \
--cc=ltp@lists.linux.it \
--cc=pvorel@suse.cz \
--cc=repnop@google.com \
/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.