[LTP] [PATCH v3] syscalls/mount_setattr01: Add basic functional test

Petr Vorel pvorel@suse.cz
Mon Apr 25 12:48:03 CEST 2022


Hi Chen, all,

> diff --git a/include/lapi/fsmount.h b/include/lapi/fsmount.h
> +
> +/*
> + * mount_setattr()
> + */
> +struct mount_attr {
If you build on new enough glibc (and apply to recent master), you get failures
due struct redefinition:

In file included from mount_setattr01.c:34:
../../../../include/lapi/fsmount.h:48:8: error: redefinition of ‘struct mount_attr’
   48 | struct mount_attr {
      |        ^~~~~~~~~~
In file included from ../../../../include/lapi/mount.h:11,
                 from ../../../../include/lapi/fsmount.h:15,
                 from mount_setattr01.c:34:
/usr/include/linux/mount.h:129:8: note: originally defined here

This is due my recent changes:

c0cb5d196 ("lapi/mount.h: Include kernel/libc header")
https://github.com/linux-test-project/ltp/commit/c0cb5d1962f72065df22cddb774d5246c9057639

8ae596f8b ("lapi/fsmount.h: Include lapi/mount.h instead libc header")
https://github.com/linux-test-project/ltp/commit/8ae596f8b54d0e881d5d8d84c1528b47ced72e66

This requires to put into configure.ac
AC_CHECK_TYPES([struct mount_attr],,,[
#ifdef HAVE_LINUX_MOUNT_H
# include <linux/mount.h>
#else
# include <sys/mount.h>
#endif
])

and here check for #ifndef HAVE_STRUCT_MOUNT_ATTR

Maybe it wasn't a good idea to combine <linux/mount.h> and <sys/mount.h>
(struct is only in <linux/mount.h>).

If we agree on it and this is the only issue, it can be applied before merge.

Kind regards,
Petr


More information about the ltp mailing list