[LTP] [PATCH v5] listmount04.c: Update case support mnt_id_req.mnt_ns_fd

Petr Vorel pvorel@suse.cz
Fri Dec 12 13:28:27 CET 2025


Hi Wei, all,

...
> -#ifndef HAVE_STRUCT_MNT_ID_REQ
> -struct mnt_id_req {
> +struct mnt_id_req_fallback {
>  	uint32_t size;
> -	uint32_t spare;
> +	uint32_t mnt_ns_fd;
>  	uint64_t mnt_id;
>  	uint64_t param;
>  	uint64_t mnt_ns_id;
>  };
> +
> +#if !defined(HAVE_STRUCT_MNT_ID_REQ) || !HAVE_STRUCT_MNT_ID_REQ_MNT_NS_FD
Shouldn't be !HAVE_STRUCT_MNT_ID_REQ_MNT_NS_FD
!defined(HAVE_STRUCT_MNT_ID_REQ_MNT_NS_FD) ?

Also, this patchset introduces compilation error on old systems:

In file included from listmount03.c:13:0:
listmount.h:20:4: error: 'struct mnt_id_req' has no member named 'mnt_id'
   .mnt_id = mnt_id,

Obviously some definition is wrong.

https://github.com/pevik/ltp/actions/runs/20166087670/job/57889711762

(CI does not work, therefore I pushed you patchset.)

> +typedef struct mnt_id_req_fallback mnt_id_req;
> +#else
> +typedef struct mnt_id_req mnt_id_req;
>  #endif

...
> +static void setup(void)
> +{
> +	if (tst_kvercmp(6, 18, 0) >= 0) {
> +		tcases[4].exp_errno = EBADF;
> +		tcases[4].msg = "invalid mnt_id_req.mnt_ns_fd (EBADF)";

Hardcoding array index is asking for problems in the future.

That's why I suggested more complicated code in previous version.
https://lore.kernel.org/ltp/20251211115111.GA63924@pevik/

Kind regards,
Petr


More information about the ltp mailing list