[LTP] [PATCH v1 06/11] lapi/quotactl.h: Add fallback for quotactl_fd

Cyril Hrubis chrubis@suse.cz
Tue Oct 26 16:13:50 CEST 2021


Hi!
> Signed-off-by: Yang Xu <xuyang2018.jy@fujitsu.com>
> ---
>  configure.ac                                    |  1 +
>  include/lapi/quotactl.h                         | 16 +++++++++++++++-
>  testcases/kernel/syscalls/quotactl/quotactl01.c |  2 +-
>  testcases/kernel/syscalls/quotactl/quotactl04.c |  2 +-
>  testcases/kernel/syscalls/quotactl/quotactl07.c |  2 +-
>  5 files changed, 19 insertions(+), 4 deletions(-)
> 
> diff --git a/configure.ac b/configure.ac
> index 5bf3c52ec..859aa9857 100644
> --- a/configure.ac
> +++ b/configure.ac
> @@ -122,6 +122,7 @@ AC_CHECK_FUNCS_ONCE([ \
>      profil \
>      pwritev \
>      pwritev2 \
> +    quotactl_fd \
>      rand_r \
>      readlinkat \
>      recvmmsg \
> diff --git a/include/lapi/quotactl.h b/include/lapi/quotactl.h
> index 348b70b58..e265a6708 100644
> --- a/include/lapi/quotactl.h
> +++ b/include/lapi/quotactl.h
> @@ -1,6 +1,6 @@
>  // SPDX-License-Identifier: GPL-2.0-or-later
>  /*
> - * Copyright (c) 2017-2019 Fujitsu Ltd.
> + * Copyright (c) 2017-2021 FUJITSU LIMITED. All rights reserved
>   * Author: Xiao Yang <yangx.jy@cn.fujitsu.com>
>   * Author: Yang Xu <xuyang2018.jy@cn.jujitsu.com>
>   */
> @@ -9,6 +9,20 @@
>  #define LAPI_QUOTACTL_H__
>  
>  #include <sys/quota.h>
> +#include "lapi/syscalls.h"
> +
> +static inline void quotactl_fd_supported(void)
> +{
> +	/* allow the tests to fail early */
> +	tst_syscall(__NR_quotactl_fd);
> +}
> +
> +#ifndef HAVE_QUOTACTL_FD
> +static inline int quotactl_fd(int fd, int cmd, int id, caddr_t addr)
> +{
> +	return tst_syscall(__NR_quotactl_fd, fd, cmd, id, addr);
> +}
> +#endif
>  
>  #ifdef HAVE_STRUCT_IF_NEXTDQBLK
>  # include <linux/quota.h>
> diff --git a/testcases/kernel/syscalls/quotactl/quotactl01.c b/testcases/kernel/syscalls/quotactl/quotactl01.c
> index 4b791a03a..469c47437 100644
> --- a/testcases/kernel/syscalls/quotactl/quotactl01.c
> +++ b/testcases/kernel/syscalls/quotactl/quotactl01.c
> @@ -63,8 +63,8 @@
>  #include <string.h>
>  #include <unistd.h>
>  #include <stdio.h>
> -#include "lapi/quotactl.h"
>  #include "tst_test.h"
> +#include "lapi/quotactl.h"
>  
>  #define USRPATH MNTPOINT "/aquota.user"
>  #define GRPPATH MNTPOINT "/aquota.group"
> diff --git a/testcases/kernel/syscalls/quotactl/quotactl04.c b/testcases/kernel/syscalls/quotactl/quotactl04.c
> index ca6a94263..e01657de5 100644
> --- a/testcases/kernel/syscalls/quotactl/quotactl04.c
> +++ b/testcases/kernel/syscalls/quotactl/quotactl04.c
> @@ -41,9 +41,9 @@
>  #include <sys/stat.h>
>  #include <sys/mount.h>
>  #include "config.h"
> +#include "tst_test.h"
>  #include "lapi/quotactl.h"
>  #include "tst_safe_stdio.h"
> -#include "tst_test.h"
>  
>  #define FMTID QFMT_VFS_V1
>  #define MNTPOINT	"mntpoint"
> diff --git a/testcases/kernel/syscalls/quotactl/quotactl07.c b/testcases/kernel/syscalls/quotactl/quotactl07.c
> index a55416f0e..f745e9b1c 100644
> --- a/testcases/kernel/syscalls/quotactl/quotactl07.c
> +++ b/testcases/kernel/syscalls/quotactl/quotactl07.c
> @@ -16,8 +16,8 @@
>  #include <unistd.h>
>  #include <stdio.h>
>  #include <sys/quota.h>
> -#include "lapi/quotactl.h"
>  #include "tst_test.h"
> +#include "lapi/quotactl.h"
>  
>  #ifdef HAVE_XFS_XQM_H
>  # include <xfs/xqm.h>

Unless it breaks compilation the part that shuffles the headers should
go in a separate patch. Or at least it should have been described in the
patch commit message...

-- 
Cyril Hrubis
chrubis@suse.cz


More information about the ltp mailing list