[ovs-dev] [PATCH 29/32] lldpd: Fix use of list of struct lldpd_chassis.
Ben Pfaff
blp at nicira.com
Mon Feb 23 05:20:21 UTC 2015
A list of some type should have type "struct ovs_list", not some other
type that encapsulates it.
Signed-off-by: Ben Pfaff <blp at nicira.com>
---
lib/lldp/lldpd.c | 10 +++++-----
lib/lldp/lldpd.h | 2 +-
lib/ovs-lldp.c | 10 +++++-----
3 files changed, 11 insertions(+), 11 deletions(-)
diff --git a/lib/lldp/lldpd.c b/lib/lldp/lldpd.c
index 8259e9d..d309f32 100644
--- a/lib/lldp/lldpd.c
+++ b/lib/lldp/lldpd.c
@@ -85,7 +85,7 @@ lldpd_alloc_hardware(struct lldpd *cfg, char *name, int index)
hw->h_cfg = cfg;
ovs_strlcpy(hw->h_ifname, name, sizeof hw->h_ifname);
hw->h_ifindex = index;
- hw->h_lport.p_chassis = CONTAINER_OF(list_front(&cfg->g_chassis.list),
+ hw->h_lport.p_chassis = CONTAINER_OF(list_front(&cfg->g_chassis),
struct lldpd_chassis, list);
hw->h_lport.p_chassis->c_refcount++;
list_init(&hw->h_rports);
@@ -149,7 +149,7 @@ lldpd_cleanup(struct lldpd *cfg)
VLOG_DBG("cleanup all chassis");
- LIST_FOR_EACH_SAFE (chassis, chassis_next, list, &cfg->g_chassis.list) {
+ LIST_FOR_EACH_SAFE (chassis, chassis_next, list, &cfg->g_chassis) {
if (chassis->c_refcount == 0) {
list_remove(&chassis->list);
lldpd_chassis_cleanup(chassis, 1);
@@ -343,7 +343,7 @@ lldpd_decode(struct lldpd *cfg, char *frame, int s,
bool found = false;
VLOG_DBG("MSAP is unknown, search for the chassis");
- LIST_FOR_EACH (ochassis, list, &cfg->g_chassis.list) {
+ LIST_FOR_EACH (ochassis, list, &cfg->g_chassis) {
if ((chassis->c_protocol == ochassis->c_protocol) &&
(chassis->c_id_subtype == ochassis->c_id_subtype) &&
(chassis->c_id_len == ochassis->c_id_len) &&
@@ -374,8 +374,8 @@ lldpd_decode(struct lldpd *cfg, char *frame, int s,
VLOG_DBG("unknown chassis, add it to the list");
chassis->c_index = ++cfg->g_lastrid;
chassis->c_refcount = 0;
- list_push_back(&cfg->g_chassis.list, &chassis->list);
- listsize = list_size(&cfg->g_chassis.list);
+ list_push_back(&cfg->g_chassis, &chassis->list);
+ listsize = list_size(&cfg->g_chassis);
VLOG_DBG("%"PRIuSIZE " different systems are known", listsize);
}
diff --git a/lib/lldp/lldpd.h b/lib/lldp/lldpd.h
index d25bb01..aa7665e 100644
--- a/lib/lldp/lldpd.h
+++ b/lib/lldp/lldpd.h
@@ -83,7 +83,7 @@ struct lldpd {
struct protocol *g_protocols;
int g_lastrid;
- struct lldpd_chassis g_chassis;
+ struct ovs_list g_chassis; /* Contains "struct lldp_chassis". */
struct lldpd_hardware g_hardware;
};
diff --git a/lib/ovs-lldp.c b/lib/ovs-lldp.c
index 5deee58..abea477 100644
--- a/lib/ovs-lldp.c
+++ b/lib/ovs-lldp.c
@@ -480,7 +480,7 @@ aa_configure(const struct aa_settings *s)
HMAP_FOR_EACH (lldp, hmap_node, all_lldps) {
struct lldpd_chassis *chassis;
- LIST_FOR_EACH (chassis, list, &lldp->lldpd->g_chassis.list) {
+ LIST_FOR_EACH (chassis, list, &lldp->lldpd->g_chassis) {
/* System Description */
free(chassis->c_descr);
chassis->c_descr = s->system_description[0] ?
@@ -803,8 +803,8 @@ lldp_create(const struct netdev *netdev,
lldp->lldpd->g_config.c_tx_hold;
lchassis->c_ttl = LLDP_CHASSIS_TTL;
lldpd_assign_cfg_to_protocols(lldp->lldpd);
- list_init(&lldp->lldpd->g_chassis.list);
- list_push_back(&lldp->lldpd->g_chassis.list, &lchassis->list);
+ list_init(&lldp->lldpd->g_chassis);
+ list_push_back(&lldp->lldpd->g_chassis, &lchassis->list);
if ((hw = lldpd_alloc_hardware(lldp->lldpd,
(char *) netdev_get_name(netdev),
@@ -895,8 +895,8 @@ lldp_create_dummy(void)
list_init(&lchassis->c_mgmt);
lchassis->c_ttl = LLDP_CHASSIS_TTL;
lldpd_assign_cfg_to_protocols(lldp->lldpd);
- list_init(&lldp->lldpd->g_chassis.list);
- list_push_back(&lldp->lldpd->g_chassis.list, &lchassis->list);
+ list_init(&lldp->lldpd->g_chassis);
+ list_push_back(&lldp->lldpd->g_chassis, &lchassis->list);
hw = lldpd_alloc_hardware(lldp->lldpd, "dummy-hw", 0);
--
2.1.3
More information about the dev
mailing list