* [LTP] [PATCH 1/2] statmount.h: add check for STATMOUNT_MNT_NS_ID
@ 2025-09-13 0:58 Jack Morgan
2025-09-13 0:58 ` [LTP] [PATCH] statmount09.c: Enable mnt_ns_id " Jack Morgan
2025-09-15 9:06 ` [LTP] [PATCH 1/2] statmount.h: add check " Cyril Hrubis
0 siblings, 2 replies; 5+ messages in thread
From: Jack Morgan @ 2025-09-13 0:58 UTC (permalink / raw)
To: ltp
Enable mnt_ns_id check for kenels that support it
It's can be deinfed as envornment variable with
LTP_HAVE_STATMOUNT_MNT_NS_ID.
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..b1696515d 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 mnt_ns_id check when system struct statmount is not defined. */
+#if !defined(HAVE_STRUCT_STATMOUNT) && !defined(LTP_HAVE_STATMOUNT_MNT_NS_ID)
+#define LTP_HAVE_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] 5+ messages in thread* [LTP] [PATCH] statmount09.c: Enable mnt_ns_id for STATMOUNT_MNT_NS_ID
2025-09-13 0:58 [LTP] [PATCH 1/2] statmount.h: add check for STATMOUNT_MNT_NS_ID Jack Morgan
@ 2025-09-13 0:58 ` Jack Morgan
2025-09-15 9:06 ` [LTP] [PATCH 1/2] statmount.h: add check " Cyril Hrubis
1 sibling, 0 replies; 5+ messages in thread
From: Jack Morgan @ 2025-09-13 0:58 UTC (permalink / raw)
To: ltp
When LTP_HAVE_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..1894a0672 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_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] 5+ messages in thread
* Re: [LTP] [PATCH 1/2] statmount.h: add check for STATMOUNT_MNT_NS_ID
2025-09-13 0:58 [LTP] [PATCH 1/2] statmount.h: add check for STATMOUNT_MNT_NS_ID Jack Morgan
2025-09-13 0:58 ` [LTP] [PATCH] statmount09.c: Enable mnt_ns_id " Jack Morgan
@ 2025-09-15 9:06 ` Cyril Hrubis
2025-09-15 9:15 ` Cyril Hrubis
1 sibling, 1 reply; 5+ messages in thread
From: Cyril Hrubis @ 2025-09-15 9:06 UTC (permalink / raw)
To: Jack Morgan; +Cc: ltp
Hi!
> Enable mnt_ns_id check for kenels that support it
> It's can be deinfed as envornment variable with
> LTP_HAVE_STATMOUNT_MNT_NS_ID.
>
> 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..b1696515d 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 mnt_ns_id check when system struct statmount is not defined. */
> +#if !defined(HAVE_STRUCT_STATMOUNT) && !defined(LTP_HAVE_STATMOUNT_MNT_NS_ID)
> +#define LTP_HAVE_STATMOUNT_MNT_NS_ID 1
> +#endif
We actually have a fallback definition for the statmount structure in
include/lapi/mount.h so the structure is always defined. So there is no
need for this and we can just do:
#if !defined(LTP_HAVE_STATMOUNT_MNT_NS_ID) \
in the test.
> 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
--
Cyril Hrubis
chrubis@suse.cz
--
Mailing list info: https://lists.linux.it/listinfo/ltp
^ permalink raw reply [flat|nested] 5+ messages in thread* Re: [LTP] [PATCH 1/2] statmount.h: add check for STATMOUNT_MNT_NS_ID
2025-09-15 9:06 ` [LTP] [PATCH 1/2] statmount.h: add check " Cyril Hrubis
@ 2025-09-15 9:15 ` Cyril Hrubis
2025-09-17 14:59 ` Jack Morgan
0 siblings, 1 reply; 5+ messages in thread
From: Cyril Hrubis @ 2025-09-15 9:15 UTC (permalink / raw)
To: Jack Morgan; +Cc: ltp
Hi!
> > +/* Enable mnt_ns_id check when system struct statmount is not defined. */
> > +#if !defined(HAVE_STRUCT_STATMOUNT) && !defined(LTP_HAVE_STATMOUNT_MNT_NS_ID)
> > +#define LTP_HAVE_STATMOUNT_MNT_NS_ID 1
> > +#endif
On a second look this looks like you are working around the
fallback definition we have. But there is no configure check for
STATMOUNT_MNT_NS_ID that has to be added to configure.ac, we need
something as:
AC_CHECK_MEMBERS([struct statmount.mnt_ns_id],,,[#include <unistd.h>])
That would define HAVE_STRUCT_STATMOUNT_MNT_NS_ID if that field is
present in the system headers.
And then we can use that with:
#if !defined(HAVE_STRUCT_STATMOUNT) || defined(HAVE_STRUCT_STATMOUNT_MNT_NS_ID)
# define LTP_HAVE_STRUCT_STATMOUNT_MNT_NS_ID 1
#endif
--
Cyril Hrubis
chrubis@suse.cz
--
Mailing list info: https://lists.linux.it/listinfo/ltp
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [LTP] [PATCH 1/2] statmount.h: add check for STATMOUNT_MNT_NS_ID
2025-09-15 9:15 ` Cyril Hrubis
@ 2025-09-17 14:59 ` Jack Morgan
0 siblings, 0 replies; 5+ messages in thread
From: Jack Morgan @ 2025-09-17 14:59 UTC (permalink / raw)
To: Cyril Hrubis; +Cc: ltp
On 9/15/25 02:15, Cyril Hrubis wrote:
> Hi!
>>> +/* Enable mnt_ns_id check when system struct statmount is not defined. */
>>> +#if !defined(HAVE_STRUCT_STATMOUNT) && !defined(LTP_HAVE_STATMOUNT_MNT_NS_ID)
>>> +#define LTP_HAVE_STATMOUNT_MNT_NS_ID 1
>>> +#endif
>
> On a second look this looks like you are working around the
> fallback definition we have. But there is no configure check for
> STATMOUNT_MNT_NS_ID that has to be added to configure.ac, we need
> something as:
>
> AC_CHECK_MEMBERS([struct statmount.mnt_ns_id],,,[#include <unistd.h>])
>
> That would define HAVE_STRUCT_STATMOUNT_MNT_NS_ID if that field is
> present in the system headers.
>
> And then we can use that with:
>
> #if !defined(HAVE_STRUCT_STATMOUNT) || defined(HAVE_STRUCT_STATMOUNT_MNT_NS_ID)
> # define LTP_HAVE_STRUCT_STATMOUNT_MNT_NS_ID 1
> #endif
Thanks for the feedback. I'll send v2 of patches.
Cheers,
jmorgan
--
Mailing list info: https://lists.linux.it/listinfo/ltp
^ permalink raw reply [flat|nested] 5+ messages in thread
end of thread, other threads:[~2025-09-17 14:59 UTC | newest]
Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2025-09-13 0:58 [LTP] [PATCH 1/2] statmount.h: add check for STATMOUNT_MNT_NS_ID Jack Morgan
2025-09-13 0:58 ` [LTP] [PATCH] statmount09.c: Enable mnt_ns_id " Jack Morgan
2025-09-15 9:06 ` [LTP] [PATCH 1/2] statmount.h: add check " Cyril Hrubis
2025-09-15 9:15 ` Cyril Hrubis
2025-09-17 14:59 ` Jack Morgan
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.