[LTP] [PATCH v6 4/6] lapi/stat.h: Remove deprecated STATX_ALL macro

Xiao Yang (Fujitsu) yangx.jy@fujitsu.com
Thu May 18 09:34:54 CEST 2023


On 2023/5/15 15:11, Yang Xu wrote:
> Since kernel 5.10-rc1 commit 581701b7efd6 ("uapi: deprecate STATX_ALL"),
> this flag has been mark as deprecated.
> 
> Kernel should keep this macro for compatibility, but ltp doesn't think
> about it. So remove it.
> 
Hi Xu,

> For statx06.c, we test btime, so we should STATX_BASIC_STATS | STATX_BTIME
> to replace. For statx07.c, we just use STATX_BASIC_STATS is enough.

One minor comment here:
statx06.c verifies various timestamps including stx_btime so we should 
call STATX_BASIC_STATS | STATX_BTIME.
statx07.c just needs to get stx_mode so STATX_BASIC_STATS is enough.

Other than that looks good to me.
Reviewed-by: Xiao Yang <yangx.jy@fujitsu.com>

Best Regards,
Xiao Yang
> 
> Signed-off-by: Yang Xu <xuyang2018.jy@fujitsu.com>
> ---
>   include/lapi/stat.h                       | 4 ----
>   testcases/kernel/syscalls/statx/statx06.c | 4 ++--
>   testcases/kernel/syscalls/statx/statx07.c | 6 +++---
>   3 files changed, 5 insertions(+), 9 deletions(-)
> 
> diff --git a/include/lapi/stat.h b/include/lapi/stat.h
> index e247c2159..891db33ad 100644
> --- a/include/lapi/stat.h
> +++ b/include/lapi/stat.h
> @@ -185,10 +185,6 @@ static inline int statx(int dirfd, const char *pathname, unsigned int flags,
>   # define STATX_DIOALIGN		0x00002000U
>   #endif
>   
> -#ifndef STATX_ALL
> -# define STATX_ALL		0x00000fffU
> -#endif
> -
>   #ifndef STATX__RESERVED
>   # define STATX__RESERVED	0x80000000U
>   #endif
> diff --git a/testcases/kernel/syscalls/statx/statx06.c b/testcases/kernel/syscalls/statx/statx06.c
> index ce82b905b..60e736c5a 100644
> --- a/testcases/kernel/syscalls/statx/statx06.c
> +++ b/testcases/kernel/syscalls/statx/statx06.c
> @@ -111,10 +111,10 @@ static void test_statx(unsigned int test_nr)
>   	clock_wait_tick();
>   	SAFE_CLOCK_GETTIME(CLOCK_REALTIME_COARSE, &after_time);
>   
> -	TEST(statx(AT_FDCWD, TEST_FILE, 0, STATX_ALL, &buff));
> +	TEST(statx(AT_FDCWD, TEST_FILE, 0, STATX_BASIC_STATS | STATX_BTIME, &buff));
>   	if (TST_RET != 0) {
>   		tst_brk(TFAIL | TTERRNO,
> -			"statx(AT_FDCWD, %s, 0, STATX_ALL, &buff)",
> +			"statx(AT_FDCWD, %s, 0, STATX_BASIC_STATS | STATX_BTIME, &buff)",
>   			TEST_FILE);
>   	}
>   
> diff --git a/testcases/kernel/syscalls/statx/statx07.c b/testcases/kernel/syscalls/statx/statx07.c
> index f688b1b0f..4dbf83e18 100644
> --- a/testcases/kernel/syscalls/statx/statx07.c
> +++ b/testcases/kernel/syscalls/statx/statx07.c
> @@ -63,15 +63,15 @@ static int get_mode(char *file_name, int flag_type, char *flag_name)
>   {
>   	struct statx buf;
>   
> -	TEST(statx(AT_FDCWD, file_name, flag_type, STATX_ALL, &buf));
> +	TEST(statx(AT_FDCWD, file_name, flag_type, STATX_BASIC_STATS, &buf));
>   
>   	if (TST_RET == -1) {
>   		tst_brk(TFAIL | TST_ERR,
> -			"statx(AT_FDCWD, %s, %s, STATX_ALL, &buf)",
> +			"statx(AT_FDCWD, %s, %s, STATX_BASIC_STATS, &buf)",
>   			file_name, flag_name);
>   	}
>   
> -	tst_res(TINFO, "statx(AT_FDCWD, %s, %s, STATX_ALL, &buf) = %o",
> +	tst_res(TINFO, "statx(AT_FDCWD, %s, %s, STATX_BASIC_STATS, &buf) = %o",
>   		file_name, flag_name, buf.stx_mode);
>   
>   	return buf.stx_mode;


More information about the ltp mailing list