On Fri, May 9, 2025 at 12:57 PM Christian Brauner <brauner@xxxxxxxxxx> wrote: > > On Thu, May 08, 2025 at 01:36:09PM +0200, Amir Goldstein wrote: > > Forgot to CC Miklos (now added) > > > > On Thu, May 8, 2025 at 9:31 AM John Hubbard <jhubbard@xxxxxxxxxx> wrote: > > > > > > On 5/7/25 1:42 PM, Amir Goldstein wrote: > > > > Copy the required headers files (mount.h, nsfs.h) to the > > > > tools include dir and define the statmount/listmount syscalls > > > > for x86_64 to decouple dependency with headers_install for the > > > > common case. > > > > > > > > Signed-off-by: Amir Goldstein <amir73il@xxxxxxxxx> > > > > --- > > ... > > > > -CFLAGS += -Wall -O2 -g $(KHDR_INCLUDES) > > > > +CFLAGS += -Wall -O2 -g $(KHDR_INCLUDES) $(TOOLS_INCLUDES) > > > > > > Yes. :) > > > > > > > + > > > > TEST_GEN_PROGS := statmount_test statmount_test_ns listmount_test > > > > > > > > include ../../lib.mk > > > > diff --git a/tools/testing/selftests/filesystems/statmount/statmount.h b/tools/testing/selftests/filesystems/statmount/statmount.h > > > > index a7a5289ddae9..e84d47fadd0b 100644 > > > > --- a/tools/testing/selftests/filesystems/statmount/statmount.h > > > > +++ b/tools/testing/selftests/filesystems/statmount/statmount.h > > > > @@ -7,6 +7,18 @@ > > > > #include <linux/mount.h> > > > > #include <asm/unistd.h> > > > > > > > > +#ifndef __NR_statmount > > > > +#if defined(__x86_64__) > > > > +#define __NR_statmount 457 > > > > +#endif > > > > +#endif > > > > + > > > > +#ifndef __NR_listmount > > > > +#if defined(__x86_64__) > > > > +#define __NR_listmount 458 > > > > +#endif > > > > +#endif > > > > > > Yes, syscalls are the weak point for this approach, and the above is > > > reasonable, given the situation, which is: we are not set up to recreate > > > per-arch syscall tables for kselftests to use. But this does leave the > > > other big arch out in the cold: arm64. > > > > > > It's easy to add, though, if and when someone wants it. > > > > I have no problem adding || defined(__arm64__) > > it's the same syscall numbers anyway. > > > > Or I could do > > #if !defined(__alpha__) && !defined(_MIPS_SIM) > > > > but I could not bring myself to do the re-definitions that Christian > > added in mount_setattr_test.c for > > __NR_mount_setattr, __NR_open_tree, __NR_move_mount > > > > Note that there are stale definitions for __ia64__ in that file > > and the stale definition for __NR_move_mount is even wrong ;) > > > > Christian, > > > > How about moving the definitions from mount_setattr_test.c into wrappers.h > > and leaving only the common !defined(__alpha__) && !defined(_MIPS_SIM) > > case? > > > > Thanks for the review! > > For new system calls this covers all arches and is what I usually use: > > #ifndef __NR_open_tree > #if defined __alpha__ > #define __NR_open_tree 538 > #elif defined _MIPS_SIM > #if _MIPS_SIM == _MIPS_SIM_ABI32 /* o32 */ > #define __NR_open_tree 4428 > #endif > #if _MIPS_SIM == _MIPS_SIM_NABI32 /* n32 */ > #define __NR_open_tree 6428 > #endif > #if _MIPS_SIM == _MIPS_SIM_ABI64 /* n64 */ > #define __NR_open_tree 5428 > #endif > #elif defined __ia64__ > #define __NR_open_tree (428 + 1024) > #else > #define __NR_open_tree 428 > #endif > #endif > > where the ia64 stuff can obviously be removed now. All right. Sent v2 with all those defs for listmount/statmount. Thanks, Amir.