testcases/containers: clone_args switch to named initializers
PATCH 1/1 testcases/containers: clone_args switch to named initializers
After the addition of cgroup into the clone_args we got a bunch of warnings, this commit fixes all of them.
The code was fixed with following coccinelle spatch:
@@
expression f;
identifier var;
@@
-const struct tst_clone_args var = { f, SIGCHLD }; +const struct tst_clone_args var = {
+ .flags = f,
+ .exit_signal = SIGCHLD,
+};
Fixes 45f6916bae4c ("clone3: Add clone3's clone_args cgroup")
Signed-off-by Cyril Hrubis <[email protected]>
--- testcases/kernel/containers/mountns/mountns01.c | 5 ++++- testcases/kernel/containers/mountns/mountns02.c | 5 ++++- testcases/kernel/containers/mountns/mountns03.c | 5 ++++- testcases/kernel/containers/mqns/mqns_01.c | 5 ++++- testcases/kernel/containers/mqns/mqns_02.c | 5 ++++- testcases/kernel/containers/pidns/pidns01.c | 5 ++++- testcases/kernel/containers/pidns/pidns02.c | 5 ++++- testcases/kernel/containers/pidns/pidns03.c | 5 ++++- testcases/kernel/containers/pidns/pidns04.c | 5 ++++- testcases/kernel/containers/pidns/pidns06.c | 5 ++++- testcases/kernel/containers/pidns/pidns10.c | 5 ++++- testcases/kernel/containers/pidns/pidns12.c | 5 ++++- testcases/kernel/containers/pidns/pidns13.c | 5 ++++- testcases/kernel/containers/pidns/pidns16.c | 5 ++++- testcases/kernel/containers/pidns/pidns17.c | 5 ++++- testcases/kernel/containers/pidns/pidns20.c | 5 ++++- testcases/kernel/containers/pidns/pidns30.c | 5 ++++- testcases/kernel/containers/pidns/pidns31.c | 5 ++++- testcases/kernel/containers/pidns/pidns32.c | 5 ++++- testcases/kernel/containers/sysvipc/common.h | 5 ++++- testcases/kernel/containers/userns/userns01.c | 5 ++++- testcases/kernel/containers/userns/userns02.c | 5 ++++- testcases/kernel/containers/userns/userns03.c | 5 ++++- testcases/kernel/containers/userns/userns04.c | 5 ++++- testcases/kernel/containers/userns/userns05.c | 5 ++++- testcases/kernel/containers/userns/userns06.c | 5 ++++- testcases/kernel/containers/userns/userns07.c | 10 ++++++++-- testcases/kernel/containers/userns/userns08.c | 4 ++-- testcases/kernel/containers/utsname/utsname03.c | 5 ++++- testcases/kernel/containers/utsname/utsname04.c | 5 ++++- 30 files changed, 122 insertions(+), 32 deletions(-)
testcases/kernel/containers/mountns/mountns01.c +4 -1
@@ -56,7 +56,10 @@ static void child_func(void)static void run (void ) { -const struct tst_clone_args args = {CLONE_NEWNS ,SIGCHLD }; +const struct tst_clone_args args = { + .flags =CLONE_NEWNS , + .exit_signal =SIGCHLD , + };SAFE_UNSHARE (CLONE_NEWNS );
testcases/kernel/containers/mountns/mountns02.c +4 -1
@@ -56,7 +56,10 @@ static void child_func(void)static void run (void ) { -const struct tst_clone_args args = {CLONE_NEWNS ,SIGCHLD }; +const struct tst_clone_args args = { + .flags =CLONE_NEWNS , + .exit_signal =SIGCHLD , + };SAFE_UNSHARE (CLONE_NEWNS );
testcases/kernel/containers/mountns/mountns03.c +4 -1
@@ -64,7 +64,10 @@ static void child_func(void)static void run (void ) { -const struct tst_clone_args args = {CLONE_NEWNS ,SIGCHLD }; +const struct tst_clone_args args = { + .flags =CLONE_NEWNS , + .exit_signal =SIGCHLD , + };SAFE_UNSHARE (CLONE_NEWNS );
testcases/kernel/containers/mqns/mqns_01.c +4 -1
@@ -24,7 +24,10 @@ static char *str_op;static void run (void ) { -const struct tst_clone_args clone_args = {CLONE_NEWIPC ,SIGCHLD }; +const struct tst_clone_args clone_args = { + .flags =CLONE_NEWIPC , + .exit_signal =SIGCHLD , + };tst_res (TINFO ,"Checking namespaces isolation from parent to child" );
testcases/kernel/containers/mqns/mqns_02.c +4 -1
@@ -52,7 +52,10 @@ static void isolated_child(void)static void run (void ) { -const struct tst_clone_args clone_args = {CLONE_NEWIPC ,SIGCHLD }; +const struct tst_clone_args clone_args = { + .flags =CLONE_NEWIPC , + .exit_signal =SIGCHLD , + };tst_res (TINFO ,"Checking namespaces isolation from parent to child" );
testcases/kernel/containers/pidns/pidns01.c +4 -1
@@ -30,7 +30,10 @@ static void child_func(void)static void run (void ) { -const struct tst_clone_args args = {CLONE_NEWPID ,SIGCHLD }; +const struct tst_clone_args args = { + .flags =CLONE_NEWPID , + .exit_signal =SIGCHLD , + };if (!SAFE_CLONE (&args)) {child_func ();
testcases/kernel/containers/pidns/pidns02.c +4 -1
@@ -30,7 +30,10 @@ static void child_func(void)static void run (void ) { -const struct tst_clone_args args = {CLONE_NEWPID ,SIGCHLD }; +const struct tst_clone_args args = { + .flags =CLONE_NEWPID , + .exit_signal =SIGCHLD , + };if (!SAFE_CLONE (&args)) {child_func ();
testcases/kernel/containers/pidns/pidns03.c +4 -1
@@ -43,7 +43,10 @@ static void cleanup(void)static void run (void ) { -const struct tst_clone_args args = {CLONE_NEWPID ,SIGCHLD }; +const struct tst_clone_args args = { + .flags =CLONE_NEWPID , + .exit_signal =SIGCHLD , + };if (!SAFE_CLONE (&args)) {child_func ();
testcases/kernel/containers/pidns/pidns04.c +4 -1
@@ -32,7 +32,10 @@ static void child_func(void)static void run (void ) { -const struct tst_clone_args args = {CLONE_NEWPID ,SIGCHLD }; +const struct tst_clone_args args = { + .flags =CLONE_NEWPID , + .exit_signal =SIGCHLD , + };pid_t pid; pid =SAFE_CLONE (&args);
testcases/kernel/containers/pidns/pidns06.c +4 -1
@@ -29,7 +29,10 @@ static void child_func(int pid)static void run (void ) { -const struct tst_clone_args args = {CLONE_NEWPID ,SIGCHLD }; +const struct tst_clone_args args = { + .flags =CLONE_NEWPID , + .exit_signal =SIGCHLD , + };pid_t pid =getpid ();if (!SAFE_CLONE (&args)) {
testcases/kernel/containers/pidns/pidns10.c +4 -1
@@ -29,7 +29,10 @@ static void child_func(void)static void run (void ) { -const struct tst_clone_args args = {CLONE_NEWPID ,SIGCHLD }; +const struct tst_clone_args args = { + .flags =CLONE_NEWPID , + .exit_signal =SIGCHLD , + };if (!SAFE_CLONE (&args)) {child_func ();
testcases/kernel/containers/pidns/pidns12.c +4 -1
@@ -45,7 +45,10 @@ static void child_func(void)static void run (void ) { -const struct tst_clone_args args = {CLONE_NEWPID ,SIGCHLD }; +const struct tst_clone_args args = { + .flags =CLONE_NEWPID , + .exit_signal =SIGCHLD , + };int pid; pid =SAFE_CLONE (&args);
testcases/kernel/containers/pidns/pidns13.c +4 -1
@@ -104,7 +104,10 @@ static void child_fn(unsigned int cinit_no)static void run (void ) { -const struct tst_clone_args cargs = {CLONE_NEWPID ,SIGCHLD }; +const struct tst_clone_args cargs = { + .flags =CLONE_NEWPID , + .exit_signal =SIGCHLD , + };SAFE_PIPE (pipe_fd);
testcases/kernel/containers/pidns/pidns16.c +4 -1
@@ -56,7 +56,10 @@ static void child_func(void)static void run (void ) { -const struct tst_clone_args args = {CLONE_NEWPID ,SIGCHLD }; +const struct tst_clone_args args = { + .flags =CLONE_NEWPID , + .exit_signal =SIGCHLD , + };pid_t pid; signal_pid =-1 ;
testcases/kernel/containers/pidns/pidns17.c +4 -1
@@ -54,7 +54,10 @@ static void child_func(void)static void run (void ) { -const struct tst_clone_args args = {CLONE_NEWPID ,SIGCHLD }; +const struct tst_clone_args args = { + .flags =CLONE_NEWPID , + .exit_signal =SIGCHLD , + };if (!SAFE_CLONE (&args)) {child_func ();
testcases/kernel/containers/pidns/pidns20.c +4 -1
@@ -69,7 +69,10 @@ static void child_func(void)static void run (void ) { -const struct tst_clone_args args = {CLONE_NEWPID ,SIGCHLD }; +const struct tst_clone_args args = { + .flags =CLONE_NEWPID , + .exit_signal =SIGCHLD , + };int pid; pid =SAFE_CLONE (&args);
testcases/kernel/containers/pidns/pidns30.c +4 -1
@@ -88,7 +88,10 @@ static void cleanup(void)static void run (void ) { -const struct tst_clone_args args = {CLONE_NEWPID ,SIGCHLD }; +const struct tst_clone_args args = { + .flags =CLONE_NEWPID , + .exit_signal =SIGCHLD , + };remove_mqueue (mqd); received =0 ;
testcases/kernel/containers/pidns/pidns31.c +4 -1
@@ -71,7 +71,10 @@ static void run(void)pid_t cpid;struct sigaction sa;struct sigevent notif; -const struct tst_clone_args args = {CLONE_NEWPID ,SIGCHLD }; +const struct tst_clone_args args = { + .flags =CLONE_NEWPID , + .exit_signal =SIGCHLD , + };remove_mqueue (mqd); received =0 ;
testcases/kernel/containers/pidns/pidns32.c +4 -1
@@ -19,7 +19,10 @@#define MAXNEST 32 -static const struct tst_clone_args args = {CLONE_NEWPID ,SIGCHLD }; +static const struct tst_clone_args args = { + .flags =CLONE_NEWPID , + .exit_signal =SIGCHLD , +};static int *level;static pid_t child_func (void )
testcases/kernel/containers/sysvipc/common.h +4 -1
@@ -39,7 +39,10 @@ static inline int get_clone_unshare_enum(const char *str_op)static void clone_test (unsigned long clone_flags,void (*fn1)()) { -const struct tst_clone_args clone_args = { clone_flags,SIGCHLD }; +const struct tst_clone_args clone_args = { + .flags = clone_flags, + .exit_signal =SIGCHLD , + };int pid; pid =SAFE_CLONE (&clone_args);
testcases/kernel/containers/userns/userns01.c +4 -1
@@ -73,7 +73,10 @@ static void setup(void)static void run (void ) { -const struct tst_clone_args args = {CLONE_NEWUSER ,SIGCHLD }; +const struct tst_clone_args args = { + .flags =CLONE_NEWUSER , + .exit_signal =SIGCHLD , + };if (!SAFE_CLONE (&args)) {child_fn1 ();
testcases/kernel/containers/userns/userns02.c +4 -1
@@ -32,7 +32,10 @@ static void child_fn1(void)static void run (void ) { -const struct tst_clone_args args = {CLONE_NEWUSER ,SIGCHLD }; +const struct tst_clone_args args = { + .flags =CLONE_NEWUSER , + .exit_signal =SIGCHLD , + };int childpid;int parentuid;int parentgid;
testcases/kernel/containers/userns/userns03.c +4 -1
@@ -117,7 +117,10 @@ static void child_fn2(int cpid1, int parentuid, int parentgid)static void run (void ) { -const struct tst_clone_args args = {CLONE_NEWUSER ,SIGCHLD }; +const struct tst_clone_args args = { + .flags =CLONE_NEWUSER , + .exit_signal =SIGCHLD , + };pid_t cpid1, cpid2;uid_t parentuid;gid_t parentgid;
testcases/kernel/containers/userns/userns04.c +4 -1
@@ -31,7 +31,10 @@ static void child_fn2(int fd)static void run (void ) { -const struct tst_clone_args args = {CLONE_NEWUSER ,SIGCHLD }; +const struct tst_clone_args args = { + .flags =CLONE_NEWUSER , + .exit_signal =SIGCHLD , + };pid_t cpid1, cpid2, cpid3;char path[BUFSIZ ];int fd;
testcases/kernel/containers/userns/userns05.c +4 -1
@@ -45,7 +45,10 @@ static unsigned int getusernsidbypid(int pid)static void run (void ) {const struct tst_clone_args args1 = { .exit_signal =SIGCHLD }; -const struct tst_clone_args args2 = {CLONE_NEWUSER ,SIGCHLD }; +const struct tst_clone_args args2 = { + .flags =CLONE_NEWUSER , + .exit_signal =SIGCHLD , + };int cpid1, cpid2, cpid3;unsigned int parentuserns, cpid1userns, cpid2userns, newparentuserns;
testcases/kernel/containers/userns/userns06.c +4 -1
@@ -62,7 +62,10 @@ static void child_fn2(void)static void run (void ) { -const struct tst_clone_args args = {CLONE_NEWUSER ,SIGCHLD }; +const struct tst_clone_args args = { + .flags =CLONE_NEWUSER , + .exit_signal =SIGCHLD , + };pid_t cpid1;pid_t cpid2;int parentuid;
testcases/kernel/containers/userns/userns07.c +8 -2
@@ -22,7 +22,10 @@static void child_fn1 (const int level) { -const struct tst_clone_args args = {CLONE_NEWUSER ,SIGCHLD }; +const struct tst_clone_args args = { + .flags =CLONE_NEWUSER , + .exit_signal =SIGCHLD , + };pid_t cpid;int parentuid;int parentgid;
@@ -53,7 +56,10 @@ static void child_fn1(const int level)static void run (void ) { -const struct tst_clone_args args = {CLONE_NEWUSER ,SIGCHLD }; +const struct tst_clone_args args = { + .flags =CLONE_NEWUSER , + .exit_signal =SIGCHLD , + };pid_t cpid;int parentuid;int parentgid;
testcases/kernel/containers/userns/userns08.c +2 -2
@@ -31,8 +31,8 @@static pid_t clone_newuser (void ) {const struct tst_clone_args cargs = { -CLONE_NEWUSER , -SIGCHLD + .flags =CLONE_NEWUSER , + .exit_signal =SIGCHLD , };return SAFE_CLONE (&cargs);
testcases/kernel/containers/utsname/utsname03.c +4 -1
@@ -45,7 +45,10 @@ static void child2_run(void)static void run (void ) { -const struct tst_clone_args cargs = {CLONE_NEWUTS ,SIGCHLD }; +const struct tst_clone_args cargs = { + .flags =CLONE_NEWUTS , + .exit_signal =SIGCHLD , + };memset (hostname1,0 ,HOST_NAME_MAX );memset (hostname2,0 ,HOST_NAME_MAX );
testcases/kernel/containers/utsname/utsname04.c +4 -1
@@ -20,7 +20,10 @@ static char *str_op;static void run (void ) { -const struct tst_clone_args cargs = {CLONE_NEWUTS ,SIGCHLD }; +const struct tst_clone_args cargs = { + .flags =CLONE_NEWUTS , + .exit_signal =SIGCHLD , + };struct passwd *pw;tst_res (TINFO ,"Dropping root privileges" );
Signature · 5 lines
2.41.0 -- Mailing list info: https://lists.linux.it/listinfo/ltp