* [LTP] [PATCH v2] statmount.h: add check for STATMOUNT_MNT_NS_ID @ 2025-09-26 4:07 Jack Morgan 2025-09-26 4:07 ` [LTP] [PATCH v2] statmount09.c: Enable mnt_ns_id " Jack Morgan 2025-09-26 7:33 ` [LTP] [PATCH v2] statmount.h: add check " Andrea Cervesato via ltp 0 siblings, 2 replies; 11+ messages in thread From: Jack Morgan @ 2025-09-26 4:07 UTC (permalink / raw) To: ltp statmount.h: add check for STATMOUNT_MNT_NS_ID Enable check for STATMOUNT_MNT_NS_ID in kernel headers. Define LTP_HAVE_STRUCT_STATMOUNT_MNT_NS_ID for mnt_ns_id and mnt_id use cases. Fixes: #1260 Signed-off-by: Jack Morgan <jmorgan@naotchy.com> --- testcases/kernel/syscalls/statmount/statmount.h | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/testcases/kernel/syscalls/statmount/statmount.h b/testcases/kernel/syscalls/statmount/statmount.h index d21d7f8da..df883f792 100644 --- a/testcases/kernel/syscalls/statmount/statmount.h +++ b/testcases/kernel/syscalls/statmount/statmount.h @@ -13,6 +13,11 @@ #include "lapi/syscalls.h" #include "tst_safe_stdio.h" +/* Enable STATMOUNT_MNT_NS_ID check for struct statmount. */ +#if!defined(HAVE_STRUCT_STATMOUNT) || defined(HAVE_STRUCT_STATMOUNT_MNT_NS_ID) +#define LTP_HAVE_STRUCT_STATMOUNT_MNT_NS_ID 1 +#endif + static inline int statmount(uint64_t mnt_id, uint64_t mask, struct statmount *buf, size_t bufsize, unsigned int flags) { -- 2.51.0 -- Mailing list info: https://lists.linux.it/listinfo/ltp ^ permalink raw reply related [flat|nested] 11+ messages in thread
* [LTP] [PATCH v2] statmount09.c: Enable mnt_ns_id for STATMOUNT_MNT_NS_ID 2025-09-26 4:07 [LTP] [PATCH v2] statmount.h: add check for STATMOUNT_MNT_NS_ID Jack Morgan @ 2025-09-26 4:07 ` Jack Morgan 2025-09-26 7:32 ` Andrea Cervesato via ltp 2025-09-26 7:33 ` [LTP] [PATCH v2] statmount.h: add check " Andrea Cervesato via ltp 1 sibling, 1 reply; 11+ messages in thread From: Jack Morgan @ 2025-09-26 4:07 UTC (permalink / raw) To: ltp statmount09.c: Enable mnt_ns_id for STATMOUNT_MNT_NS_ID When LTP_HAVE_STRUCT_STATMOUNT_MNT_NS_ID is defined, use mnt_ns_id for statmount09 test case. Otherswise, use mnt_id. Fixes: #1260 Signed-off-by: Jack Morgan <jmorgan@naotchy.com> --- testcases/kernel/syscalls/statmount/statmount09.c | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/testcases/kernel/syscalls/statmount/statmount09.c b/testcases/kernel/syscalls/statmount/statmount09.c index 20c76ba24..aae32cd95 100644 --- a/testcases/kernel/syscalls/statmount/statmount09.c +++ b/testcases/kernel/syscalls/statmount/statmount09.c @@ -39,7 +39,11 @@ static void run(void) return; TST_EXP_EQ_LI(st_mount->mask, STATMOUNT_MNT_NS_ID); +#ifdef LTP_HAVE_STRUCT_STATMOUNT_MNT_NS_ID TST_EXP_EQ_LI(st_mount->mnt_ns_id, mnt_ns_id); +#else + tst_res(TCONF, "statmount.mnt_ns_id not available in current headers, skipping check"); +#endif } static void setup(void) -- 2.51.0 -- Mailing list info: https://lists.linux.it/listinfo/ltp ^ permalink raw reply related [flat|nested] 11+ messages in thread
* Re: [LTP] [PATCH v2] statmount09.c: Enable mnt_ns_id for STATMOUNT_MNT_NS_ID 2025-09-26 4:07 ` [LTP] [PATCH v2] statmount09.c: Enable mnt_ns_id " Jack Morgan @ 2025-09-26 7:32 ` Andrea Cervesato via ltp 2025-09-26 7:40 ` Andrea Cervesato via ltp 2025-09-26 8:22 ` Andrea Cervesato via ltp 0 siblings, 2 replies; 11+ messages in thread From: Andrea Cervesato via ltp @ 2025-09-26 7:32 UTC (permalink / raw) To: Jack Morgan, ltp Hi! On 9/26/25 6:07 AM, Jack Morgan wrote: > +#ifdef LTP_HAVE_STRUCT_STATMOUNT_MNT_NS_ID > TST_EXP_EQ_LI(st_mount->mnt_ns_id, mnt_ns_id); > +#else > + tst_res(TCONF, "statmount.mnt_ns_id not available in current headers, skipping check"); > +#endif The statmount09 is testing STATMOUNT_MNT_NS_ID feature, which is carrying the mnt_ns_id as well, so we don't need to run this test if HAVE_STRUCT_STATMOUNT_MNT_NS_ID is not defined. We can do something like: diff --git a/configure.ac b/configure.ac index d4dd13033..189d8771e 100644 --- a/configure.ac +++ b/configure.ac @@ -264,6 +264,7 @@ AC_CHECK_TYPES([struct cachestat],,,[#include <sys/mman.h>]) # Defined in <linux/mount.h>, but include/lapi/mount.h includes <sys/mount.h> */ AC_CHECK_TYPES([struct mnt_id_req],,,[#include <sys/mount.h>]) AC_CHECK_TYPES([struct statmount],,,[#include <sys/mount.h>]) +AC_CHECK_MEMBERS([struct statmount.mnt_ns_id],,,[#include <linux/mount.h>]) AC_CHECK_TYPES([struct pidfd_info],,,[#include <sys/pidfd.h>]) AC_CHECK_TYPES([struct file_attr],,,[#include <linux/fs.h>]) diff --git a/testcases/kernel/syscalls/statmount/statmount09.c b/testcases/kernel/syscalls/statmount/statmount09.c index 20c76ba24..b78cec6b4 100644 --- a/testcases/kernel/syscalls/statmount/statmount09.c +++ b/testcases/kernel/syscalls/statmount/statmount09.c @@ -15,6 +15,11 @@ * namespace */ +#include "config.h" +#include "tst_test.h" + +#ifdef HAVE_STRUCT_STATMOUNT_MNT_NS_ID + #define _GNU_SOURCE #include "statmount.h" @@ -72,3 +77,8 @@ static struct tst_test test = { } }; +#else + +TST_TEST_TCONF("STATMOUNT_MNT_NS_ID support is required"); + +#endif This could be done by checking if STATMOUNT_MNT_NS_ID exists, but since mnt_ns_id attribute and STATMOUNT_MNT_NS_ID are defined in the same commit (09b31295f833031c88419550172703d45c5401e3 - fs: export the mount ns id via statmount), we can safely use configure.ac. - Andrea -- Mailing list info: https://lists.linux.it/listinfo/ltp ^ permalink raw reply related [flat|nested] 11+ messages in thread
* Re: [LTP] [PATCH v2] statmount09.c: Enable mnt_ns_id for STATMOUNT_MNT_NS_ID 2025-09-26 7:32 ` Andrea Cervesato via ltp @ 2025-09-26 7:40 ` Andrea Cervesato via ltp 2025-09-26 8:17 ` Cyril Hrubis 2025-09-26 8:22 ` Andrea Cervesato via ltp 1 sibling, 1 reply; 11+ messages in thread From: Andrea Cervesato via ltp @ 2025-09-26 7:40 UTC (permalink / raw) To: Jack Morgan, ltp Hi Cyril On 9/26/25 9:32 AM, Andrea Cervesato wrote: > Hi! > > On 9/26/25 6:07 AM, Jack Morgan wrote: >> +#ifdef LTP_HAVE_STRUCT_STATMOUNT_MNT_NS_ID >> TST_EXP_EQ_LI(st_mount->mnt_ns_id, mnt_ns_id); >> +#else >> + tst_res(TCONF, "statmount.mnt_ns_id not available in current >> headers, skipping check"); >> +#endif > > The statmount09 is testing STATMOUNT_MNT_NS_ID feature, which is > carrying the mnt_ns_id as well, so we don't need to run this test if > HAVE_STRUCT_STATMOUNT_MNT_NS_ID is not defined. > We can do something like: > > diff --git a/configure.ac b/configure.ac > index d4dd13033..189d8771e 100644 > --- a/configure.ac > +++ b/configure.ac > @@ -264,6 +264,7 @@ AC_CHECK_TYPES([struct cachestat],,,[#include > <sys/mman.h>]) > # Defined in <linux/mount.h>, but include/lapi/mount.h includes > <sys/mount.h> */ > AC_CHECK_TYPES([struct mnt_id_req],,,[#include <sys/mount.h>]) > AC_CHECK_TYPES([struct statmount],,,[#include <sys/mount.h>]) > +AC_CHECK_MEMBERS([struct statmount.mnt_ns_id],,,[#include > <linux/mount.h>]) > > AC_CHECK_TYPES([struct pidfd_info],,,[#include <sys/pidfd.h>]) > AC_CHECK_TYPES([struct file_attr],,,[#include <linux/fs.h>]) > diff --git a/testcases/kernel/syscalls/statmount/statmount09.c > b/testcases/kernel/syscalls/statmount/statmount09.c > index 20c76ba24..b78cec6b4 100644 > --- a/testcases/kernel/syscalls/statmount/statmount09.c > +++ b/testcases/kernel/syscalls/statmount/statmount09.c > @@ -15,6 +15,11 @@ > * namespace > */ > > +#include "config.h" > +#include "tst_test.h" > + > +#ifdef HAVE_STRUCT_STATMOUNT_MNT_NS_ID > + > #define _GNU_SOURCE > > #include "statmount.h" > @@ -72,3 +77,8 @@ static struct tst_test test = { > } > }; > > +#else > + > +TST_TEST_TCONF("STATMOUNT_MNT_NS_ID support is required"); > + > +#endif > > This could be done by checking if STATMOUNT_MNT_NS_ID exists, but > since mnt_ns_id attribute and STATMOUNT_MNT_NS_ID are defined in the > same commit (09b31295f833031c88419550172703d45c5401e3 - fs: export the > mount ns id via statmount), we can safely use configure.ac. > > - Andrea > FYI this patch might be needed for the release, since it's breaking the build on old kernels before 09b31295f833031c88419550172703d45c5401e3 commit. What do you think? --- Andrea Cervesato andrea.cervesato@suse.com -- Mailing list info: https://lists.linux.it/listinfo/ltp ^ permalink raw reply [flat|nested] 11+ messages in thread
* Re: [LTP] [PATCH v2] statmount09.c: Enable mnt_ns_id for STATMOUNT_MNT_NS_ID 2025-09-26 7:40 ` Andrea Cervesato via ltp @ 2025-09-26 8:17 ` Cyril Hrubis 0 siblings, 0 replies; 11+ messages in thread From: Cyril Hrubis @ 2025-09-26 8:17 UTC (permalink / raw) To: Andrea Cervesato; +Cc: ltp Hi! > FYI this patch might be needed for the release, since it's breaking the > build on old kernels before 09b31295f833031c88419550172703d45c5401e3 > commit. What do you think? Yes, this is one of the fixes that should go in. -- Cyril Hrubis chrubis@suse.cz -- Mailing list info: https://lists.linux.it/listinfo/ltp ^ permalink raw reply [flat|nested] 11+ messages in thread
* Re: [LTP] [PATCH v2] statmount09.c: Enable mnt_ns_id for STATMOUNT_MNT_NS_ID 2025-09-26 7:32 ` Andrea Cervesato via ltp 2025-09-26 7:40 ` Andrea Cervesato via ltp @ 2025-09-26 8:22 ` Andrea Cervesato via ltp 2025-09-26 20:31 ` Jack Morgan 1 sibling, 1 reply; 11+ messages in thread From: Andrea Cervesato via ltp @ 2025-09-26 8:22 UTC (permalink / raw) To: Jack Morgan, ltp On 9/26/25 9:32 AM, Andrea Cervesato wrote: > +#ifdef HAVE_STRUCT_STATMOUNT_MNT_NS_ID > + According to the follow-up discussion, this is more correct: #if!defined(HAVE_STRUCT_STATMOUNT) || defined(HAVE_STRUCT_STATMOUNT_MNT_NS_ID) -- Andrea Cervesato andrea.cervesato@suse.com -- Mailing list info: https://lists.linux.it/listinfo/ltp ^ permalink raw reply [flat|nested] 11+ messages in thread
* Re: [LTP] [PATCH v2] statmount09.c: Enable mnt_ns_id for STATMOUNT_MNT_NS_ID 2025-09-26 8:22 ` Andrea Cervesato via ltp @ 2025-09-26 20:31 ` Jack Morgan 0 siblings, 0 replies; 11+ messages in thread From: Jack Morgan @ 2025-09-26 20:31 UTC (permalink / raw) To: Andrea Cervesato; +Cc: ltp On 9/26/25 01:22, Andrea Cervesato wrote: > On 9/26/25 9:32 AM, Andrea Cervesato wrote: >> +#ifdef HAVE_STRUCT_STATMOUNT_MNT_NS_ID >> + > According to the follow-up discussion, this is more correct: > > #if!defined(HAVE_STRUCT_STATMOUNT) || > defined(HAVE_STRUCT_STATMOUNT_MNT_NS_ID) Thank you for the feedback. I'll update my patch with this change and send v3 shortly. For the change to configure.ac, I've sent a separate patch for this[1]. Finally, the suggestion is to then drop patch for statmount.h as checks will be in statmount09.c test case, correct? Is there anything else I'm missing? [1] https://lore.kernel.org/ltp/20250926025318.612308-1-jmorgan@naotchy.com/T/#u Regards, Jack Morgan -- Mailing list info: https://lists.linux.it/listinfo/ltp ^ permalink raw reply [flat|nested] 11+ messages in thread
* Re: [LTP] [PATCH v2] statmount.h: add check for STATMOUNT_MNT_NS_ID 2025-09-26 4:07 [LTP] [PATCH v2] statmount.h: add check for STATMOUNT_MNT_NS_ID Jack Morgan 2025-09-26 4:07 ` [LTP] [PATCH v2] statmount09.c: Enable mnt_ns_id " Jack Morgan @ 2025-09-26 7:33 ` Andrea Cervesato via ltp 2025-09-26 8:04 ` Cyril Hrubis 1 sibling, 1 reply; 11+ messages in thread From: Andrea Cervesato via ltp @ 2025-09-26 7:33 UTC (permalink / raw) To: Jack Morgan, ltp Hi! On 9/26/25 6:07 AM, Jack Morgan wrote: > +/* Enable STATMOUNT_MNT_NS_ID check for struct statmount. */ > +#if!defined(HAVE_STRUCT_STATMOUNT) || defined(HAVE_STRUCT_STATMOUNT_MNT_NS_ID) > +#define LTP_HAVE_STRUCT_STATMOUNT_MNT_NS_ID 1 > +#endif This is not a good practice, better to avoid defining LTP_* wrappers, since we already have the HAVE_* variables defined by autoconf. - Andrea -- Mailing list info: https://lists.linux.it/listinfo/ltp ^ permalink raw reply [flat|nested] 11+ messages in thread
* Re: [LTP] [PATCH v2] statmount.h: add check for STATMOUNT_MNT_NS_ID 2025-09-26 7:33 ` [LTP] [PATCH v2] statmount.h: add check " Andrea Cervesato via ltp @ 2025-09-26 8:04 ` Cyril Hrubis 2025-09-26 8:13 ` Andrea Cervesato via ltp 0 siblings, 1 reply; 11+ messages in thread From: Cyril Hrubis @ 2025-09-26 8:04 UTC (permalink / raw) To: Andrea Cervesato; +Cc: ltp Hi! > > +/* Enable STATMOUNT_MNT_NS_ID check for struct statmount. */ > > +#if!defined(HAVE_STRUCT_STATMOUNT) || defined(HAVE_STRUCT_STATMOUNT_MNT_NS_ID) > > +#define LTP_HAVE_STRUCT_STATMOUNT_MNT_NS_ID 1 > > +#endif > > This is not a good practice, better to avoid defining LTP_* wrappers, > since we already have the HAVE_* variables defined by autoconf. This has to be unfortunately there because the field is present if we are using lapi fallback or if we have new enough system headers. So either we open code the ifdefs in the test, or define the macro like this. -- Cyril Hrubis chrubis@suse.cz -- Mailing list info: https://lists.linux.it/listinfo/ltp ^ permalink raw reply [flat|nested] 11+ messages in thread
* Re: [LTP] [PATCH v2] statmount.h: add check for STATMOUNT_MNT_NS_ID 2025-09-26 8:04 ` Cyril Hrubis @ 2025-09-26 8:13 ` Andrea Cervesato via ltp 2025-09-26 8:18 ` Cyril Hrubis 0 siblings, 1 reply; 11+ messages in thread From: Andrea Cervesato via ltp @ 2025-09-26 8:13 UTC (permalink / raw) To: Cyril Hrubis; +Cc: ltp On 9/26/25 10:04 AM, Cyril Hrubis wrote: > This has to be unfortunately there because the field is present if we > are using lapi fallback or if we have new enough system headers. So > either we open code the ifdefs in the test, or define the macro like > this. Why not just using "#if!defined(HAVE_STRUCT_STATMOUNT) || defined(HAVE_STRUCT_STATMOUNT_MNT_NS_ID)" inside the statmount09 test then? These LTP_HAVE_* wrappers are a bit weird because they are mixing with internal LTP macros, also considering the fact we are not testing "struct statmount.mnt_ns_id" anywhere else but in statmount09. -- Andrea Cervesato andrea.cervesato@suse.com -- Mailing list info: https://lists.linux.it/listinfo/ltp ^ permalink raw reply [flat|nested] 11+ messages in thread
* Re: [LTP] [PATCH v2] statmount.h: add check for STATMOUNT_MNT_NS_ID 2025-09-26 8:13 ` Andrea Cervesato via ltp @ 2025-09-26 8:18 ` Cyril Hrubis 0 siblings, 0 replies; 11+ messages in thread From: Cyril Hrubis @ 2025-09-26 8:18 UTC (permalink / raw) To: Andrea Cervesato; +Cc: ltp Hi! > Why not just using "#if!defined(HAVE_STRUCT_STATMOUNT) || > defined(HAVE_STRUCT_STATMOUNT_MNT_NS_ID)" inside the statmount09 test > then? These LTP_HAVE_* wrappers are a bit weird because they are mixing > with internal LTP macros, also considering the fact we are not testing > "struct statmount.mnt_ns_id" anywhere else but in statmount09. Works for me as well, I do not have a strong opinion here. -- Cyril Hrubis chrubis@suse.cz -- Mailing list info: https://lists.linux.it/listinfo/ltp ^ permalink raw reply [flat|nested] 11+ messages in thread
end of thread, other threads:[~2025-09-26 20:31 UTC | newest] Thread overview: 11+ messages (download: mbox.gz follow: Atom feed -- links below jump to the message on this page -- 2025-09-26 4:07 [LTP] [PATCH v2] statmount.h: add check for STATMOUNT_MNT_NS_ID Jack Morgan 2025-09-26 4:07 ` [LTP] [PATCH v2] statmount09.c: Enable mnt_ns_id " Jack Morgan 2025-09-26 7:32 ` Andrea Cervesato via ltp 2025-09-26 7:40 ` Andrea Cervesato via ltp 2025-09-26 8:17 ` Cyril Hrubis 2025-09-26 8:22 ` Andrea Cervesato via ltp 2025-09-26 20:31 ` Jack Morgan 2025-09-26 7:33 ` [LTP] [PATCH v2] statmount.h: add check " Andrea Cervesato via ltp 2025-09-26 8:04 ` Cyril Hrubis 2025-09-26 8:13 ` Andrea Cervesato via ltp 2025-09-26 8:18 ` Cyril Hrubis
This is a public inbox, see mirroring instructions for how to clone and mirror all data and code used for this inbox