[LTP] [PATCH v6 1/6] include/lapi: Move AT_* related macros to fcntl header
Xiao Yang (Fujitsu)
yangx.jy@fujitsu.com
Thu May 18 08:00:49 CEST 2023
On 2023/5/15 15:11, Yang Xu wrote:
> These AT* macro is belong to fcntl.h instead of stat.h.
> So move them.
>
> Signed-off-by: Yang Xu <xuyang2018.jy@fujitsu.com>
> ---
> include/lapi/fcntl.h | 32 +++++++++++++----
> include/lapi/stat.h | 36 -------------------
> .../syscalls/mount_setattr/mount_setattr01.c | 2 +-
> testcases/kernel/syscalls/statx/statx01.c | 1 +
> testcases/kernel/syscalls/statx/statx02.c | 1 +
> testcases/kernel/syscalls/statx/statx05.c | 1 +
> testcases/kernel/syscalls/statx/statx07.c | 1 +
> testcases/kernel/syscalls/statx/statx08.c | 1 +
> testcases/kernel/syscalls/statx/statx09.c | 1 +
> 9 files changed, 33 insertions(+), 43 deletions(-)
>
> diff --git a/include/lapi/fcntl.h b/include/lapi/fcntl.h
> index f17220737..8fc92c521 100644
> --- a/include/lapi/fcntl.h
> +++ b/include/lapi/fcntl.h
> @@ -87,20 +87,40 @@
> # define AT_FDCWD -100
> #endif
>
> +#ifndef AT_SYMLINK_NOFOLLOW
> +# define AT_SYMLINK_NOFOLLOW 0x100
> +#endif
> +
> +#ifndef AT_REMOVEDIR
> +# define AT_REMOVEDIR 0x200
> +#endif
> +
> #ifndef AT_SYMLINK_FOLLOW
> -# define AT_SYMLINK_FOLLOW 0x400
> +# define AT_SYMLINK_FOLLOW 0x400
> #endif
>
> -#ifndef AT_SYMLINK_NOFOLLOW
> -# define AT_SYMLINK_NOFOLLOW 0x100
> +#ifndef AT_NO_AUTOMOUNT
> +# define AT_NO_AUTOMOUNT 0x800
> #endif
>
> #ifndef AT_EMPTY_PATH
> -# define AT_EMPTY_PATH 0x1000
> +# define AT_EMPTY_PATH 0x1000
> #endif
>
> -#ifndef AT_REMOVEDIR
> -# define AT_REMOVEDIR 0x200
> +#ifndef AT_STATX_SYNC_AS_STAT
> +# define AT_STATX_SYNC_AS_STAT 0x0000
> +#endif
> +
> +#ifndef AT_STATX_FORCE_SYNC
> +# define AT_STATX_FORCE_SYNC 0x2000
> +#endif
> +
> +#ifndef AT_STATX_DONT_SYNC
> +# define AT_STATX_DONT_SYNC 0x4000
> +#endif
> +
> +#ifndef AT_STATX_SYNC_TYPE
> +# define AT_STATX_SYNC_TYPE 0x6000
> #endif
>
> #ifndef O_NOATIME
> diff --git a/include/lapi/stat.h b/include/lapi/stat.h
> index ce1f2b678..590ccd111 100644
> --- a/include/lapi/stat.h
> +++ b/include/lapi/stat.h
> @@ -227,40 +227,4 @@ static inline int statx(int dirfd, const char *pathname, unsigned int flags,
> # define STATX_ATTR_VERITY 0x00100000
> #endif
>
> -#ifndef AT_SYMLINK_NOFOLLOW
> -# define AT_SYMLINK_NOFOLLOW 0x100
> -#endif
> -
> -#ifndef AT_REMOVEDIR
> -# define AT_REMOVEDIR 0x200
> -#endif
> -
> -#ifndef AT_SYMLINK_FOLLOW
> -# define AT_SYMLINK_FOLLOW 0x400
> -#endif
> -
> -#ifndef AT_NO_AUTOMOUNT
> -# define AT_NO_AUTOMOUNT 0x800
> -#endif
> -
> -#ifndef AT_EMPTY_PATH
> -# define AT_EMPTY_PATH 0x1000
> -#endif
> -
> -#ifndef AT_STATX_SYNC_TYPE
> -# define AT_STATX_SYNC_TYPE 0x6000
> -#endif
> -
> -#ifndef AT_STATX_SYNC_AS_STAT
> -# define AT_STATX_SYNC_AS_STAT 0x0000
> -#endif
> -
> -#ifndef AT_STATX_FORCE_SYNC
> -# define AT_STATX_FORCE_SYNC 0x2000
> -#endif
> -
> -#ifndef AT_STATX_DONT_SYNC
> -# define AT_STATX_DONT_SYNC 0x4000
> -#endif
> -
> #endif /* LAPI_STAT_H__ */
> diff --git a/testcases/kernel/syscalls/mount_setattr/mount_setattr01.c b/testcases/kernel/syscalls/mount_setattr/mount_setattr01.c
> index 83746b878..616ec5341 100644
> --- a/testcases/kernel/syscalls/mount_setattr/mount_setattr01.c
> +++ b/testcases/kernel/syscalls/mount_setattr/mount_setattr01.c
> @@ -32,7 +32,7 @@
> #include <sys/statvfs.h>
> #include "tst_test.h"
> #include "lapi/fsmount.h"
> -#include "lapi/stat.h"
> +#include "lapi/fcntl.h"Hi Xu
It seems unnecessary here because "lapi/fsmount.h" has included
"lapi/fcntl.h".
>
> #define MNTPOINT "mntpoint"
> #define OT_MNTPOINT "ot_mntpoint"
> diff --git a/testcases/kernel/syscalls/statx/statx01.c b/testcases/kernel/syscalls/statx/statx01.c
> index 68f56549f..f9c2748d2 100644
> --- a/testcases/kernel/syscalls/statx/statx01.c
> +++ b/testcases/kernel/syscalls/statx/statx01.c
> @@ -33,6 +33,7 @@
> #include "tst_test.h"
> #include "tst_safe_macros.h"
> #include "lapi/stat.h"
> +#include "lapi/fcntl.h"
> #include "tst_safe_stdio.h"
> #include <string.h>
> #include <inttypes.h>
> diff --git a/testcases/kernel/syscalls/statx/statx02.c b/testcases/kernel/syscalls/statx/statx02.c
> index a8e868d7a..5ed80894d 100644
> --- a/testcases/kernel/syscalls/statx/statx02.c
> +++ b/testcases/kernel/syscalls/statx/statx02.c
> @@ -28,6 +28,7 @@
> #include "tst_test.h"
> #include "tst_safe_macros.h"
> #include "lapi/stat.h"
> +#include "lapi/fcntl.h"
>
> #define TESTFILE "test_temp"
> #define LINK_FILE "test_temp_ln"
I hope we can add "lapi/fcntl.h" for all statx tests because AT_FDCWD
macro which may not be defined is used by all tests.
> diff --git a/testcases/kernel/syscalls/statx/statx05.c b/testcases/kernel/syscalls/statx/statx05.c
> index f62dadd5c..9781b3e70 100644
> --- a/testcases/kernel/syscalls/statx/statx05.c
> +++ b/testcases/kernel/syscalls/statx/statx05.c
> @@ -27,6 +27,7 @@
> #include "tst_test.h"
> #include "lapi/fs.h"
> #include "lapi/stat.h"
> +#include "lapi/fcntl.h"
>
> #define MNTPOINT "mnt_point"
> #define TESTDIR_FLAGGED MNTPOINT"/test_dir1"
> diff --git a/testcases/kernel/syscalls/statx/statx07.c b/testcases/kernel/syscalls/statx/statx07.c
> index b13c11f72..f688b1b0f 100644
> --- a/testcases/kernel/syscalls/statx/statx07.c
> +++ b/testcases/kernel/syscalls/statx/statx07.c
> @@ -39,6 +39,7 @@
> #include <sys/mount.h>
> #include "tst_test.h"
> #include "lapi/stat.h"
> +#include "lapi/fcntl.h"
>
> #define MODE(X) (X & (~S_IFMT))
> #define FLAG_NAME(x) .flag = x, .flag_name = #x
> diff --git a/testcases/kernel/syscalls/statx/statx08.c b/testcases/kernel/syscalls/statx/statx08.c
> index 10b1ca460..64b36986d 100644
> --- a/testcases/kernel/syscalls/statx/statx08.c
> +++ b/testcases/kernel/syscalls/statx/statx08.c
> @@ -26,6 +26,7 @@
> #include "lapi/fs.h"
> #include <stdlib.h>
> #include "lapi/stat.h"
> +#include "lapi/fcntl.h"
>
> #define MOUNT_POINT "mntpoint"
> #define TESTDIR_FLAGGED MOUNT_POINT"/test_dir1"
> diff --git a/testcases/kernel/syscalls/statx/statx09.c b/testcases/kernel/syscalls/statx/statx09.c
> index aea329e08..c03d2c91e 100644
> --- a/testcases/kernel/syscalls/statx/statx09.c
> +++ b/testcases/kernel/syscalls/statx/statx09.c
> @@ -24,6 +24,7 @@
> #include "lapi/fs.h"
> #include "lapi/fsverity.h"
> #include "lapi/stat.h"
> +#include "lapi/fcntl.h"
> #include <inttypes.h>
>
> #define MNTPOINT "mnt_point"
Other than that looks good to me.
Reviewed-by: Xiao Yang <yangx.jy@fujitsu.com>
Best Regards,
Xiao Yang
More information about the ltp
mailing list