From patchwork Thu Nov 30 09:37:06 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jan Kara X-Patchwork-Id: 1870013 X-Patchwork-Delegate: petr.vorel@gmail.com Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@legolas.ozlabs.org Authentication-Results: legolas.ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=lists.linux.it (client-ip=213.254.12.146; helo=picard.linux.it; envelope-from=ltp-bounces+incoming=patchwork.ozlabs.org@lists.linux.it; receiver=patchwork.ozlabs.org) Received: from picard.linux.it (picard.linux.it [213.254.12.146]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (secp384r1)) (No client certificate requested) by legolas.ozlabs.org (Postfix) with ESMTPS id 4SgrjM5Rj2z1ySd for ; Thu, 30 Nov 2023 20:38:31 +1100 (AEDT) Received: from picard.linux.it (localhost [IPv6:::1]) by picard.linux.it (Postfix) with ESMTP id 43FE53CF633 for ; Thu, 30 Nov 2023 10:38:29 +0100 (CET) X-Original-To: ltp@lists.linux.it Delivered-To: ltp@picard.linux.it Received: from in-5.smtp.seeweb.it (in-5.smtp.seeweb.it [IPv6:2001:4b78:1:20::5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (P-384)) (No client certificate requested) by picard.linux.it (Postfix) with ESMTPS id 252763CD5EF for ; Thu, 30 Nov 2023 10:37:13 +0100 (CET) Received: from smtp-out2.suse.de (smtp-out2.suse.de [195.135.223.131]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by in-5.smtp.seeweb.it (Postfix) with ESMTPS id B4ED4603445 for ; Thu, 30 Nov 2023 10:37:12 +0100 (CET) Received: from imap2.dmz-prg2.suse.org (imap2.dmz-prg2.suse.org [IPv6:2a07:de40:b281:104:10:150:64:98]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (No client certificate requested) by smtp-out2.suse.de (Postfix) with ESMTPS id D290F1FCDA; Thu, 30 Nov 2023 09:37:11 +0000 (UTC) Received: from imap2.dmz-prg2.suse.org (localhost [127.0.0.1]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (No client certificate requested) by imap2.dmz-prg2.suse.org (Postfix) with ESMTPS id C338613B49; Thu, 30 Nov 2023 09:37:11 +0000 (UTC) Received: from dovecot-director2.suse.de ([10.150.64.162]) by imap2.dmz-prg2.suse.org with ESMTPSA id NxdXL8dXaGVXKAAAn2gu4w (envelope-from ); Thu, 30 Nov 2023 09:37:11 +0000 Received: by quack3.suse.cz (Postfix, from userid 1000) id 57D91A07EA; Thu, 30 Nov 2023 10:37:11 +0100 (CET) From: Jan Kara To: ltp@lists.linux.it Date: Thu, 30 Nov 2023 10:37:06 +0100 Message-Id: <20231130093711.20171-3-jack@suse.cz> X-Mailer: git-send-email 2.35.3 In-Reply-To: <20231130093533.10036-1-jack@suse.cz> References: <20231130093533.10036-1-jack@suse.cz> MIME-Version: 1.0 X-Spam-Level: Authentication-Results: smtp-out2.suse.de; none X-Rspamd-Server: rspamd2 X-Spamd-Result: default: False [-4.00 / 50.00]; REPLY(-4.00)[] X-Spam-Score: -4.00 X-Rspamd-Queue-Id: D290F1FCDA X-Virus-Scanned: clamav-milter 1.0.1 at in-5.smtp.seeweb.it X-Virus-Status: Clean X-Spam-Status: No, score=-0.0 required=7.0 tests=SPF_HELO_NONE,SPF_PASS, T_SCC_BODY_TEXT_LINE shortcircuit=no autolearn=disabled version=4.0.0 X-Spam-Checker-Version: SpamAssassin 4.0.0 (2022-12-13) on in-5.smtp.seeweb.it Subject: [LTP] [PATCH v2 3/7] fanotify: Provide fanotify_mark_supported_on_fs() X-BeenThere: ltp@lists.linux.it X-Mailman-Version: 2.1.29 Precedence: list List-Id: Linux Test Project List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Jan Kara Errors-To: ltp-bounces+incoming=patchwork.ozlabs.org@lists.linux.it Sender: "ltp" Provide helper checking whether a mark is supported on a filesystem since some marks need not be available on all filesystems (e.g. btrfs subvolumes). Also convert REQUIRE_MARK_TYPE_SUPPORTED_BY_KERNEL() and its only user to use this new function. Signed-off-by: Jan Kara Reviewed-by: Amir Goldstein --- testcases/kernel/syscalls/fanotify/fanotify.h | 11 ++++++++--- testcases/kernel/syscalls/fanotify/fanotify23.c | 2 +- 2 files changed, 9 insertions(+), 4 deletions(-) diff --git a/testcases/kernel/syscalls/fanotify/fanotify.h b/testcases/kernel/syscalls/fanotify/fanotify.h index 3b8838e8dd68..597ed96e0313 100644 --- a/testcases/kernel/syscalls/fanotify/fanotify.h +++ b/testcases/kernel/syscalls/fanotify/fanotify.h @@ -229,6 +229,11 @@ static inline int fanotify_init_flags_supported_by_kernel(unsigned int flags) return fanotify_init_flags_supported_on_fs(flags, NULL); } +static inline int fanotify_mark_supported_on_fs(uint64_t flag, const char *fname) +{ + return fanotify_flags_supported_on_fs(FAN_CLASS_NOTIF, flag, FAN_ACCESS, fname); +} + #define TST_FANOTIFY_INIT_KNOWN_FLAGS \ (FAN_REPORT_DFID_NAME_TARGET | FAN_REPORT_TID | FAN_REPORT_PIDFD | \ FAN_CLASS_NOTIF | FAN_CLASS_CONTENT | FAN_CLASS_PRE_CONTENT) @@ -336,9 +341,9 @@ static inline int fanotify_handle_supported_by_kernel(int flag) return 0; } -#define REQUIRE_MARK_TYPE_SUPPORTED_BY_KERNEL(mark_type) \ +#define REQUIRE_MARK_TYPE_SUPPORTED_ON_FS(mark_type, fname) \ fanotify_flags_err_msg(#mark_type, __FILE__, __LINE__, tst_brk_, \ - fanotify_mark_supported_by_kernel(mark_type)) + fanotify_mark_supported_on_fs(mark_type, fname)) #define REQUIRE_HANDLE_TYPE_SUPPORTED_BY_KERNEL(handle_type) \ fanotify_flags_err_msg(#handle_type, __FILE__, __LINE__, tst_brk_, \ @@ -346,7 +351,7 @@ static inline int fanotify_handle_supported_by_kernel(int flag) #define REQUIRE_FANOTIFY_EVENTS_SUPPORTED_ON_FS(init_flags, mark_type, mask, fname) do { \ if (mark_type) \ - REQUIRE_MARK_TYPE_SUPPORTED_BY_KERNEL(mark_type); \ + REQUIRE_MARK_TYPE_SUPPORTED_ON_FS(mark_type, fname); \ if (init_flags) \ REQUIRE_FANOTIFY_INIT_FLAGS_SUPPORTED_ON_FS(init_flags, fname); \ fanotify_flags_err_msg(#mask, __FILE__, __LINE__, tst_brk_, \ diff --git a/testcases/kernel/syscalls/fanotify/fanotify23.c b/testcases/kernel/syscalls/fanotify/fanotify23.c index fb812c51e34e..5a03503e952a 100644 --- a/testcases/kernel/syscalls/fanotify/fanotify23.c +++ b/testcases/kernel/syscalls/fanotify/fanotify23.c @@ -230,7 +230,7 @@ static void setup(void) { SAFE_TOUCH(TEST_FILE, 0666, NULL); - REQUIRE_MARK_TYPE_SUPPORTED_BY_KERNEL(FAN_MARK_EVICTABLE); + REQUIRE_MARK_TYPE_SUPPORTED_ON_FS(FAN_MARK_EVICTABLE, "."); REQUIRE_FANOTIFY_EVENTS_SUPPORTED_ON_FS(FAN_CLASS_NOTIF|FAN_REPORT_FID, FAN_MARK_FILESYSTEM, FAN_ATTRIB, ".");