docparse/docparse.c: Make docparse check implied flags recursively
PATCH 1/3 docparse/docparse.c: Make docparse check implied flags recursively
Current docparse cannot check implied flags recursively.
--- docparse/docparse.c | 38 ++++++++++++++++++++++++-------------- 1 file changed, 24 insertions(+), 14 deletions(-)
docparse/docparse.c +24 -14
@@ -361,14 +361,16 @@ static const char *filter_out[] = {static struct implies {const char *flag; -const char *implies; +const char **implies; } implies[] = { - {"format_device" ,"needs_device" }, - {"mount_device" ,"needs_device" }, - {"mount_device" ,"format_device" }, - {"all_filesystems" ,"needs_device" }, - {"needs_device" ,"needs_tmpdir" }, - {NULL ,NULL } + {"mount_device" , (const char *[]) {"format_device" ,"needs_device" , +"needs_tmpdir" ,NULL }}, + {"format_device" , (const char *[]) {"needs_device" ,"needs_tmpdir" , +NULL }}, + {"all_filesystems" , (const char *[]) {"needs_device" ,"needs_tmpdir" , +NULL }}, + {"needs_device" , (const char *[]) {"needs_tmpdir" ,NULL }}, + {NULL , (const char *[]) {NULL }} };const char *strip_name (char *path)
@@ -384,7 +386,7 @@ const char *strip_name(char *path)int main (int argc,char *argv[]) { -unsigned int i; +unsigned int i, j;struct data_node *res;if (argc !=2 ) {
@@ -402,15 +404,23 @@ int main(int argc, char *argv[])/* Normalize the result */ for (i =0 ; implies[i].flag; i++) { -if (data_node_hash_get (res, implies[i].flag) && -data_node_hash_get (res, implies[i].implies)) -fprintf (stderr,"%s: useless tag: %s\n" , argv[1 ], implies[i].implies); +if (data_node_hash_get (res, implies[i].flag)) { +for (j =0 ; implies[i].implies[j]; j++) { +if (data_node_hash_get (res, implies[i].implies[j])) +fprintf (stderr,"%s: useless tag: %s\n" , + argv[1 ], implies[i].implies[j]); + } + } }for (i =0 ; implies[i].flag; i++) { -if (data_node_hash_get (res, implies[i].flag) && - !data_node_hash_get (res, implies[i].implies)) -data_node_hash_add (res, implies[i].implies,data_node_string ("1" )); +if (data_node_hash_get (res, implies[i].flag)) { +for (j =0 ; implies[i].implies[j]; j++) { +if (!data_node_hash_get (res, implies[i].implies[j])) +data_node_hash_add (res, implies[i].implies[j], +data_node_string ("1" )); + } + } }data_node_hash_add (res,"fname" ,data_node_string (argv[1 ]));
Signature · 1 line
2.25.1
PATCH 2/3 docparse/docparse.c: Add missing entries into struct implies
needs_checkpoints and resource_files imply needs_tmpdir.
--- docparse/docparse.c | 2 ++ 1 file changed, 2 insertions(+)
docparse/docparse.c +2 -0
@@ -370,6 +370,8 @@ static struct implies { {"all_filesystems" , (const char *[]) {"needs_device" ,"needs_tmpdir" , NULL}}, {"needs_device", (const char *[]) {"needs_tmpdir", NULL}}, + {"needs_checkpoints", (const char *[]) {"needs_tmpdir", NULL}}, + {"resource_files", (const char *[]) {"needs_tmpdir", NULL}}, {NULL, (const char *[]) {NULL}} };
Signature · 1 line
2.25.1
PATCH 2/3 docparse/docparse.c: Add missing entries into struct implies
Hi Yang,
Quoted 1 line
needs_checkpointsandresource_filesimplyneeds_tmpdir.
Thanks!
Kind regards,
Petr
PATCH 3/3 lib/tst_test.c: Remove redundant needs_device
In reply to Xiao Yang--- lib/tst_test.c | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-)
lib/tst_test.c +3 -5
@@ -942,13 +942,11 @@ static void do_setup(int argc, char *argv[])tst_brk (TCONF ,"%s driver not available" , name); } -if (tst_test->format_device) - tst_test->needs_device =1 ; +if (tst_test->mount_device) + tst_test->format_device =1 ; -if (tst_test->mount_device) { +if (tst_test->format_device) tst_test->needs_device =1 ; - tst_test->format_device =1 ; - }if (tst_test->all_filesystems) tst_test->needs_device =1 ;
Signature · 1 line
2.25.1
PATCH 3/3 lib/tst_test.c: Remove redundant needs_device
Hi Yang,
Quoted 1 line
Signed-off-by Xiao Yang <[email protected]>
Thanks!
Kind regards,
Petr
PATCH 1/3 docparse/docparse.c: Make docparse check implied flags recursively
In reply to Xiao YangHi Yang,
Quoted 1 line
Current docparse cannot check implied flags recursively.
Thanks!
Kind regards,
Petr
PATCH 1/3 docparse/docparse.c: Make docparse check implied flags recursively
Hi Petr,
Thanks for your review and pushed the patch set.
Best Regards,
Xiao Yang
Quoted 9 lines · Petr Vorel
Hi Yang,
Quoted 1 line
Current docparse cannot check implied flags recursively.
Reviewed-by Petr Vorel <[email protected]>Thanks!
Kind regards,
Petr