[LTP] [PATCH v2] syscalls/fchmodat_01: Convert to new API
Richard Palethorpe
rpalethorpe@suse.de
Thu Apr 14 09:54:56 CEST 2022
Hello,
tangmeng <tangmeng@uniontech.com> writes:
> Signed-off-by: tangmeng <tangmeng@uniontech.com>
> ---
> .../kernel/syscalls/fchmodat/fchmodat01.c | 166 +++++++-----------
> 1 file changed, 60 insertions(+), 106 deletions(-)
>
> diff --git a/testcases/kernel/syscalls/fchmodat/fchmodat01.c b/testcases/kernel/syscalls/fchmodat/fchmodat01.c
> index 9676ae0fd..70e35b363 100644
> --- a/testcases/kernel/syscalls/fchmodat/fchmodat01.c
> +++ b/testcases/kernel/syscalls/fchmodat/fchmodat01.c
> @@ -1,116 +1,65 @@
> -/******************************************************************************
> +// SPDX-License-Identifier: GPL-2.0-or-later
> +/*
> + * Copyright (c) International Business Machines Corp., 2006
> *
> - * Copyright (c) International Business Machines Corp., 2006
> - *
> - * This program is free software; you can redistribute it and/or modify
> - * it under the terms of the GNU General Public License as published by
> - * the Free Software Foundation; either version 2 of the License, or
> - * (at your option) any later version.
> - *
> - * This program is distributed in the hope that it will be useful,
> - * but WITHOUT ANY WARRANTY; without even the implied warranty of
> - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See
> - * the GNU General Public License for more details.
> - *
> - * You should have received a copy of the GNU General Public License
> - * along with this program; if not, write to the Free Software
> - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
> - *
> - * NAME
> - * fchmodat01.c
> - *
> - * DESCRIPTION
> - * This test case will verify basic function of fchmodat
> - * added by kernel 2.6.16 or up.
> - *
> - * Author
> - * Yi Yang <yyangcdl@cn.ibm.com>
> - *
> - * History
> - * 08/28/2006 Created first by Yi Yang <yyangcdl@cn.ibm.com>
> + * 08/28/2006 AUTHOR: Yi Yang <yyangcdl@cn.ibm.com>
> + */
> +
> +/*\
> + * [Description]
> *
> - *****************************************************************************/
> + * This test case will verify basic function of fchmodat.
> + */
>
> #define _GNU_SOURCE
>
> -#include <sys/types.h>
> -#include <sys/stat.h>
> -#include <fcntl.h>
> #include <unistd.h>
> -#include <stdlib.h>
> -#include <errno.h>
> #include <string.h>
> -#include <signal.h>
> -#include "test.h"
> -#include "safe_macros.h"
> +#include <stdlib.h>
> +#include <stdio.h>
> +#include "tst_test.h"
> #include "lapi/syscalls.h"
>
> -#define TEST_CASES 6
> #ifndef AT_FDCWD
> #define AT_FDCWD -100
> #endif
> -void setup();
> -void cleanup();
> -
> -char *TCID = "fchmodat01";
> -int TST_TOTAL = TEST_CASES;
> -char pathname[256];
> -char testfile[256];
> -char testfile2[256];
> -char testfile3[256];
> -int fds[TEST_CASES];
> -char *filenames[TEST_CASES];
> -int expected_errno[TEST_CASES] = { 0, 0, ENOTDIR, EBADF, 0, 0 };
> -
> -int myfchmodat(int dirfd, const char *filename, mode_t mode)
> -{
> - return tst_syscall(__NR_fchmodat, dirfd, filename, mode);
> -}
>
> -int main(int ac, char **av)
> +static char pathname[256];
> +static char testfile[256];
> +static char testfile2[256];
> +static char testfile3[256];
> +
> +static struct tcase {
> + int exp_errno; /* Expected error no */
> + char *exp_errval; /* Expected error value string */
With these comments removed (I can remove them before merge, no need for
another patch)
Reviewed-by: Richard Palethorpe <rpalethorpe@suse.com>
The style guide says to avoid comments.
--
Thank you,
Richard.
More information about the ltp
mailing list