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

Cyril Hrubis
2025-12-09T15:52:27Z

Hi!
> > + uint32_t mnt_ns_fd;
> > +#else
> > uint32_t spare;
> > +#endif
> > uint64_t mnt_id;
> > uint64_t param;
> > uint64_t *mnt_ids;
> > @@ -73,12 +77,21 @@ static struct tcase {
> > {
> > .req_usage = 1,
> > .size = MNT_ID_REQ_SIZE_VER0,
> > +#ifdef HAVE_STRUCT_MNT_ID_REQ_MNT_NS_FD
> > + .mnt_ns_fd = -1,
> > +#else
> > .spare = -1,
> > +#endif
> > .mnt_id = LSMT_ROOT,
> > .mnt_ids = mnt_ids,
> > .nr_mnt_ids = MNT_SIZE,
> > +#ifdef HAVE_STRUCT_MNT_ID_REQ_MNT_NS_FD
> > + .exp_errno = EBADF,
> > + .msg = "invalid mnt_id_req.mnt_ns_fd bad file descriptor",
> > +#else
> > .exp_errno = EINVAL,
> > .msg = "invalid mnt_id_req.spare",
> > +#endif

This is never going to work, how kernel interprets the value depends on
solely on the running kernel verision not on headers that were present
during the compilation.

What we need to do is to differentiate the expected errno based on
running kernel version.

--
Cyril Hrubis
chrubis@suse.cz