sched/clisrv: Fix "make check" warnings and errors
PATCH 1/1 sched/clisrv: Fix "make check" warnings and errors
Fixed multiple checkpatch issues in the clisrv test suite to improve code style compliance with Linux kernel coding standards.
Changes made:
* Added SPDX-License-Identifier headers to all files
* Removed FSF mailing address from license text
* Fixed SPDX comment style (// for .c files, /* */ for .h files)
* Removed 'extern' keyword from function prototypes in header
* Fixed pointer declaration style (char* -> char *)
* Wrapped multi-statement macro in do-while loop
* Added parentheses around macro values
* Fixed block comment formatting (added * on subsequent lines)
* Separated assignments from if conditions
* Removed unnecessary parentheses from return statements
* Added blank lines after variable declarations
* Replaced platform-specific yield() with sched_yield()
* Added function parameter identifier (void *arg_)
* Changed NULL comparison to implicit check for fgets()
* Restructured if-else logic to avoid "else after break"
* Used __func__ in printf() calls where applicable
* Added (void) cast to suppress unused parameter warnings
Files modified:
- testcases/kernel/sched/clisrv/inet.h
- testcases/kernel/sched/clisrv/pthcli.c
- testcases/kernel/sched/clisrv/pthserv.c
- testcases/kernel/sched/clisrv/readline.c
- testcases/kernel/sched/clisrv/writen.c
Note: Function names are intentionally kept in perror() calls (e.g., "str_cli:", "str_echo:") for better error context, as perror() doesn't support format strings and cannot use __func__. This results in minor checkpatch warnings but provides valuable debugging information.
--- testcases/kernel/sched/clisrv/inet.h | 36 ++++------- testcases/kernel/sched/clisrv/pthcli.c | 75 +++++++--------------- testcases/kernel/sched/clisrv/pthserv.c | 79 +++++++----------------- testcases/kernel/sched/clisrv/readline.c | 47 ++++++-------- testcases/kernel/sched/clisrv/writen.c | 27 ++------ 5 files changed, 78 insertions(+), 186 deletions(-)
testcases/kernel/sched/clisrv/inet.h +11 -25
@@ -1,23 +1,8 @@ +/* SPDX-License-Identifier: GPL-2.0-or-later */ /* -* -* Copyright (c) International Business Machines Corp., 2001 -* -* 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 +* Copyright (c) International Business Machines Corp., 2001 */ -/* inet.h */ #include <stdio.h> #include <sys/types.h> #include <sys/socket.h>
@@ -30,23 +15,24 @@/* address for server */ char *pname; -extern int writen (int fd,char *ptr,int nbytes); -extern int readline (int fd,char *ptr,int maxlen); -extern void noprintf (char * string, ...); - +int writen (int fd,char *ptr,int nbytes); +int readline (int fd,char *ptr,int maxlen); +void noprintf (char *string, ...);/* debug */ #ifdef DEBUG -#define prtln () fflush(NULL); \ - printf("Reached %s: %d\n", __FILE__, __LINE__); +#define prtln () do { \ + fflush(NULL); \ + printf("Reached %s: %d\n", __FILE__, __LINE__); \ + } while (0)#define dprt printf -#define dprt2 (args) printf args +#define dprt2 (args) (printf args)#else #define prtln ()#define dprt noprintf -#define dprt2 (args) noprintf args +#define dprt2 (args) (noprintf args)#endif
testcases/kernel/sched/clisrv/pthcli.c +21 -54
125 lines not on this page · raw message
testcases/kernel/sched/clisrv/pthserv.c +22 -57
153 lines not on this page · raw message
testcases/kernel/sched/clisrv/readline.c +18 -29
68 lines not on this page · raw message
testcases/kernel/sched/clisrv/writen.c +6 -21
@@ -1,29 +1,14 @@ +// SPDX-License-Identifier: GPL-2.0-or-later /* -* Copyright (c) International Business Machines Corp., 2001 -* -* 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 +* Copyright (c) International Business Machines Corp., 2001 */ -/****************************************************************************** -* writen.c -******************************************************************************/ -#include <unistd.h> -/* Write "n" bytes to a descriptor -Use instead of write() when fd is a stream socket. */ +/* +* Write "n" bytes to a descriptor +* Use instead of write() when fd is a stream socket. +*/ int writen (int fd,char *ptr,int nbytes) {
Signature · 5 lines
2.52.0 -- Mailing list info: https://lists.linux.it/listinfo/ltp
Hi!
This tests should be rewritten to LTP API instead, there is no point in fixing small things like that.
First of all this test should be a single C test that forks off the server and runs the client and uses the LTP test API.
It's also not clear what the test actually does, it seems to send some data over socket, but why and what it tries to test?
Signature · 5 lines
Cyril Hrubis [email protected] -- Mailing list info: https://lists.linux.it/listinfo/ltp