All of lore.kernel.org
 help / color / mirror / Atom feed
* [LTP] [PATCH 1/2] testcases/kernel/syscalls: make use of ARRAY_SIZE
@ 2015-05-19  8:32 Wei,Jiangang
  2015-05-19  8:32 ` [LTP] [PATCH 2/2] kernel/controllers/cpuctl: cleanup Wei,Jiangang
  2015-05-20 13:36 ` [LTP] [PATCH 1/2] testcases/kernel/syscalls: make use of ARRAY_SIZE Cyril Hrubis
  0 siblings, 2 replies; 7+ messages in thread
From: Wei,Jiangang @ 2015-05-19  8:32 UTC (permalink / raw)
  To: ltp-list

Using ARRAY_SIZE replace sizeof()/sizeof()

Signed-off-by: Wei,Jiangang <weijg.fnst@cn.fujitsu.com>
---
 testcases/kernel/syscalls/setreuid/setreuid02.c | 2 +-
 testcases/kernel/syscalls/setreuid/setreuid03.c | 2 +-
 testcases/kernel/syscalls/setreuid/setreuid04.c | 3 +--
 testcases/kernel/syscalls/setreuid/setreuid05.c | 2 +-
 testcases/kernel/syscalls/sysctl/sysctl01.c     | 4 +---
 testcases/kernel/syscalls/sysctl/sysctl03.c     | 9 ++++-----
 testcases/kernel/syscalls/sysctl/sysctl04.c     | 3 +--
 testcases/kernel/syscalls/sysctl/sysctl05.c     | 4 +---
 8 files changed, 11 insertions(+), 18 deletions(-)

diff --git a/testcases/kernel/syscalls/setreuid/setreuid02.c b/testcases/kernel/syscalls/setreuid/setreuid02.c
index 9cc0333..1257046 100644
--- a/testcases/kernel/syscalls/setreuid/setreuid02.c
+++ b/testcases/kernel/syscalls/setreuid/setreuid02.c
@@ -58,7 +58,7 @@ static struct test_data_t {
 	&bin.pw_uid, &neg_one, &bin, &root, "After setreuid(bin, -1)"}, {
 &root.pw_uid, &neg_one, &root, &root, "After setreuid(-1, root)"},};
 
-int TST_TOTAL = sizeof(test_data) / sizeof(test_data[0]);
+int TST_TOTAL = ARRAY_SIZE(test_data);
 
 static void setup(void);
 static void cleanup(void);
diff --git a/testcases/kernel/syscalls/setreuid/setreuid03.c b/testcases/kernel/syscalls/setreuid/setreuid03.c
index 2533908..34fa606 100644
--- a/testcases/kernel/syscalls/setreuid/setreuid03.c
+++ b/testcases/kernel/syscalls/setreuid/setreuid03.c
@@ -83,7 +83,7 @@ static struct test_data_t {
 	&nobody.pw_uid, &bin.pw_uid, &fail, &nobody, &nobody,
 		    "After setreuid(nobody, bin),"},};
 
-int TST_TOTAL = sizeof(test_data) / sizeof(test_data[0]);
+int TST_TOTAL = ARRAY_SIZE(test_data);
 
 static void setup(void);
 static void cleanup(void);
diff --git a/testcases/kernel/syscalls/setreuid/setreuid04.c b/testcases/kernel/syscalls/setreuid/setreuid04.c
index f05f61d..2080f47 100644
--- a/testcases/kernel/syscalls/setreuid/setreuid04.c
+++ b/testcases/kernel/syscalls/setreuid/setreuid04.c
@@ -54,8 +54,7 @@ struct test_data_t {
 &nobody.pw_uid, &nobody.pw_uid, &nobody, &nobody,
 		    "After setreuid(-1, -1),"},};
 
-/*int TST_TOTAL = sizeof(test_data)/sizeof(test_data[0]);*/
-int TST_TOTAL = 2;
+int TST_TOTAL = ARRAY_SIZE(test_data);
 
 static void setup(void);
 static void cleanup(void);
diff --git a/testcases/kernel/syscalls/setreuid/setreuid05.c b/testcases/kernel/syscalls/setreuid/setreuid05.c
index d6c4c6f..98436d3 100644
--- a/testcases/kernel/syscalls/setreuid/setreuid05.c
+++ b/testcases/kernel/syscalls/setreuid/setreuid05.c
@@ -76,7 +76,7 @@ struct test_data_t {
 	&neg_one, &bin.pw_uid, &fail, &daemonpw, &daemonpw,
 		    "After setreuid(-1, bin),"},};
 
-int TST_TOTAL = sizeof(test_data) / sizeof(test_data[0]);
+int TST_TOTAL = ARRAY_SIZE(test_data);
 
 static void setup(void);
 static void cleanup(void);
diff --git a/testcases/kernel/syscalls/sysctl/sysctl01.c b/testcases/kernel/syscalls/sysctl/sysctl01.c
index fe62905..de6c6aa 100644
--- a/testcases/kernel/syscalls/sysctl/sysctl01.c
+++ b/testcases/kernel/syscalls/sysctl/sysctl01.c
@@ -66,8 +66,6 @@ static int sysctl(int *name, int nlen, void *oldval, size_t * oldlenp,
 	return syscall(__NR__sysctl, &args);
 }
 
-#define SIZE(x) sizeof(x)/sizeof(x[0])
-
 struct utsname buf;
 char osname[BUFSIZ];
 size_t osnamelth;
@@ -115,7 +113,7 @@ int main(int ac, char **av)
 
 		for (i = 0; i < TST_TOTAL; ++i) {
 
-			osnamelth = SIZE(osname);
+			osnamelth = ARRAY_SIZE(osname);
 
 			switch (i) {
 			case 0:
diff --git a/testcases/kernel/syscalls/sysctl/sysctl03.c b/testcases/kernel/syscalls/sysctl/sysctl03.c
index 88890b6..52e8ce6 100644
--- a/testcases/kernel/syscalls/sysctl/sysctl03.c
+++ b/testcases/kernel/syscalls/sysctl/sysctl03.c
@@ -86,7 +86,6 @@ int sysctl(int *name, int nlen, void *oldval, size_t * oldlenp,
 	return syscall(__NR__sysctl, &args);
 }
 
-#define SIZE(x) sizeof(x)/sizeof(x[0])
 #define OSNAMESZ 100
 
 void setup(void);
@@ -123,9 +122,9 @@ int main(int ac, char **av)
 		tst_count = 0;
 
 		strcpy(osname, "Linux");
-		osnamelth = SIZE(osname);
+		osnamelth = ARRAY_SIZE(osname);
 
-		TEST(sysctl(name, SIZE(name), 0, 0, osname, osnamelth));
+		TEST(sysctl(name, ARRAY_SIZE(name), 0, 0, osname, osnamelth));
 
 		if (TEST_RETURN != -1) {
 			tst_resm(TFAIL, "sysctl(2) succeeded unexpectedly");
@@ -142,7 +141,7 @@ int main(int ac, char **av)
 			}
 		}
 
-		osnamelth = SIZE(osname);
+		osnamelth = ARRAY_SIZE(osname);
 		if ((ltpuser = getpwnam("nobody")) == NULL) {
 			tst_brkm(TBROK, cleanup, "getpwnam() failed");
 		}
@@ -158,7 +157,7 @@ int main(int ac, char **av)
 		}
 
 		if (pid == 0) {
-			TEST(sysctl(name, SIZE(name), 0, 0, osname, osnamelth));
+			TEST(sysctl(name, ARRAY_SIZE(name), 0, 0, osname, osnamelth));
 
 			if (TEST_RETURN != -1) {
 				tst_resm(TFAIL, "call succeeded unexpectedly");
diff --git a/testcases/kernel/syscalls/sysctl/sysctl04.c b/testcases/kernel/syscalls/sysctl/sysctl04.c
index ff63364..cb2ca65 100644
--- a/testcases/kernel/syscalls/sysctl/sysctl04.c
+++ b/testcases/kernel/syscalls/sysctl/sysctl04.c
@@ -67,7 +67,6 @@ int sysctl(int *name, int nlen, void *oldval, size_t * oldlenp,
 	return syscall(__NR__sysctl, &args);
 }
 
-#define SIZE(x) sizeof(x)/sizeof(x[0])
 #define OSNAMESZ 100
 
 void setup(void);
@@ -98,7 +97,7 @@ int main(int ac, char **av)
 
 	setup();
 
-	osnamelth = SIZE(osname);
+	osnamelth = ARRAY_SIZE(osname);
 
 	for (lc = 0; TEST_LOOPING(lc); lc++) {
 
diff --git a/testcases/kernel/syscalls/sysctl/sysctl05.c b/testcases/kernel/syscalls/sysctl/sysctl05.c
index e6f09b2..eb7fed9 100644
--- a/testcases/kernel/syscalls/sysctl/sysctl05.c
+++ b/testcases/kernel/syscalls/sysctl/sysctl05.c
@@ -69,8 +69,6 @@ int sysctl(int *name, int nlen, void *oldval, size_t * oldlenp,
 	return syscall(__NR__sysctl, &args);
 }
 
-#define SIZE(x) sizeof(x)/sizeof(x[0])
-
 char osname[BUFSIZ];
 size_t osnamelth;
 
@@ -117,7 +115,7 @@ int main(int ac, char **av)
 
 		for (i = 0; i < TST_TOTAL; ++i) {
 
-			osnamelth = SIZE(osname);
+			osnamelth = ARRAY_SIZE(osname);
 
 			TEST(sysctl(testcases[i].name, testcases[i].size,
 				    testcases[i].oldval, testcases[i].oldlen,
-- 
1.9.3


------------------------------------------------------------------------------
One dashboard for servers and applications across Physical-Virtual-Cloud 
Widest out-of-the-box monitoring support with 50+ applications
Performance metrics, stats and reports that give you Actionable Insights
Deep dive visibility with transaction tracing using APM Insight.
http://ad.doubleclick.net/ddm/clk/290420510;117567292;y
_______________________________________________
Ltp-list mailing list
Ltp-list@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/ltp-list

^ permalink raw reply related	[flat|nested] 7+ messages in thread

* [LTP] [PATCH 2/2] kernel/controllers/cpuctl: cleanup
  2015-05-19  8:32 [LTP] [PATCH 1/2] testcases/kernel/syscalls: make use of ARRAY_SIZE Wei,Jiangang
@ 2015-05-19  8:32 ` Wei,Jiangang
  2015-05-20 13:38   ` Cyril Hrubis
  2015-05-20 13:36 ` [LTP] [PATCH 1/2] testcases/kernel/syscalls: make use of ARRAY_SIZE Cyril Hrubis
  1 sibling, 1 reply; 7+ messages in thread
From: Wei,Jiangang @ 2015-05-19  8:32 UTC (permalink / raw)
  To: ltp-list

* Remove indundent includes for unistd.h
* Add void where needed

Signed-off-by: Wei,Jiangang <weijg.fnst@cn.fujitsu.com>
---
 testcases/kernel/controllers/cpuctl/cpuctl_def_task01.c | 3 +--
 testcases/kernel/controllers/cpuctl/cpuctl_def_task02.c | 3 +--
 testcases/kernel/controllers/cpuctl/cpuctl_def_task03.c | 3 +--
 testcases/kernel/controllers/cpuctl/cpuctl_test03.c     | 3 +--
 4 files changed, 4 insertions(+), 8 deletions(-)

diff --git a/testcases/kernel/controllers/cpuctl/cpuctl_def_task01.c b/testcases/kernel/controllers/cpuctl/cpuctl_def_task01.c
index ba24b4a..ae6a374 100644
--- a/testcases/kernel/controllers/cpuctl/cpuctl_def_task01.c
+++ b/testcases/kernel/controllers/cpuctl/cpuctl_def_task01.c
@@ -54,7 +54,6 @@
 #include <sys/stat.h>
 #include <fcntl.h>
 #include <time.h>
-#include <unistd.h>
 
 #include "../libcontrollers/libcontrollers.h"
 #include "test.h"		/* LTP harness APIs */
@@ -75,7 +74,7 @@ int TST_TOTAL = 1;
 pid_t scriptpid;
 char path[FILENAME_MAX] = "/dev/cpuctl";
 
-extern void cleanup()
+extern void cleanup(void)
 {
 	kill(scriptpid, SIGUSR1);	/* Inform the shell to do cleanup */
 	/* Report exit status */
diff --git a/testcases/kernel/controllers/cpuctl/cpuctl_def_task02.c b/testcases/kernel/controllers/cpuctl/cpuctl_def_task02.c
index 4680406..5fb3559 100644
--- a/testcases/kernel/controllers/cpuctl/cpuctl_def_task02.c
+++ b/testcases/kernel/controllers/cpuctl/cpuctl_def_task02.c
@@ -57,7 +57,6 @@
 #include <sys/stat.h>
 #include <fcntl.h>
 #include <time.h>
-#include <unistd.h>
 
 #include "../libcontrollers/libcontrollers.h"
 #include "test.h"		/* LTP harness APIs */
@@ -70,7 +69,7 @@ int TST_TOTAL = 1;
 pid_t scriptpid;
 char path[] = "/dev/cpuctl";
 
-extern void cleanup()
+extern void cleanup(void)
 {
 	kill(scriptpid, SIGUSR1);	/* Inform the shell to do cleanup */
 	/* Report exit status */
diff --git a/testcases/kernel/controllers/cpuctl/cpuctl_def_task03.c b/testcases/kernel/controllers/cpuctl/cpuctl_def_task03.c
index 41cfa41..af4695f 100644
--- a/testcases/kernel/controllers/cpuctl/cpuctl_def_task03.c
+++ b/testcases/kernel/controllers/cpuctl/cpuctl_def_task03.c
@@ -58,7 +58,6 @@
 #include <sys/time.h>
 #include <sys/types.h>
 #include <time.h>
-#include <unistd.h>
 
 #include "../libcontrollers/libcontrollers.h"
 #include "test.h"		/* LTP harness APIs */
@@ -70,7 +69,7 @@ char *TCID = "cpu_controller_test06";
 int TST_TOTAL = 3;
 pid_t scriptpid;
 char path[] = "/dev/cpuctl";
-extern void cleanup()
+extern void cleanup(void)
 {
 	kill(scriptpid, SIGUSR1);	/* Inform the shell to do cleanup */
 	/* Report exit status */
diff --git a/testcases/kernel/controllers/cpuctl/cpuctl_test03.c b/testcases/kernel/controllers/cpuctl/cpuctl_test03.c
index ca9f4f9..20dbf86 100644
--- a/testcases/kernel/controllers/cpuctl/cpuctl_test03.c
+++ b/testcases/kernel/controllers/cpuctl/cpuctl_test03.c
@@ -58,7 +58,6 @@
 #include <sys/time.h>
 #include <sys/types.h>
 #include <time.h>
-#include <unistd.h>
 
 #include "../libcontrollers/libcontrollers.h"
 #include "test.h"		/* LTP harness APIs */
@@ -70,7 +69,7 @@ char *TCID = "cpu_controller_test06";
 int TST_TOTAL = 3;
 pid_t scriptpid;
 char path[] = "/dev/cpuctl";
-extern void cleanup()
+extern void cleanup(void)
 {
 	kill(scriptpid, SIGUSR1);	/* Inform the shell to do cleanup */
 	tst_exit();		/* Report exit status */
-- 
1.9.3


------------------------------------------------------------------------------
One dashboard for servers and applications across Physical-Virtual-Cloud 
Widest out-of-the-box monitoring support with 50+ applications
Performance metrics, stats and reports that give you Actionable Insights
Deep dive visibility with transaction tracing using APM Insight.
http://ad.doubleclick.net/ddm/clk/290420510;117567292;y
_______________________________________________
Ltp-list mailing list
Ltp-list@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/ltp-list

^ permalink raw reply related	[flat|nested] 7+ messages in thread

* Re: [LTP] [PATCH 1/2] testcases/kernel/syscalls: make use of ARRAY_SIZE
  2015-05-19  8:32 [LTP] [PATCH 1/2] testcases/kernel/syscalls: make use of ARRAY_SIZE Wei,Jiangang
  2015-05-19  8:32 ` [LTP] [PATCH 2/2] kernel/controllers/cpuctl: cleanup Wei,Jiangang
@ 2015-05-20 13:36 ` Cyril Hrubis
  2015-05-21  2:14   ` [LTP] [PATCH v2 " Wei,Jiangang
  1 sibling, 1 reply; 7+ messages in thread
From: Cyril Hrubis @ 2015-05-20 13:36 UTC (permalink / raw)
  To: Wei,Jiangang; +Cc: ltp-list

Hi!
> --- a/testcases/kernel/syscalls/sysctl/sysctl01.c
> +++ b/testcases/kernel/syscalls/sysctl/sysctl01.c
> @@ -66,8 +66,6 @@ static int sysctl(int *name, int nlen, void *oldval, size_t * oldlenp,
>  	return syscall(__NR__sysctl, &args);
>  }
>  
> -#define SIZE(x) sizeof(x)/sizeof(x[0])
> -
>  struct utsname buf;
>  char osname[BUFSIZ];
>  size_t osnamelth;
> @@ -115,7 +113,7 @@ int main(int ac, char **av)
>  
>  		for (i = 0; i < TST_TOTAL; ++i) {
>  
> -			osnamelth = SIZE(osname);
> +			osnamelth = ARRAY_SIZE(osname);

These could be turned into simple sizeof(osname) as sizeof(char) == 1 by
definition.

-- 
Cyril Hrubis
chrubis@suse.cz

------------------------------------------------------------------------------
One dashboard for servers and applications across Physical-Virtual-Cloud 
Widest out-of-the-box monitoring support with 50+ applications
Performance metrics, stats and reports that give you Actionable Insights
Deep dive visibility with transaction tracing using APM Insight.
http://ad.doubleclick.net/ddm/clk/290420510;117567292;y
_______________________________________________
Ltp-list mailing list
Ltp-list@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/ltp-list

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: [LTP] [PATCH 2/2] kernel/controllers/cpuctl: cleanup
  2015-05-19  8:32 ` [LTP] [PATCH 2/2] kernel/controllers/cpuctl: cleanup Wei,Jiangang
@ 2015-05-20 13:38   ` Cyril Hrubis
  0 siblings, 0 replies; 7+ messages in thread
From: Cyril Hrubis @ 2015-05-20 13:38 UTC (permalink / raw)
  To: Wei,Jiangang; +Cc: ltp-list

Hi!
> * Remove indundent includes for unistd.h
           ^
	   redundant?

> * Add void where needed

Otherwise it looks fine.

-- 
Cyril Hrubis
chrubis@suse.cz

------------------------------------------------------------------------------
One dashboard for servers and applications across Physical-Virtual-Cloud 
Widest out-of-the-box monitoring support with 50+ applications
Performance metrics, stats and reports that give you Actionable Insights
Deep dive visibility with transaction tracing using APM Insight.
http://ad.doubleclick.net/ddm/clk/290420510;117567292;y
_______________________________________________
Ltp-list mailing list
Ltp-list@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/ltp-list

^ permalink raw reply	[flat|nested] 7+ messages in thread

* [LTP] [PATCH v2 1/2] testcases/kernel/syscalls: make use of ARRAY_SIZE
  2015-05-20 13:36 ` [LTP] [PATCH 1/2] testcases/kernel/syscalls: make use of ARRAY_SIZE Cyril Hrubis
@ 2015-05-21  2:14   ` Wei,Jiangang
  2015-05-21  2:14     ` [LTP] [PATCH v2 2/2] kernel/controllers/cpuctl: cleanup Wei,Jiangang
  0 siblings, 1 reply; 7+ messages in thread
From: Wei,Jiangang @ 2015-05-21  2:14 UTC (permalink / raw)
  To: ltp-list

Use ARRAY_SIZE or sizeof() replace sizeof(x)/sizeof(x[0])

Signed-off-by: Wei,Jiangang <weijg.fnst@cn.fujitsu.com>
---
 testcases/kernel/syscalls/setreuid/setreuid02.c | 2 +-
 testcases/kernel/syscalls/setreuid/setreuid03.c | 2 +-
 testcases/kernel/syscalls/setreuid/setreuid04.c | 3 +--
 testcases/kernel/syscalls/setreuid/setreuid05.c | 2 +-
 testcases/kernel/syscalls/sysctl/sysctl01.c     | 4 +---
 testcases/kernel/syscalls/sysctl/sysctl03.c     | 9 ++++-----
 testcases/kernel/syscalls/sysctl/sysctl04.c     | 3 +--
 testcases/kernel/syscalls/sysctl/sysctl05.c     | 4 +---
 8 files changed, 11 insertions(+), 18 deletions(-)

diff --git a/testcases/kernel/syscalls/setreuid/setreuid02.c b/testcases/kernel/syscalls/setreuid/setreuid02.c
index 9cc0333..1257046 100644
--- a/testcases/kernel/syscalls/setreuid/setreuid02.c
+++ b/testcases/kernel/syscalls/setreuid/setreuid02.c
@@ -58,7 +58,7 @@ static struct test_data_t {
 	&bin.pw_uid, &neg_one, &bin, &root, "After setreuid(bin, -1)"}, {
 &root.pw_uid, &neg_one, &root, &root, "After setreuid(-1, root)"},};
 
-int TST_TOTAL = sizeof(test_data) / sizeof(test_data[0]);
+int TST_TOTAL = ARRAY_SIZE(test_data);
 
 static void setup(void);
 static void cleanup(void);
diff --git a/testcases/kernel/syscalls/setreuid/setreuid03.c b/testcases/kernel/syscalls/setreuid/setreuid03.c
index 2533908..34fa606 100644
--- a/testcases/kernel/syscalls/setreuid/setreuid03.c
+++ b/testcases/kernel/syscalls/setreuid/setreuid03.c
@@ -83,7 +83,7 @@ static struct test_data_t {
 	&nobody.pw_uid, &bin.pw_uid, &fail, &nobody, &nobody,
 		    "After setreuid(nobody, bin),"},};
 
-int TST_TOTAL = sizeof(test_data) / sizeof(test_data[0]);
+int TST_TOTAL = ARRAY_SIZE(test_data);
 
 static void setup(void);
 static void cleanup(void);
diff --git a/testcases/kernel/syscalls/setreuid/setreuid04.c b/testcases/kernel/syscalls/setreuid/setreuid04.c
index f05f61d..2080f47 100644
--- a/testcases/kernel/syscalls/setreuid/setreuid04.c
+++ b/testcases/kernel/syscalls/setreuid/setreuid04.c
@@ -54,8 +54,7 @@ struct test_data_t {
 &nobody.pw_uid, &nobody.pw_uid, &nobody, &nobody,
 		    "After setreuid(-1, -1),"},};
 
-/*int TST_TOTAL = sizeof(test_data)/sizeof(test_data[0]);*/
-int TST_TOTAL = 2;
+int TST_TOTAL = ARRAY_SIZE(test_data);
 
 static void setup(void);
 static void cleanup(void);
diff --git a/testcases/kernel/syscalls/setreuid/setreuid05.c b/testcases/kernel/syscalls/setreuid/setreuid05.c
index d6c4c6f..98436d3 100644
--- a/testcases/kernel/syscalls/setreuid/setreuid05.c
+++ b/testcases/kernel/syscalls/setreuid/setreuid05.c
@@ -76,7 +76,7 @@ struct test_data_t {
 	&neg_one, &bin.pw_uid, &fail, &daemonpw, &daemonpw,
 		    "After setreuid(-1, bin),"},};
 
-int TST_TOTAL = sizeof(test_data) / sizeof(test_data[0]);
+int TST_TOTAL = ARRAY_SIZE(test_data);
 
 static void setup(void);
 static void cleanup(void);
diff --git a/testcases/kernel/syscalls/sysctl/sysctl01.c b/testcases/kernel/syscalls/sysctl/sysctl01.c
index fe62905..c423f47 100644
--- a/testcases/kernel/syscalls/sysctl/sysctl01.c
+++ b/testcases/kernel/syscalls/sysctl/sysctl01.c
@@ -66,8 +66,6 @@ static int sysctl(int *name, int nlen, void *oldval, size_t * oldlenp,
 	return syscall(__NR__sysctl, &args);
 }
 
-#define SIZE(x) sizeof(x)/sizeof(x[0])
-
 struct utsname buf;
 char osname[BUFSIZ];
 size_t osnamelth;
@@ -115,7 +113,7 @@ int main(int ac, char **av)
 
 		for (i = 0; i < TST_TOTAL; ++i) {
 
-			osnamelth = SIZE(osname);
+			osnamelth = sizeof(osname);
 
 			switch (i) {
 			case 0:
diff --git a/testcases/kernel/syscalls/sysctl/sysctl03.c b/testcases/kernel/syscalls/sysctl/sysctl03.c
index 88890b6..ec15d11 100644
--- a/testcases/kernel/syscalls/sysctl/sysctl03.c
+++ b/testcases/kernel/syscalls/sysctl/sysctl03.c
@@ -86,7 +86,6 @@ int sysctl(int *name, int nlen, void *oldval, size_t * oldlenp,
 	return syscall(__NR__sysctl, &args);
 }
 
-#define SIZE(x) sizeof(x)/sizeof(x[0])
 #define OSNAMESZ 100
 
 void setup(void);
@@ -123,9 +122,9 @@ int main(int ac, char **av)
 		tst_count = 0;
 
 		strcpy(osname, "Linux");
-		osnamelth = SIZE(osname);
+		osnamelth = sizeof(osname);
 
-		TEST(sysctl(name, SIZE(name), 0, 0, osname, osnamelth));
+		TEST(sysctl(name, ARRAY_SIZE(name), 0, 0, osname, osnamelth));
 
 		if (TEST_RETURN != -1) {
 			tst_resm(TFAIL, "sysctl(2) succeeded unexpectedly");
@@ -142,7 +141,7 @@ int main(int ac, char **av)
 			}
 		}
 
-		osnamelth = SIZE(osname);
+		osnamelth = sizeof(osname);
 		if ((ltpuser = getpwnam("nobody")) == NULL) {
 			tst_brkm(TBROK, cleanup, "getpwnam() failed");
 		}
@@ -158,7 +157,7 @@ int main(int ac, char **av)
 		}
 
 		if (pid == 0) {
-			TEST(sysctl(name, SIZE(name), 0, 0, osname, osnamelth));
+			TEST(sysctl(name, ARRAY_SIZE(name), 0, 0, osname, osnamelth));
 
 			if (TEST_RETURN != -1) {
 				tst_resm(TFAIL, "call succeeded unexpectedly");
diff --git a/testcases/kernel/syscalls/sysctl/sysctl04.c b/testcases/kernel/syscalls/sysctl/sysctl04.c
index ff63364..6339bf2 100644
--- a/testcases/kernel/syscalls/sysctl/sysctl04.c
+++ b/testcases/kernel/syscalls/sysctl/sysctl04.c
@@ -67,7 +67,6 @@ int sysctl(int *name, int nlen, void *oldval, size_t * oldlenp,
 	return syscall(__NR__sysctl, &args);
 }
 
-#define SIZE(x) sizeof(x)/sizeof(x[0])
 #define OSNAMESZ 100
 
 void setup(void);
@@ -98,7 +97,7 @@ int main(int ac, char **av)
 
 	setup();
 
-	osnamelth = SIZE(osname);
+	osnamelth = sizeof(osname);
 
 	for (lc = 0; TEST_LOOPING(lc); lc++) {
 
diff --git a/testcases/kernel/syscalls/sysctl/sysctl05.c b/testcases/kernel/syscalls/sysctl/sysctl05.c
index e6f09b2..85030e7 100644
--- a/testcases/kernel/syscalls/sysctl/sysctl05.c
+++ b/testcases/kernel/syscalls/sysctl/sysctl05.c
@@ -69,8 +69,6 @@ int sysctl(int *name, int nlen, void *oldval, size_t * oldlenp,
 	return syscall(__NR__sysctl, &args);
 }
 
-#define SIZE(x) sizeof(x)/sizeof(x[0])
-
 char osname[BUFSIZ];
 size_t osnamelth;
 
@@ -117,7 +115,7 @@ int main(int ac, char **av)
 
 		for (i = 0; i < TST_TOTAL; ++i) {
 
-			osnamelth = SIZE(osname);
+			osnamelth = sizeof(osname);
 
 			TEST(sysctl(testcases[i].name, testcases[i].size,
 				    testcases[i].oldval, testcases[i].oldlen,
-- 
1.9.3


------------------------------------------------------------------------------
One dashboard for servers and applications across Physical-Virtual-Cloud 
Widest out-of-the-box monitoring support with 50+ applications
Performance metrics, stats and reports that give you Actionable Insights
Deep dive visibility with transaction tracing using APM Insight.
http://ad.doubleclick.net/ddm/clk/290420510;117567292;y
_______________________________________________
Ltp-list mailing list
Ltp-list@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/ltp-list

^ permalink raw reply related	[flat|nested] 7+ messages in thread

* [LTP] [PATCH v2 2/2] kernel/controllers/cpuctl: cleanup
  2015-05-21  2:14   ` [LTP] [PATCH v2 " Wei,Jiangang
@ 2015-05-21  2:14     ` Wei,Jiangang
  2015-05-27 12:26       ` Cyril Hrubis
  0 siblings, 1 reply; 7+ messages in thread
From: Wei,Jiangang @ 2015-05-21  2:14 UTC (permalink / raw)
  To: ltp-list

* Remove redundant include(s) for unistd.h
* Add void where needed

Signed-off-by: Wei,Jiangang <weijg.fnst@cn.fujitsu.com>
---
 testcases/kernel/controllers/cpuctl/cpuctl_def_task01.c | 3 +--
 testcases/kernel/controllers/cpuctl/cpuctl_def_task02.c | 3 +--
 testcases/kernel/controllers/cpuctl/cpuctl_def_task03.c | 3 +--
 testcases/kernel/controllers/cpuctl/cpuctl_test03.c     | 3 +--
 4 files changed, 4 insertions(+), 8 deletions(-)

diff --git a/testcases/kernel/controllers/cpuctl/cpuctl_def_task01.c b/testcases/kernel/controllers/cpuctl/cpuctl_def_task01.c
index ba24b4a..ae6a374 100644
--- a/testcases/kernel/controllers/cpuctl/cpuctl_def_task01.c
+++ b/testcases/kernel/controllers/cpuctl/cpuctl_def_task01.c
@@ -54,7 +54,6 @@
 #include <sys/stat.h>
 #include <fcntl.h>
 #include <time.h>
-#include <unistd.h>
 
 #include "../libcontrollers/libcontrollers.h"
 #include "test.h"		/* LTP harness APIs */
@@ -75,7 +74,7 @@ int TST_TOTAL = 1;
 pid_t scriptpid;
 char path[FILENAME_MAX] = "/dev/cpuctl";
 
-extern void cleanup()
+extern void cleanup(void)
 {
 	kill(scriptpid, SIGUSR1);	/* Inform the shell to do cleanup */
 	/* Report exit status */
diff --git a/testcases/kernel/controllers/cpuctl/cpuctl_def_task02.c b/testcases/kernel/controllers/cpuctl/cpuctl_def_task02.c
index 4680406..5fb3559 100644
--- a/testcases/kernel/controllers/cpuctl/cpuctl_def_task02.c
+++ b/testcases/kernel/controllers/cpuctl/cpuctl_def_task02.c
@@ -57,7 +57,6 @@
 #include <sys/stat.h>
 #include <fcntl.h>
 #include <time.h>
-#include <unistd.h>
 
 #include "../libcontrollers/libcontrollers.h"
 #include "test.h"		/* LTP harness APIs */
@@ -70,7 +69,7 @@ int TST_TOTAL = 1;
 pid_t scriptpid;
 char path[] = "/dev/cpuctl";
 
-extern void cleanup()
+extern void cleanup(void)
 {
 	kill(scriptpid, SIGUSR1);	/* Inform the shell to do cleanup */
 	/* Report exit status */
diff --git a/testcases/kernel/controllers/cpuctl/cpuctl_def_task03.c b/testcases/kernel/controllers/cpuctl/cpuctl_def_task03.c
index 41cfa41..af4695f 100644
--- a/testcases/kernel/controllers/cpuctl/cpuctl_def_task03.c
+++ b/testcases/kernel/controllers/cpuctl/cpuctl_def_task03.c
@@ -58,7 +58,6 @@
 #include <sys/time.h>
 #include <sys/types.h>
 #include <time.h>
-#include <unistd.h>
 
 #include "../libcontrollers/libcontrollers.h"
 #include "test.h"		/* LTP harness APIs */
@@ -70,7 +69,7 @@ char *TCID = "cpu_controller_test06";
 int TST_TOTAL = 3;
 pid_t scriptpid;
 char path[] = "/dev/cpuctl";
-extern void cleanup()
+extern void cleanup(void)
 {
 	kill(scriptpid, SIGUSR1);	/* Inform the shell to do cleanup */
 	/* Report exit status */
diff --git a/testcases/kernel/controllers/cpuctl/cpuctl_test03.c b/testcases/kernel/controllers/cpuctl/cpuctl_test03.c
index ca9f4f9..20dbf86 100644
--- a/testcases/kernel/controllers/cpuctl/cpuctl_test03.c
+++ b/testcases/kernel/controllers/cpuctl/cpuctl_test03.c
@@ -58,7 +58,6 @@
 #include <sys/time.h>
 #include <sys/types.h>
 #include <time.h>
-#include <unistd.h>
 
 #include "../libcontrollers/libcontrollers.h"
 #include "test.h"		/* LTP harness APIs */
@@ -70,7 +69,7 @@ char *TCID = "cpu_controller_test06";
 int TST_TOTAL = 3;
 pid_t scriptpid;
 char path[] = "/dev/cpuctl";
-extern void cleanup()
+extern void cleanup(void)
 {
 	kill(scriptpid, SIGUSR1);	/* Inform the shell to do cleanup */
 	tst_exit();		/* Report exit status */
-- 
1.9.3


------------------------------------------------------------------------------
One dashboard for servers and applications across Physical-Virtual-Cloud 
Widest out-of-the-box monitoring support with 50+ applications
Performance metrics, stats and reports that give you Actionable Insights
Deep dive visibility with transaction tracing using APM Insight.
http://ad.doubleclick.net/ddm/clk/290420510;117567292;y
_______________________________________________
Ltp-list mailing list
Ltp-list@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/ltp-list

^ permalink raw reply related	[flat|nested] 7+ messages in thread

* Re: [LTP] [PATCH v2 2/2] kernel/controllers/cpuctl: cleanup
  2015-05-21  2:14     ` [LTP] [PATCH v2 2/2] kernel/controllers/cpuctl: cleanup Wei,Jiangang
@ 2015-05-27 12:26       ` Cyril Hrubis
  0 siblings, 0 replies; 7+ messages in thread
From: Cyril Hrubis @ 2015-05-27 12:26 UTC (permalink / raw)
  To: Wei,Jiangang; +Cc: ltp-list

Hi!
> * Remove redundant include(s) for unistd.h
> * Add void where needed

Both pushed, thanks.

-- 
Cyril Hrubis
chrubis@suse.cz

------------------------------------------------------------------------------
_______________________________________________
Ltp-list mailing list
Ltp-list@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/ltp-list

^ permalink raw reply	[flat|nested] 7+ messages in thread

end of thread, other threads:[~2015-05-27 12:27 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2015-05-19  8:32 [LTP] [PATCH 1/2] testcases/kernel/syscalls: make use of ARRAY_SIZE Wei,Jiangang
2015-05-19  8:32 ` [LTP] [PATCH 2/2] kernel/controllers/cpuctl: cleanup Wei,Jiangang
2015-05-20 13:38   ` Cyril Hrubis
2015-05-20 13:36 ` [LTP] [PATCH 1/2] testcases/kernel/syscalls: make use of ARRAY_SIZE Cyril Hrubis
2015-05-21  2:14   ` [LTP] [PATCH v2 " Wei,Jiangang
2015-05-21  2:14     ` [LTP] [PATCH v2 2/2] kernel/controllers/cpuctl: cleanup Wei,Jiangang
2015-05-27 12:26       ` Cyril Hrubis

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.