diff options
| author | Igor Ryzhov <iryzhov@nfware.com> | 2021-10-13 20:08:37 +0300 | 
|---|---|---|
| committer | Igor Ryzhov <iryzhov@nfware.com> | 2021-10-13 20:12:35 +0300 | 
| commit | 2560505196b924f5c447f6c1d493ed9b74a13108 (patch) | |
| tree | 515278e4362bf4f9c9418168df90a90b74946c20 /bfdd/bfdd_cli.c | |
| parent | d7374bd3b1be5edfc20534ae5a301a0160c017bf (diff) | |
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 'bfdd/bfdd_cli.c')
| -rw-r--r-- | bfdd/bfdd_cli.c | 48 | 
1 files changed, 24 insertions, 24 deletions
diff --git a/bfdd/bfdd_cli.c b/bfdd/bfdd_cli.c index 384bb26fd7..d4e12e4f1a 100644 --- a/bfdd/bfdd_cli.c +++ b/bfdd/bfdd_cli.c @@ -92,14 +92,15 @@ DEFUN_YANG(  }  void bfd_cli_show_header(struct vty *vty, -			 struct lyd_node *dnode __attribute__((__unused__)), +			 const struct lyd_node *dnode +			 __attribute__((__unused__)),  			 bool show_defaults __attribute__((__unused__)))  {  	vty_out(vty, "!\nbfd\n");  } -void bfd_cli_show_header_end(struct vty *vty, -			     struct lyd_node *dnode __attribute__((__unused__))) +void bfd_cli_show_header_end(struct vty *vty, const struct lyd_node *dnode +			     __attribute__((__unused__)))  {  	vty_out(vty, "exit\n");  	vty_out(vty, "!\n"); @@ -230,7 +231,7 @@ DEFPY_YANG(  	return nb_cli_apply_changes(vty, NULL);  } -static void _bfd_cli_show_peer(struct vty *vty, struct lyd_node *dnode, +static void _bfd_cli_show_peer(struct vty *vty, const struct lyd_node *dnode,  			       bool show_defaults __attribute__((__unused__)),  			       bool mhop)  { @@ -259,22 +260,20 @@ static void _bfd_cli_show_peer(struct vty *vty, struct lyd_node *dnode,  	vty_out(vty, "\n");  } -void bfd_cli_show_single_hop_peer(struct vty *vty, -				  struct lyd_node *dnode, +void bfd_cli_show_single_hop_peer(struct vty *vty, const struct lyd_node *dnode,  				  bool show_defaults)  {  	_bfd_cli_show_peer(vty, dnode, show_defaults, false);  } -void bfd_cli_show_multi_hop_peer(struct vty *vty, -				  struct lyd_node *dnode, -				  bool show_defaults) +void bfd_cli_show_multi_hop_peer(struct vty *vty, const struct lyd_node *dnode, +				 bool show_defaults)  {  	_bfd_cli_show_peer(vty, dnode, show_defaults, true);  } -void bfd_cli_show_peer_end(struct vty *vty, -			   struct lyd_node *dnode __attribute__((__unused__))) +void bfd_cli_show_peer_end(struct vty *vty, const struct lyd_node *dnode +			   __attribute__((__unused__)))  {  	vty_out(vty, " exit\n");  	vty_out(vty, " !\n"); @@ -291,7 +290,7 @@ DEFPY_YANG(  	return nb_cli_apply_changes(vty, NULL);  } -void bfd_cli_show_shutdown(struct vty *vty, struct lyd_node *dnode, +void bfd_cli_show_shutdown(struct vty *vty, const struct lyd_node *dnode,  			   bool show_defaults)  {  	vty_out(vty, "  %sshutdown\n", @@ -309,7 +308,7 @@ DEFPY_YANG(  	return nb_cli_apply_changes(vty, NULL);  } -void bfd_cli_show_passive(struct vty *vty, struct lyd_node *dnode, +void bfd_cli_show_passive(struct vty *vty, const struct lyd_node *dnode,  			  bool show_defaults)  {  	vty_out(vty, "  %spassive-mode\n", @@ -347,7 +346,7 @@ DEFPY_YANG(  	return nb_cli_apply_changes(vty, NULL);  } -void bfd_cli_show_minimum_ttl(struct vty *vty, struct lyd_node *dnode, +void bfd_cli_show_minimum_ttl(struct vty *vty, const struct lyd_node *dnode,  			      bool show_defaults)  {  	vty_out(vty, "  minimum-ttl %s\n", yang_dnode_get_string(dnode, NULL)); @@ -364,7 +363,7 @@ DEFPY_YANG(  	return nb_cli_apply_changes(vty, NULL);  } -void bfd_cli_show_mult(struct vty *vty, struct lyd_node *dnode, +void bfd_cli_show_mult(struct vty *vty, const struct lyd_node *dnode,  		       bool show_defaults)  {  	vty_out(vty, "  detect-multiplier %s\n", @@ -386,7 +385,7 @@ DEFPY_YANG(  	return nb_cli_apply_changes(vty, NULL);  } -void bfd_cli_show_rx(struct vty *vty, struct lyd_node *dnode, +void bfd_cli_show_rx(struct vty *vty, const struct lyd_node *dnode,  		     bool show_defaults)  {  	uint32_t value = yang_dnode_get_uint32(dnode, NULL); @@ -409,7 +408,7 @@ DEFPY_YANG(  	return nb_cli_apply_changes(vty, NULL);  } -void bfd_cli_show_tx(struct vty *vty, struct lyd_node *dnode, +void bfd_cli_show_tx(struct vty *vty, const struct lyd_node *dnode,  		     bool show_defaults)  {  	uint32_t value = yang_dnode_get_uint32(dnode, NULL); @@ -437,8 +436,8 @@ DEFPY_YANG(  	return nb_cli_apply_changes(vty, NULL);  } -void bfd_cli_show_echo(struct vty *vty, struct lyd_node *dnode, -			   bool show_defaults) +void bfd_cli_show_echo(struct vty *vty, const struct lyd_node *dnode, +		       bool show_defaults)  {  	vty_out(vty, "  %secho-mode\n",  		yang_dnode_get_bool(dnode, NULL) ? "" : "no "); @@ -487,8 +486,8 @@ DEFPY_YANG(  	return nb_cli_apply_changes(vty, NULL);  } -void bfd_cli_show_desired_echo_transmission_interval(struct vty *vty, -	struct lyd_node *dnode, bool show_defaults) +void bfd_cli_show_desired_echo_transmission_interval( +	struct vty *vty, const struct lyd_node *dnode, bool show_defaults)  {  	uint32_t value = yang_dnode_get_uint32(dnode, NULL); @@ -522,7 +521,8 @@ DEFPY_YANG(  }  void bfd_cli_show_required_echo_receive_interval(struct vty *vty, -	struct lyd_node *dnode, bool show_defaults) +						 const struct lyd_node *dnode, +						 bool show_defaults)  {  	uint32_t value = yang_dnode_get_uint32(dnode, NULL); @@ -573,7 +573,7 @@ DEFPY_YANG(no_bfd_profile, no_bfd_profile_cmd,  	return nb_cli_apply_changes(vty, NULL);  } -void bfd_cli_show_profile(struct vty *vty, struct lyd_node *dnode, +void bfd_cli_show_profile(struct vty *vty, const struct lyd_node *dnode,  			  bool show_defaults)  {  	vty_out(vty, " profile %s\n", yang_dnode_get_string(dnode, "./name")); @@ -654,7 +654,7 @@ DEFPY_YANG(bfd_peer_profile, bfd_peer_profile_cmd,  	return nb_cli_apply_changes(vty, NULL);  } -void bfd_cli_peer_profile_show(struct vty *vty, struct lyd_node *dnode, +void bfd_cli_peer_profile_show(struct vty *vty, const struct lyd_node *dnode,  			       bool show_defaults)  {  	vty_out(vty, "  profile %s\n", yang_dnode_get_string(dnode, NULL));  | 
