save_restore: remove the duplicate 'const' declaration
--- include/tst_test.h | 2 +- lib/newlib_tests/test19.c | 2 +- lib/newlib_tests/test20.c | 2 +- lib/tst_test.c | 2 +- testcases/cve/icmp_rate_limit01.c | 2 +- testcases/kernel/containers/userns/userns08.c | 2 +- testcases/kernel/mem/ksm/ksm01.c | 2 +- testcases/kernel/mem/ksm/ksm02.c | 2 +- testcases/kernel/mem/ksm/ksm03.c | 2 +- testcases/kernel/mem/ksm/ksm04.c | 2 +- testcases/kernel/mem/ksm/ksm05.c | 2 +- testcases/kernel/mem/ksm/ksm06.c | 2 +- testcases/kernel/syscalls/add_key/add_key05.c | 2 +- testcases/kernel/syscalls/bind/bind06.c | 2 +- testcases/kernel/syscalls/madvise/madvise08.c | 2 +- testcases/kernel/syscalls/migrate_pages/migrate_pages02.c | 2 +- testcases/kernel/syscalls/sendto/sendto03.c | 2 +- testcases/kernel/syscalls/setsockopt/setsockopt05.c | 2 +- testcases/kernel/syscalls/setsockopt/setsockopt06.c | 2 +- testcases/kernel/syscalls/setsockopt/setsockopt07.c | 2 +- testcases/kernel/syscalls/setsockopt/setsockopt08.c | 2 +- testcases/kernel/syscalls/setsockopt/setsockopt09.c | 2 +- 22 files changed, 22 insertions(+), 22 deletions(-)
include/tst_test.h +1 -1
@@ -259,7 +259,7 @@ struct tst_test {* NULL terminated array of (/proc, /sys) files to save * before setup and restore after cleanup */ -const struct tst_path_val const *save_restore; +const struct tst_path_val *save_restore;/* * NULL terminated array of kernel config options required for the
lib/newlib_tests/test19.c +1 -1
@@ -23,7 +23,7 @@ static struct tst_test test = { .needs_root = 1, .test_all = run, .setup = setup, - .save_restore = (const struct tst_path_val const []) { + .save_restore = (const struct tst_path_val []) { {"?/proc/nonexistent" ,NULL }, {"!/proc/sys/kernel/numa_balancing" ,NULL }, {"/proc/sys/kernel/core_pattern" ,NULL },
lib/newlib_tests/test20.c +1 -1
@@ -36,7 +36,7 @@ static void do_test(void) {static struct tst_test test = { .test_all = do_test, .request_hugepages =2 , - .save_restore = (const struct tst_path_val const []) { + .save_restore = (const struct tst_path_val []) { {"!/proc/sys/kernel/numa_balancing" ,"0" },NULL , },
lib/tst_test.c +1 -1
@@ -1105,7 +1105,7 @@ static void do_setup(int argc, char *argv[])tst_tmpdir ();if (tst_test->save_restore) { -const struct tst_path_val const *pvl = tst_test->save_restore; +const struct tst_path_val *pvl = tst_test->save_restore;while (pvl->path) {if (!tst_sys_conf_save (pvl->path))
testcases/cve/icmp_rate_limit01.c +1 -1
@@ -268,7 +268,7 @@ static struct tst_test test = {"CONFIG_NET_NS=y" ,NULL }, - .save_restore = (const struct tst_path_val const[]) { + .save_restore = (const struct tst_path_val[]) { {"?/proc/sys/user/max_user_namespaces" ,NULL },NULL , },
testcases/kernel/containers/userns/userns08.c +1 -1
@@ -134,7 +134,7 @@ static struct tst_test test = {"CONFIG_USER_NS" ,NULL }, - .save_restore = (const struct tst_path_val const[]) { + .save_restore = (const struct tst_path_val[]) { {"?/proc/sys/user/max_user_namespaces" ,NULL },NULL , },
testcases/kernel/mem/ksm/ksm01.c +1 -1
@@ -79,7 +79,7 @@ static struct tst_test test = { {} }, .setup = setup, - .save_restore = (const struct tst_path_val const []) { + .save_restore = (const struct tst_path_val []) { {"!/sys/kernel/mm/ksm/run" ,NULL }, {"!/sys/kernel/mm/ksm/sleep_millisecs" ,NULL }, {"?/sys/kernel/mm/ksm/max_page_sharing" ,NULL },
testcases/kernel/mem/ksm/ksm02.c +1 -1
@@ -97,7 +97,7 @@ static struct tst_test test = { {} }, .setup = setup, - .save_restore = (const struct tst_path_val const []) { + .save_restore = (const struct tst_path_val []) { {"!/sys/kernel/mm/ksm/run" ,NULL }, {"!/sys/kernel/mm/ksm/sleep_millisecs" ,NULL }, {"?/sys/kernel/mm/ksm/max_page_sharing" ,NULL },
testcases/kernel/mem/ksm/ksm03.c +1 -1
@@ -82,7 +82,7 @@ static struct tst_test test = { {} }, .setup = setup, - .save_restore = (const struct tst_path_val const []) { + .save_restore = (const struct tst_path_val []) { {"!/sys/kernel/mm/ksm/run" ,NULL }, {"!/sys/kernel/mm/ksm/sleep_millisecs" ,NULL }, {"?/sys/kernel/mm/ksm/max_page_sharing" ,NULL },
testcases/kernel/mem/ksm/ksm04.c +1 -1
@@ -99,7 +99,7 @@ static struct tst_test test = { {} }, .setup = setup, - .save_restore = (const struct tst_path_val const []) { + .save_restore = (const struct tst_path_val []) { {"!/sys/kernel/mm/ksm/run" ,NULL }, {"!/sys/kernel/mm/ksm/sleep_millisecs" ,NULL }, {"?/sys/kernel/mm/ksm/max_page_sharing" ,NULL },
testcases/kernel/mem/ksm/ksm05.c +1 -1
@@ -88,7 +88,7 @@ static struct tst_test test = { .forks_child = 1, .test_all = test_ksm, .min_kver = "2.6.32", - .save_restore = (const struct tst_path_val const []) { + .save_restore = (const struct tst_path_val []) { {"!/sys/kernel/mm/ksm/run" ,"1" },NULL , },
testcases/kernel/mem/ksm/ksm06.c +1 -1
@@ -136,7 +136,7 @@ static struct tst_test test = { {} }, .setup = setup, - .save_restore = (const struct tst_path_val const []) { + .save_restore = (const struct tst_path_val []) { {"?/sys/kernel/mm/ksm/max_page_sharing" ,NULL }, {"!/sys/kernel/mm/ksm/run" ,NULL }, {"!/sys/kernel/mm/ksm/sleep_millisecs" ,NULL },
testcases/kernel/syscalls/add_key/add_key05.c +1 -1
@@ -214,7 +214,7 @@ static struct tst_test test = { .needs_root = 1, .forks_child = 1, .cleanup = cleanup, - .save_restore = (const struct tst_path_val const []) { + .save_restore = (const struct tst_path_val []) { {"?/proc/sys/kernel/keys/gc_delay" ,"1" }, {"?/proc/sys/kernel/keys/maxkeys" ,"200" }, {"?/proc/sys/kernel/keys/maxbytes" ,"20000" },
testcases/kernel/syscalls/bind/bind06.c +1 -1
@@ -109,7 +109,7 @@ static struct tst_test test = {"CONFIG_NET_NS=y" ,NULL }, - .save_restore = (const struct tst_path_val const[]) { + .save_restore = (const struct tst_path_val[]) { {"?/proc/sys/user/max_user_namespaces" ,NULL },NULL , },
testcases/kernel/syscalls/madvise/madvise08.c +1 -1
@@ -213,7 +213,7 @@ static struct tst_test test = { .needs_tmpdir = 1, .needs_root = 1, .forks_child = 1, - .save_restore = (const struct tst_path_val const []) { + .save_restore = (const struct tst_path_val []) { {CORE_PATTERN ,NULL },NULL , },
testcases/kernel/syscalls/migrate_pages/migrate_pages02.c +1 -1
@@ -326,7 +326,7 @@ static struct tst_test test = { .forks_child = 1, .test_all = run, .setup = setup, - .save_restore = (const struct tst_path_val const []) { + .save_restore = (const struct tst_path_val []) { {"?/proc/sys/kernel/numa_balancing" ,"0" },NULL , },
testcases/kernel/syscalls/sendto/sendto03.c +1 -1
@@ -217,7 +217,7 @@ static struct tst_test test = {"CONFIG_NET_NS=y" ,NULL }, - .save_restore = (const struct tst_path_val const[]) { + .save_restore = (const struct tst_path_val[]) { {"?/proc/sys/user/max_user_namespaces" ,NULL },NULL , },
testcases/kernel/syscalls/setsockopt/setsockopt05.c +1 -1
@@ -101,7 +101,7 @@ static struct tst_test test = {"CONFIG_NET_NS=y" ,NULL }, - .save_restore = (const struct tst_path_val const[]) { + .save_restore = (const struct tst_path_val[]) { {"?/proc/sys/user/max_user_namespaces" ,NULL },NULL , },
testcases/kernel/syscalls/setsockopt/setsockopt06.c +1 -1
@@ -129,7 +129,7 @@ static struct tst_test test = {"CONFIG_NET_NS=y" ,NULL }, - .save_restore = (const struct tst_path_val const[]) { + .save_restore = (const struct tst_path_val[]) { {"?/proc/sys/user/max_user_namespaces" ,NULL },NULL , },
testcases/kernel/syscalls/setsockopt/setsockopt07.c +1 -1
@@ -141,7 +141,7 @@ static struct tst_test test = {"CONFIG_NET_NS=y" ,NULL }, - .save_restore = (const struct tst_path_val const[]) { + .save_restore = (const struct tst_path_val[]) { {"?/proc/sys/user/max_user_namespaces" ,NULL },NULL , },
testcases/kernel/syscalls/setsockopt/setsockopt08.c +1 -1
@@ -158,7 +158,7 @@ static struct tst_test test = {"CONFIG_NET_NS=y" ,NULL }, - .save_restore = (const struct tst_path_val const[]) { + .save_restore = (const struct tst_path_val[]) { {"?/proc/sys/user/max_user_namespaces" ,NULL },NULL , },
testcases/kernel/syscalls/setsockopt/setsockopt09.c +1 -1
@@ -105,7 +105,7 @@ static struct tst_test test = {"CONFIG_NET_NS=y" ,NULL }, - .save_restore = (const struct tst_path_val const[]) { + .save_restore = (const struct tst_path_val[]) { {"?/proc/sys/user/max_user_namespaces" ,NULL },NULL , },
Signature · 5 lines
2.31.1 -- Mailing list info: https://lists.linux.it/listinfo/ltp
Hi Li
lib/newlib_tests/test19.c static struct tst_test test = { · line 29
Quoted 11 lines
lib/newlib_tests/test19.c +1
-1@@ -23,7 +23,7 @@ static struct tst_test test = { .needs_root = 1, .test_all = run, .setup = setup, - .save_restore = (const struct tst_path_val const []) { + .save_restore = (const struct tst_path_val []) { {"?/proc/nonexistent" ,NULL }, {"!/proc/sys/kernel/numa_balancing" ,NULL }, {"/proc/sys/kernel/core_pattern" ,NULL },
Since tst_path_val is a struct array, we should use {NULL, NULL} or {} terminated instead of NULL terminated , otherwise it will report missing braces warning.
Best Regards
Yang Xu
Signature · 1 line
Mailing list info: https://lists.linux.it/listinfo/ltp
Quoted 17 lines · On Thu, Mar 10, 2022 at 4:38 PM [email protected] <…
Hi Li
lib/newlib_tests/test19.c static struct tst_test test = { · line 29
Quoted 11 lines
lib/newlib_tests/test19.c +1
-1@@ -23,7 +23,7 @@ static struct tst_test test = { .needs_root = 1, .test_all = run, .setup = setup, - .save_restore = (const struct tst_path_val const []) { + .save_restore = (const struct tst_path_val []) { {"?/proc/nonexistent" ,NULL }, {"!/proc/sys/kernel/numa_balancing" ,NULL }, {"/proc/sys/kernel/core_pattern" ,NULL },Since
tst_path_valis a struct array, we should use {NULL, NULL} or {} terminated instead of NULL terminated , otherwise it will report missing braces warning.
Ah, right. Sorry!!!
Seems I was in so hurry to fix the const issue but overlook this.
Signature · 2 lines
Regards, Li Wang
Signature · 2 lines
-- Mailing list info: https://lists.linux.it/listinfo/ltp
Hi Li
Quoted 24 lines
On Thu, Mar 10, 2022 at 4:38 PM [email protected] <mailto:[email protected]> <[email protected] <mailto:[email protected]>> wrote:
Hi Li > --- a/lib/newlib_tests/test19.c > +++ b/lib/newlib_tests/test19.c > @@ -23,7 +23,7 @@ static struct tst_test test = { > .needs_root = 1, > .test_all = run, > .setup = setup, > - .save_restore = (const struct tst_path_val const[]) { > + .save_restore = (const struct tst_path_val[]) { > {"?/proc/nonexistent", NULL}, > {"!/proc/sys/kernel/numa_balancing", NULL}, > {"/proc/sys/kernel/core_pattern", NULL}, Since tst_path_val is a struct array, we should use {NULL, NULL} or {} terminated instead of NULL terminated , otherwise it will report missing braces warning.
Quoted 1 line
Ah, right. Sorry!!!
Never mind.
Quoted 2 lines
Seems I was in so hurry to fix the const issue but overlook this.
I also think you can add a separate patch to fix this comment in doc or in tst_test.h for other struct pointers.
/*
* NULL-terminated array to be allocated buffers.
*/
struct tst_buffers *bufs;
/*
* NULL-terminated array of capability settings
*/
struct tst_cap *caps;Best Regards
Yang Xu
Quoted 4 lines
--
Regards,
Li Wang
Signature · 1 line
Mailing list info: https://lists.linux.it/listinfo/ltp
Quoted 26 lines · On Thu, Mar 10, 2022 at 4:53 PM [email protected] <…
Hi Li
Quoted 6 lines
On Thu, Mar 10, 2022 at 4:38 PM [email protected] <mailto:[email protected]> <[email protected] <mailto:[email protected]>> wrote:
Quoted 14 lines
Hi Li > --- a/lib/newlib_tests/test19.c > +++ b/lib/newlib_tests/test19.c > @@ -23,7 +23,7 @@ static struct tst_test test = { > .needs_root = 1, > .test_all = run, > .setup = setup, > - .save_restore = (const struct tst_path_val const[]) { > + .save_restore = (const struct tst_path_val[]) { > {"?/proc/nonexistent", NULL}, > {"!/proc/sys/kernel/numa_balancing", NULL}, > {"/proc/sys/kernel/core_pattern", NULL}, Since tst_path_val is a struct array, we should use {NULL, NULL} or{}
Quoted 4 lines
terminated instead of NULL terminated , otherwise it will report missing
braces warning.
Quoted 7 lines
Quoted 1 line
Ah, right. Sorry!!!
Never mind.
Quoted 2 lines
Seems I was in so hurry to fix the const issue but overlook this.
I also think you can add a separate patch to fix this comment in doc or in
tst_test.hfor other struct pointers.
You are right. I will go through the whole part to see if other places need updates.
Thanks for finding this :).
Quoted 18 lines
/* * NULL-terminated array to be allocated buffers. */ struct tst_buffers *bufs; /* * NULL-terminated array of capability settings */ struct tst_cap *caps;Best Regards
Yang XuQuoted 4 lines
--
Regards,
Li Wang
Signature · 2 lines
Regards, Li Wang
Signature · 2 lines
-- Mailing list info: https://lists.linux.it/listinfo/ltp
Hi Richard
Quoted 16 lines
Hi Li
lib/newlib_tests/test19.c static struct tst_test test = { · line 29
Quoted 11 lines
lib/newlib_tests/test19.c +1
-1@@ -23,7 +23,7 @@ static struct tst_test test = { .needs_root = 1, .test_all = run, .setup = setup, - .save_restore = (const struct tst_path_val const []) { + .save_restore = (const struct tst_path_val []) { {"?/proc/nonexistent" ,NULL }, {"!/proc/sys/kernel/numa_balancing" ,NULL }, {"/proc/sys/kernel/core_pattern" ,NULL },Since
tst_path_valis a struct array, we should use {NULL, NULL} or {} terminated instead of NULL terminated , otherwise it will report missing braces warning.
Since we have the following rule
LTP-005 Array must terminate with a sentinel value (i.e. NULL or '{}')
Can we check struct array whether use {} terminated instead of NULL?
Best Regards
Yang Xu
Quoted 4 lines
Best Regards
Yang Xu
Signature · 1 line
Mailing list info: https://lists.linux.it/listinfo/ltp
Hello,
Quoted 17 lines · "[email protected]" <[email protected]> writes:
Hi Richard
Quoted 16 lines
Hi Li
lib/newlib_tests/test19.c static struct tst_test test = { · line 29
Quoted 11 lines
lib/newlib_tests/test19.c +1
-1@@ -23,7 +23,7 @@ static struct tst_test test = { .needs_root = 1, .test_all = run, .setup = setup, - .save_restore = (const struct tst_path_val const []) { + .save_restore = (const struct tst_path_val []) { {"?/proc/nonexistent" ,NULL }, {"!/proc/sys/kernel/numa_balancing" ,NULL }, {"/proc/sys/kernel/core_pattern" ,NULL },Since
tst_path_valis a struct array, we should use {NULL, NULL} or {} terminated instead of NULL terminated , otherwise it will report missing braces warning.
Quoted 4 lines
Since we have the following rule
LTP-005 Array must terminate with a sentinel value (i.e. NULL or '{}')Can we check struct array whether use {} terminated instead of NULL?
I think so, however naively enabling the check causes a segfault in ptr_list_empty. Probably because there is no list, it's just NULL.
It already reports the missing braces, but I suppose this is not very helpful.
Quoted 7 lines
Best Regards
Yang XuQuoted 4 lines
Best Regards
Yang Xu
Signature · 5 lines
Thank you, Richard. -- Mailing list info: https://lists.linux.it/listinfo/ltp
Hi Richard
Quoted 24 lines
Hello,
Quoted 20 lines · "[email protected]"<[email protected]> writes:
Hi Richard
Quoted 16 lines
Hi Li
lib/newlib_tests/test19.c static struct tst_test test = { · line 29
Quoted 11 lines
lib/newlib_tests/test19.c +1
-1@@ -23,7 +23,7 @@ static struct tst_test test = { .needs_root = 1, .test_all = run, .setup = setup, - .save_restore = (const struct tst_path_val const []) { + .save_restore = (const struct tst_path_val []) { {"?/proc/nonexistent" ,NULL }, {"!/proc/sys/kernel/numa_balancing" ,NULL }, {"/proc/sys/kernel/core_pattern" ,NULL },Since
tst_path_valis a struct array, we should use {NULL, NULL} or {} terminated instead of NULL terminated , otherwise it will report missing braces warning.Since we have the following rule
LTP-005 Array must terminate with a sentinel value (i.e. NULL or '{}')
Quoted 7 lines
Quoted 1 line
Can we check struct array whether use {} terminated instead of NULL?
I think so, however naively enabling the check causes a segfault in
ptr_list_empty. Probably because there is no list, it's just NULL.It already reports the missing braces, but I suppose this is not very helpful.
Sound reasonable.
Best Regards
Yang Xu
Quoted 10 lines
Quoted 8 lines
Best Regards
Yang XuQuoted 4 lines
Best Regards
Yang Xu
Signature · 1 line
Mailing list info: https://lists.linux.it/listinfo/ltp