summaryrefslogtreecommitdiff
path: root/tools/testing/selftests/filesystems/utils.h
diff options
context:
space:
mode:
authorChristian Brauner <brauner@kernel.org>2025-05-12 11:40:18 +0200
committerChristian Brauner <brauner@kernel.org>2025-05-12 11:40:18 +0200
commit7ec091c55986423b6460604a6921e441e23d68c7 (patch)
tree7f2633154416d18b47949b790d9f2f0247726c70 /tools/testing/selftests/filesystems/utils.h
parentd37d4720c3e797a19b2d7ad08de273feddaa596f (diff)
parent781091f3f59456e881170570b2304ec11e9ce7e0 (diff)
Merge patch series "filesystems selftests cleanups and fanotify test"
Amir Goldstein <amir73il@gmail.com> says: This adds a test for fanotify mount ns notifications inside userns [1]. While working on the test I ended up making lots of cleanups to reduce build dependency on make headers_install. These patches got rid of the dependency for my kvm setup for the affected filesystems tests. Building with TOOLS_INCLUDES dir was recommended by John Hubbard [2]. NOTE #1: these patches are based on a merge of vfs-6.16.mount (changes wrappers.h) into v6.15-rc5 (changes mount-notify_test.c), so if this cleanup is acceptable, we should probably setup a selftests branch for 6.16, so that it can be used to test the fanotify patches. NOTE #2: some of the defines in wrappers.h are left for overlayfs and mount_setattr tests, which were not converted to use TOOLS_INCLUDES. I did not want to mess with those tests. * patches from https://lore.kernel.org/20250509133240.529330-1-amir73il@gmail.com: selftests/fs/mount-notify: add a test variant running inside userns selftests/filesystems: create setup_userns() helper selftests/filesystems: create get_unique_mnt_id() helper selftests/fs/mount-notify: build with tools include dir selftests/mount_settattr: remove duplicate syscall definitions selftests/pidfd: move syscall definitions into wrappers.h selftests/fs/statmount: build with tools include dir selftests/filesystems: move wrapper.h out of overlayfs subdir Link: https://lore.kernel.org/20250509133240.529330-1-amir73il@gmail.com Signed-off-by: Christian Brauner <brauner@kernel.org>
Diffstat (limited to 'tools/testing/selftests/filesystems/utils.h')
-rw-r--r--tools/testing/selftests/filesystems/utils.h3
1 files changed, 3 insertions, 0 deletions
diff --git a/tools/testing/selftests/filesystems/utils.h b/tools/testing/selftests/filesystems/utils.h
index 7f1df2a3e94cf..70f7ccc607f49 100644
--- a/tools/testing/selftests/filesystems/utils.h
+++ b/tools/testing/selftests/filesystems/utils.h
@@ -27,6 +27,7 @@ extern int caps_down(void);
extern int cap_down(cap_value_t down);
extern bool switch_ids(uid_t uid, gid_t gid);
+extern int setup_userns(void);
static inline bool switch_userns(int fd, uid_t uid, gid_t gid, bool drop_caps)
{
@@ -42,4 +43,6 @@ static inline bool switch_userns(int fd, uid_t uid, gid_t gid, bool drop_caps)
return true;
}
+extern uint64_t get_unique_mnt_id(const char *path);
+
#endif /* __IDMAP_UTILS_H */