diff options
author | Igor Ryzhov <iryzhov@nfware.com> | 2021-10-13 19:08:37 +0200 |
---|---|---|
committer | Igor Ryzhov <iryzhov@nfware.com> | 2021-10-13 19:12:35 +0200 |
commit | 2560505196b924f5c447f6c1d493ed9b74a13108 (patch) | |
tree | 515278e4362bf4f9c9418168df90a90b74946c20 /pathd | |
parent | Merge pull request #9788 from idryzhov/ospf6-clear-interface-vrf (diff) | |
download | frr-2560505196b924f5c447f6c1d493ed9b74a13108.tar.xz frr-2560505196b924f5c447f6c1d493ed9b74a13108.zip |
lib: northbound cli show/cmd functions must not modify data nodes
To ensure this, add a const modifier to functions' arguments. Would be
great do this initially and avoid this large code change, but better
late than never.
Signed-off-by: Igor Ryzhov <iryzhov@nfware.com>
Diffstat (limited to 'pathd')
-rw-r--r-- | pathd/path_cli.c | 23 | ||||
-rw-r--r-- | pathd/path_nb.h | 21 |
2 files changed, 24 insertions, 20 deletions
diff --git a/pathd/path_cli.c b/pathd/path_cli.c index 46242fd05..bfeea8c3d 100644 --- a/pathd/path_cli.c +++ b/pathd/path_cli.c @@ -298,14 +298,15 @@ DEFPY(srte_no_segment_list, return nb_cli_apply_changes(vty, NULL); } -void cli_show_srte_segment_list(struct vty *vty, struct lyd_node *dnode, +void cli_show_srte_segment_list(struct vty *vty, const struct lyd_node *dnode, bool show_defaults) { vty_out(vty, " segment-list %s\n", yang_dnode_get_string(dnode, "./name")); } -void cli_show_srte_segment_list_end(struct vty *vty, struct lyd_node *dnode) +void cli_show_srte_segment_list_end(struct vty *vty, + const struct lyd_node *dnode) { vty_out(vty, " exit\n"); } @@ -557,7 +558,7 @@ DEFPY(srte_segment_list_no_segment, } void cli_show_srte_segment_list_segment(struct vty *vty, - struct lyd_node *dnode, + const struct lyd_node *dnode, bool show_defaults) { vty_out(vty, " index %s", yang_dnode_get_string(dnode, "./index")); @@ -668,7 +669,7 @@ DEFPY(srte_no_policy, return nb_cli_apply_changes(vty, NULL); } -void cli_show_srte_policy(struct vty *vty, struct lyd_node *dnode, +void cli_show_srte_policy(struct vty *vty, const struct lyd_node *dnode, bool show_defaults) { vty_out(vty, " policy color %s endpoint %s\n", @@ -676,7 +677,7 @@ void cli_show_srte_policy(struct vty *vty, struct lyd_node *dnode, yang_dnode_get_string(dnode, "./endpoint")); } -void cli_show_srte_policy_end(struct vty *vty, struct lyd_node *dnode) +void cli_show_srte_policy_end(struct vty *vty, const struct lyd_node *dnode) { vty_out(vty, " exit\n"); } @@ -708,8 +709,8 @@ DEFPY(srte_policy_no_name, } -void cli_show_srte_policy_name(struct vty *vty, struct lyd_node *dnode, - bool show_defaults) +void cli_show_srte_policy_name(struct vty *vty, const struct lyd_node *dnode, + bool show_defaults) { vty_out(vty, " name %s\n", yang_dnode_get_string(dnode, NULL)); } @@ -741,7 +742,7 @@ DEFPY(srte_policy_no_binding_sid, } void cli_show_srte_policy_binding_sid(struct vty *vty, - struct lyd_node *dnode, + const struct lyd_node *dnode, bool show_defaults) { vty_out(vty, " binding-sid %s\n", yang_dnode_get_string(dnode, NULL)); @@ -1187,7 +1188,7 @@ static int config_write_metric_cb(const struct lyd_node *dnode, void *arg) } void cli_show_srte_policy_candidate_path(struct vty *vty, - struct lyd_node *dnode, + const struct lyd_node *dnode, bool show_defaults) { float bandwidth; @@ -1253,7 +1254,7 @@ void cli_show_srte_policy_candidate_path(struct vty *vty, } void cli_show_srte_policy_candidate_path_end(struct vty *vty, - struct lyd_node *dnode) + const struct lyd_node *dnode) { const char *type = yang_dnode_get_string(dnode, "./type"); @@ -1265,7 +1266,7 @@ static int config_write_dnode(const struct lyd_node *dnode, void *arg) { struct vty *vty = arg; - nb_cli_show_dnode_cmds(vty, (struct lyd_node *)dnode, false); + nb_cli_show_dnode_cmds(vty, dnode, false); return YANG_ITER_CONTINUE; } diff --git a/pathd/path_nb.h b/pathd/path_nb.h index 6a918b8b8..dacc5eb0d 100644 --- a/pathd/path_nb.h +++ b/pathd/path_nb.h @@ -110,23 +110,26 @@ int pathd_srte_policy_candidate_path_segment_list_name_destroy( void pathd_apply_finish(struct nb_cb_apply_finish_args *args); /* Optional 'cli_show' callbacks. */ -void cli_show_srte_segment_list(struct vty *vty, struct lyd_node *dnode, +void cli_show_srte_segment_list(struct vty *vty, const struct lyd_node *dnode, bool show_defaults); -void cli_show_srte_segment_list_end(struct vty *vty, struct lyd_node *dnode); -void cli_show_srte_segment_list_segment(struct vty *vty, struct lyd_node *dnode, +void cli_show_srte_segment_list_end(struct vty *vty, + const struct lyd_node *dnode); +void cli_show_srte_segment_list_segment(struct vty *vty, + const struct lyd_node *dnode, bool show_defaults); -void cli_show_srte_policy(struct vty *vty, struct lyd_node *dnode, +void cli_show_srte_policy(struct vty *vty, const struct lyd_node *dnode, bool show_defaults); -void cli_show_srte_policy_end(struct vty *vty, struct lyd_node *dnode); -void cli_show_srte_policy_name(struct vty *vty, struct lyd_node *dnode, +void cli_show_srte_policy_end(struct vty *vty, const struct lyd_node *dnode); +void cli_show_srte_policy_name(struct vty *vty, const struct lyd_node *dnode, bool show_defaults); -void cli_show_srte_policy_binding_sid(struct vty *vty, struct lyd_node *dnode, +void cli_show_srte_policy_binding_sid(struct vty *vty, + const struct lyd_node *dnode, bool show_defaults); void cli_show_srte_policy_candidate_path(struct vty *vty, - struct lyd_node *dnode, + const struct lyd_node *dnode, bool show_defaults); void cli_show_srte_policy_candidate_path_end(struct vty *vty, - struct lyd_node *dnode); + const struct lyd_node *dnode); /* Utility functions */ typedef void (*of_pref_cp_t)(enum objfun_type type, void *arg); |