mirror of
https://github.com/openvswitch/ovs
synced 2025-10-15 14:17:18 +00:00
lldp: Use "bool" for boolean variables.
Signed-off-by: Ben Pfaff <blp@nicira.com>
This commit is contained in:
@@ -600,8 +600,8 @@ lldp_decode(struct lldpd *cfg OVS_UNUSED, char *frame, int s,
|
||||
return 1;
|
||||
|
||||
malformed:
|
||||
lldpd_chassis_cleanup(chassis, 1);
|
||||
lldpd_port_cleanup(port, 1);
|
||||
lldpd_chassis_cleanup(chassis, true);
|
||||
lldpd_port_cleanup(port, true);
|
||||
free(port);
|
||||
return -1;
|
||||
}
|
||||
|
@@ -45,7 +45,7 @@ lldpd_chassis_mgmt_cleanup(struct lldpd_chassis *chassis)
|
||||
}
|
||||
|
||||
void
|
||||
lldpd_chassis_cleanup(struct lldpd_chassis *chassis, int all)
|
||||
lldpd_chassis_cleanup(struct lldpd_chassis *chassis, bool all)
|
||||
{
|
||||
lldpd_chassis_mgmt_cleanup(chassis);
|
||||
VLOG_DBG("cleanup chassis %s",
|
||||
@@ -59,27 +59,26 @@ lldpd_chassis_cleanup(struct lldpd_chassis *chassis, int all)
|
||||
}
|
||||
|
||||
/* Cleanup a remote port. The before last argument, `expire` is a function that
|
||||
* should be called when a remote port is removed. If the last argument is 1,
|
||||
* all remote ports are removed.
|
||||
* should be called when a remote port is removed. If the last argument is
|
||||
* true, all remote ports are removed.
|
||||
*/
|
||||
void
|
||||
lldpd_remote_cleanup(struct lldpd_hardware *hw,
|
||||
void(*expire)(struct lldpd_hardware *,
|
||||
struct lldpd_port *),
|
||||
int all)
|
||||
bool all)
|
||||
{
|
||||
struct lldpd_port *port, *port_next;
|
||||
int del;
|
||||
time_t now = time_now();
|
||||
|
||||
VLOG_DBG("cleanup remote port on %s", hw->h_ifname);
|
||||
LIST_FOR_EACH_SAFE (port, port_next, p_entries, &hw->h_rports.p_entries) {
|
||||
del = all;
|
||||
bool del = all;
|
||||
if (!all && expire &&
|
||||
(now >= port->p_lastupdate + port->p_chassis->c_ttl)) {
|
||||
hw->h_ageout_cnt++;
|
||||
hw->h_delete_cnt++;
|
||||
del = 1;
|
||||
del = true;
|
||||
}
|
||||
if (del) {
|
||||
if (expire) {
|
||||
@@ -89,7 +88,7 @@ lldpd_remote_cleanup(struct lldpd_hardware *hw,
|
||||
if (!all) {
|
||||
list_remove(&port->p_entries);
|
||||
}
|
||||
lldpd_port_cleanup(port, 1);
|
||||
lldpd_port_cleanup(port, true);
|
||||
free(port);
|
||||
}
|
||||
}
|
||||
@@ -101,7 +100,7 @@ lldpd_remote_cleanup(struct lldpd_hardware *hw,
|
||||
/* If `all' is true, clear all information, including information that
|
||||
are not refreshed periodically. Port should be freed manually. */
|
||||
void
|
||||
lldpd_port_cleanup(struct lldpd_port *port, int all)
|
||||
lldpd_port_cleanup(struct lldpd_port *port, bool all)
|
||||
{
|
||||
/* We set these to NULL so we don't free wrong memory */
|
||||
|
||||
|
@@ -220,10 +220,10 @@ struct lldpd_neighbor_change {
|
||||
|
||||
/* Cleanup functions */
|
||||
void lldpd_chassis_mgmt_cleanup(struct lldpd_chassis *);
|
||||
void lldpd_chassis_cleanup(struct lldpd_chassis *, int);
|
||||
void lldpd_chassis_cleanup(struct lldpd_chassis *, bool all);
|
||||
void lldpd_remote_cleanup(struct lldpd_hardware *,
|
||||
void (*expire)(struct lldpd_hardware *, struct lldpd_port *), int);
|
||||
void lldpd_port_cleanup(struct lldpd_port *, int);
|
||||
void (*expire)(struct lldpd_hardware *, struct lldpd_port *), bool all);
|
||||
void lldpd_port_cleanup(struct lldpd_port *, bool all);
|
||||
void lldpd_config_cleanup(struct lldpd_config *);
|
||||
|
||||
#endif
|
||||
|
@@ -124,7 +124,7 @@ lldpd_hardware_cleanup(struct lldpd *cfg, struct lldpd_hardware *hardware)
|
||||
{
|
||||
VLOG_DBG("cleanup hardware port %s", hardware->h_ifname);
|
||||
|
||||
lldpd_port_cleanup(&hardware->h_lport, 1);
|
||||
lldpd_port_cleanup(&hardware->h_lport, true);
|
||||
if (hardware->h_ops && hardware->h_ops->cleanup) {
|
||||
hardware->h_ops->cleanup(cfg, hardware);
|
||||
}
|
||||
@@ -142,10 +142,10 @@ lldpd_cleanup(struct lldpd *cfg)
|
||||
LIST_FOR_EACH_SAFE (hw, hw_next, h_entries, &cfg->g_hardware.h_entries) {
|
||||
if (!hw->h_flags) {
|
||||
list_remove(&hw->h_entries);
|
||||
lldpd_remote_cleanup(hw, NULL, 1);
|
||||
lldpd_remote_cleanup(hw, NULL, true);
|
||||
lldpd_hardware_cleanup(cfg, hw);
|
||||
} else {
|
||||
lldpd_remote_cleanup(hw, NULL, 0);
|
||||
lldpd_remote_cleanup(hw, NULL, false);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -336,8 +336,8 @@ lldpd_decode(struct lldpd *cfg, char *frame, int s,
|
||||
} else if (count > cfg->g_config.c_max_neighbors - 1) {
|
||||
VLOG_DBG("too many neighbors for port %s, drop this new one",
|
||||
hw->h_ifname);
|
||||
lldpd_port_cleanup(port, 1);
|
||||
lldpd_chassis_cleanup(chassis, 1);
|
||||
lldpd_port_cleanup(port, true);
|
||||
lldpd_chassis_cleanup(chassis, true);
|
||||
free(port);
|
||||
return;
|
||||
}
|
||||
|
Reference in New Issue
Block a user