summaryrefslogtreecommitdiffstats
path: root/tools/gen_yang_deviations.c
diff options
context:
space:
mode:
authorRenato Westphal <renato@opensourcerouting.org>2018-11-03 00:56:26 +0100
committerRenato Westphal <renato@opensourcerouting.org>2018-11-26 20:38:08 +0100
commite0ccfad220d80c1d02b327fd0ee24faf6a8d2bd4 (patch)
treefcfd051fb691b38b615c3c77631dcf4e876060f5 /tools/gen_yang_deviations.c
parentlib: introduce function that loads all FRR native YANG modules (diff)
downloadfrr-e0ccfad220d80c1d02b327fd0ee24faf6a8d2bd4.tar.xz
frr-e0ccfad220d80c1d02b327fd0ee24faf6a8d2bd4.zip
lib: rework the yang schema node iteration functions
* Rename yang_snodes_iterate() to yang_snodes_iterate_subtree() and expose it in the public API. * Rename yang_module_snodes_iterate() to yang_snodes_iterate_module(). * Rename yang_all_snodes_iterate() to yang_snodes_iterate_all(). * Make it possible to stop the iteration at any time by returning YANG_ITER_STOP in the iteration callbacks. * Make the iteration callbacks accept only one user argument and not two. Signed-off-by: Renato Westphal <renato@opensourcerouting.org>
Diffstat (limited to 'tools/gen_yang_deviations.c')
-rw-r--r--tools/gen_yang_deviations.c9
1 files changed, 5 insertions, 4 deletions
diff --git a/tools/gen_yang_deviations.c b/tools/gen_yang_deviations.c
index 121969c6f..f611f1c57 100644
--- a/tools/gen_yang_deviations.c
+++ b/tools/gen_yang_deviations.c
@@ -32,8 +32,7 @@ static void __attribute__((noreturn)) usage(int status)
exit(status);
}
-static void generate_yang_deviation(const struct lys_node *snode, void *arg1,
- void *arg2)
+static int generate_yang_deviation(const struct lys_node *snode, void *arg)
{
char xpath[XPATH_MAXLEN];
@@ -42,6 +41,8 @@ static void generate_yang_deviation(const struct lys_node *snode, void *arg1,
printf(" deviation \"%s\" {\n", xpath);
printf(" deviate not-supported;\n");
printf(" }\n\n");
+
+ return YANG_ITER_CONTINUE;
}
int main(int argc, char *argv[])
@@ -70,8 +71,8 @@ int main(int argc, char *argv[])
module = yang_module_load(argv[0]);
/* Generate deviations. */
- yang_module_snodes_iterate(module->info, generate_yang_deviation,
- YANG_ITER_FILTER_IMPLICIT, NULL, NULL);
+ yang_snodes_iterate_module(module->info, generate_yang_deviation,
+ YANG_ITER_FILTER_IMPLICIT, NULL);
/* Cleanup and exit. */
yang_terminate();