public inbox for ltp@lists.linux.it
 help / color / mirror / Atom feed
From: Andrea Cervesato via ltp <ltp@lists.linux.it>
To: Jack Morgan <jmorgan@naotchy.com>, ltp@lists.linux.it
Subject: Re: [LTP] [PATCH v2] statmount09.c: Enable mnt_ns_id for STATMOUNT_MNT_NS_ID
Date: Fri, 26 Sep 2025 09:32:19 +0200	[thread overview]
Message-ID: <4d514eb9-cf7e-430e-a0ad-dfffdf947fcc@suse.com> (raw)
In-Reply-To: <20250926040707.671282-2-jmorgan@naotchy.com>

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

  reply	other threads:[~2025-09-26  7:32 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
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 [this message]
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

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=4d514eb9-cf7e-430e-a0ad-dfffdf947fcc@suse.com \
    --to=ltp@lists.linux.it \
    --cc=andrea.cervesato@suse.com \
    --cc=jmorgan@naotchy.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox