1From ed6a8e5a75f56b7034a46294a0bf2a9a7fd14fbc Mon Sep 17 00:00:00 2001 2From: Aaron Conole <aconole@redhat.com> 3Date: Fri, 23 Oct 2020 14:40:32 -0400 4Subject: [PATCH] lldp_head: remove all references 5 6There were a number of references missed during the module cleanup. This hits the remaining 7ones. 8 9Fixes: 07a83c583b9d ("lldp_head: rename and make extern") 10Signed-off-by: Aaron Conole <aconole@redhat.com> 11 12Reference to upstream patch: 13https://github.com/intel/openlldp/commit/ed6a8e5a75f56b7034a46294a0bf2a9a7fd14fbc 14 15Signed-off-by: Li Wang <li.wang@windriver.com> 16--- 17 ctrl_iface.c | 4 +--- 18 lldp_8021qaz.c | 11 +++++------ 19 lldp_8023.c | 6 ++---- 20 lldp_basman.c | 6 ++---- 21 lldp_evb.c | 6 ++---- 22 lldp_evb22.c | 6 ++---- 23 lldp_mand.c | 10 ++++------ 24 lldp_med.c | 6 ++---- 25 qbg_utils.c | 3 +-- 26 9 files changed, 21 insertions(+), 37 deletions(-) 27 28diff --git a/ctrl_iface.c b/ctrl_iface.c 29index 1734f49..666f7c8 100644 30--- a/ctrl_iface.c 31+++ b/ctrl_iface.c 32@@ -53,8 +53,6 @@ 33 #include "lldp_util.h" 34 #include "messages.h" 35 36-extern struct lldp_head lldp_head; 37- 38 struct ctrl_dst { 39 struct ctrl_dst *next; 40 struct sockaddr_un addr; 41@@ -116,7 +114,7 @@ int clif_iface_module(struct clif_data *clifd, 42 return cmd_invalid; 43 } 44 45- mod = find_module_by_id(&lldp_head, module_id); 46+ mod = find_module_by_id(&lldp_mod_head, module_id); 47 if (mod && mod->ops && mod->ops->client_cmd) 48 return (mod->ops->client_cmd)(clifd, from, fromlen, 49 cmd_start, cmd_len, rbuf+strlen(rbuf), rlen); 50diff --git a/lldp_8021qaz.c b/lldp_8021qaz.c 51index 16ae167..e747710 100644 52--- a/lldp_8021qaz.c 53+++ b/lldp_8021qaz.c 54@@ -48,7 +48,6 @@ 55 #include "lldp_dcbx.h" 56 57 58-struct lldp_head lldp_head; 59 extern config_t lldpad_cfg; 60 extern bool read_only_8021qaz; 61 62@@ -84,7 +83,7 @@ static int ieee8021qaz_check_pending(struct port *port, 63 if (!port->portEnabled) 64 return 0; 65 66- iud = find_module_user_data_by_id(&lldp_head, LLDP_MOD_8021QAZ); 67+ iud = find_module_user_data_by_id(&lldp_mod_head, LLDP_MOD_8021QAZ); 68 if (iud) { 69 LIST_FOREACH(tlv, &iud->head, entry) { 70 if (!strncmp(port->ifname, tlv->ifname, IFNAMSIZ)) { 71@@ -143,7 +142,7 @@ struct ieee8021qaz_tlvs *ieee8021qaz_data(const char *ifname) 72 struct ieee8021qaz_user_data *iud; 73 struct ieee8021qaz_tlvs *tlv = NULL; 74 75- iud = find_module_user_data_by_id(&lldp_head, LLDP_MOD_8021QAZ); 76+ iud = find_module_user_data_by_id(&lldp_mod_head, LLDP_MOD_8021QAZ); 77 if (iud) { 78 LIST_FOREACH(tlv, &iud->head, entry) { 79 if (!strncmp(tlv->ifname, ifname, IFNAMSIZ)) 80@@ -629,7 +628,7 @@ void ieee8021qaz_ifup(char *ifname, struct lldp_agent *agent) 81 LIST_INIT(&tlvs->app_head); 82 read_cfg_file(port->ifname, agent, tlvs); 83 84- iud = find_module_user_data_by_id(&lldp_head, LLDP_MOD_8021QAZ); 85+ iud = find_module_user_data_by_id(&lldp_mod_head, LLDP_MOD_8021QAZ); 86 LIST_INSERT_HEAD(&iud->head, tlvs, entry); 87 88 initialized: 89@@ -2179,7 +2178,7 @@ int ieee8021qaz_tlvs_rxed(const char *ifname) 90 struct ieee8021qaz_user_data *iud; 91 struct ieee8021qaz_tlvs *tlv = NULL; 92 93- iud = find_module_user_data_by_id(&lldp_head, LLDP_MOD_8021QAZ); 94+ iud = find_module_user_data_by_id(&lldp_mod_head, LLDP_MOD_8021QAZ); 95 if (iud) { 96 LIST_FOREACH(tlv, &iud->head, entry) { 97 if (!strncmp(tlv->ifname, ifname, IFNAMSIZ)) 98@@ -2198,7 +2197,7 @@ int ieee8021qaz_check_active(const char *ifname) 99 struct ieee8021qaz_user_data *iud; 100 struct ieee8021qaz_tlvs *tlv = NULL; 101 102- iud = find_module_user_data_by_id(&lldp_head, LLDP_MOD_8021QAZ); 103+ iud = find_module_user_data_by_id(&lldp_mod_head, LLDP_MOD_8021QAZ); 104 if (iud) { 105 LIST_FOREACH(tlv, &iud->head, entry) { 106 if (!strncmp(tlv->ifname, ifname, IFNAMSIZ)) 107diff --git a/lldp_8023.c b/lldp_8023.c 108index 422026e..8a03211 100644 109--- a/lldp_8023.c 110+++ b/lldp_8023.c 111@@ -39,8 +39,6 @@ 112 #include "lldp_8023_clif.h" 113 #include "lldp_8023_cmds.h" 114 115-extern struct lldp_head lldp_head; 116- 117 struct tlv_info_8023_maccfg { 118 u8 oui[3]; 119 u8 sub; 120@@ -84,7 +82,7 @@ static struct ieee8023_data *ieee8023_data(const char *ifname, enum agent_type t 121 struct ieee8023_user_data *ud; 122 struct ieee8023_data *bd = NULL; 123 124- ud = find_module_user_data_by_id(&lldp_head, LLDP_MOD_8023); 125+ ud = find_module_user_data_by_id(&lldp_mod_head, LLDP_MOD_8023); 126 if (ud) { 127 LIST_FOREACH(bd, &ud->head, entry) { 128 if (!strncmp(ifname, bd->ifname, IFNAMSIZ) && 129@@ -456,7 +454,7 @@ void ieee8023_ifup(char *ifname, struct lldp_agent *agent) 130 goto out_err; 131 } 132 133- ud = find_module_user_data_by_id(&lldp_head, LLDP_MOD_8023); 134+ ud = find_module_user_data_by_id(&lldp_mod_head, LLDP_MOD_8023); 135 LIST_INSERT_HEAD(&ud->head, bd, entry); 136 LLDPAD_INFO("%s:port %s added\n", __func__, ifname); 137 return; 138diff --git a/lldp_basman.c b/lldp_basman.c 139index a4f69c1..614e2a2 100644 140--- a/lldp_basman.c 141+++ b/lldp_basman.c 142@@ -75,8 +75,6 @@ struct tlv_info_manaddr { 143 struct tlv_info_maoid o; 144 } __attribute__ ((__packed__)); 145 146-extern struct lldp_head lldp_head; 147- 148 static const struct lldp_mod_ops basman_ops = { 149 .lldp_mod_register = basman_register, 150 .lldp_mod_unregister = basman_unregister, 151@@ -91,7 +89,7 @@ static struct basman_data *basman_data(const char *ifname, enum agent_type type) 152 struct basman_user_data *bud; 153 struct basman_data *bd = NULL; 154 155- bud = find_module_user_data_by_id(&lldp_head, LLDP_MOD_BASIC); 156+ bud = find_module_user_data_by_id(&lldp_mod_head, LLDP_MOD_BASIC); 157 if (bud) { 158 LIST_FOREACH(bd, &bud->head, entry) { 159 if (!strncmp(ifname, bd->ifname, IFNAMSIZ) && 160@@ -688,7 +686,7 @@ void basman_ifup(char *ifname, struct lldp_agent *agent) 161 goto out_err; 162 } 163 164- bud = find_module_user_data_by_id(&lldp_head, LLDP_MOD_BASIC); 165+ bud = find_module_user_data_by_id(&lldp_mod_head, LLDP_MOD_BASIC); 166 LIST_INSERT_HEAD(&bud->head, bd, entry); 167 LLDPAD_DBG("%s:port %s added\n", __func__, ifname); 168 return; 169diff --git a/lldp_evb.c b/lldp_evb.c 170index dcdcc7e..a8f3965 100644 171--- a/lldp_evb.c 172+++ b/lldp_evb.c 173@@ -36,14 +36,12 @@ 174 #include "messages.h" 175 #include "config.h" 176 177-extern struct lldp_head lldp_head; 178- 179 struct evb_data *evb_data(char *ifname, enum agent_type type) 180 { 181 struct evb_user_data *ud; 182 struct evb_data *ed = NULL; 183 184- ud = find_module_user_data_by_id(&lldp_head, LLDP_MOD_EVB); 185+ ud = find_module_user_data_by_id(&lldp_mod_head, LLDP_MOD_EVB); 186 if (ud) { 187 LIST_FOREACH(ed, &ud->head, entry) { 188 if (!strncmp(ifname, ed->ifname, IFNAMSIZ) && 189@@ -347,7 +345,7 @@ static void evb_ifup(char *ifname, struct lldp_agent *agent) 190 191 evb_init_tlv(ed, agent); 192 193- ud = find_module_user_data_by_id(&lldp_head, LLDP_MOD_EVB); 194+ ud = find_module_user_data_by_id(&lldp_mod_head, LLDP_MOD_EVB); 195 LIST_INSERT_HEAD(&ud->head, ed, entry); 196 LLDPAD_DBG("%s:%s agent %d added\n", __func__, ifname, agent->type); 197 } 198diff --git a/lldp_evb22.c b/lldp_evb22.c 199index 76ba883..6e92d9d 100644 200--- a/lldp_evb22.c 201+++ b/lldp_evb22.c 202@@ -37,14 +37,12 @@ 203 #include "messages.h" 204 #include "config.h" 205 206-extern struct lldp_head lldp_head; 207- 208 struct evb22_data *evb22_data(char *ifname, enum agent_type type) 209 { 210 struct evb22_user_data *ud; 211 struct evb22_data *ed = NULL; 212 213- ud = find_module_user_data_by_id(&lldp_head, LLDP_MOD_EVB22); 214+ ud = find_module_user_data_by_id(&lldp_mod_head, LLDP_MOD_EVB22); 215 if (ud) { 216 LIST_FOREACH(ed, &ud->head, entry) { 217 if (!strncmp(ifname, ed->ifname, IFNAMSIZ) && 218@@ -453,7 +451,7 @@ static void evb22_ifup(char *ifname, struct lldp_agent *agent) 219 STRNCPY_TERMINATED(ed->ifname, ifname, IFNAMSIZ); 220 ed->agenttype = agent->type; 221 evb22_init_tlv(ed, agent); 222- ud = find_module_user_data_by_id(&lldp_head, LLDP_MOD_EVB22); 223+ ud = find_module_user_data_by_id(&lldp_mod_head, LLDP_MOD_EVB22); 224 LIST_INSERT_HEAD(&ud->head, ed, entry); 225 LLDPAD_DBG("%s:%s agent %d added\n", __func__, ifname, agent->type); 226 } 227diff --git a/lldp_mand.c b/lldp_mand.c 228index 0db63cb..b857a88 100644 229--- a/lldp_mand.c 230+++ b/lldp_mand.c 231@@ -42,8 +42,6 @@ 232 #include "lldp/l2_packet.h" 233 #include "lldp_tlv.h" 234 235-extern struct lldp_head lldp_head; 236- 237 static const struct lldp_mod_ops mand_ops = { 238 .lldp_mod_register = mand_register, 239 .lldp_mod_unregister = mand_unregister, 240@@ -59,7 +57,7 @@ struct mand_data *mand_data(const char *ifname, enum agent_type type) 241 struct mand_user_data *mud; 242 struct mand_data *md = NULL; 243 244- mud = find_module_user_data_by_id(&lldp_head, LLDP_MOD_MAND); 245+ mud = find_module_user_data_by_id(&lldp_mod_head, LLDP_MOD_MAND); 246 if (mud) { 247 LIST_FOREACH(md, &mud->head, entry) { 248 if (!strncmp(ifname, md->ifname, IFNAMSIZ) && 249@@ -608,7 +606,7 @@ void mand_ifup(char *ifname, struct lldp_agent *agent) 250 STRNCPY_TERMINATED(md->ifname, ifname, IFNAMSIZ); 251 md->agenttype = agent->type; 252 253- mud = find_module_user_data_by_id(&lldp_head, LLDP_MOD_MAND); 254+ mud = find_module_user_data_by_id(&lldp_mod_head, LLDP_MOD_MAND); 255 LIST_INSERT_HEAD(&mud->head, md, entry); 256 } 257 258@@ -636,7 +634,7 @@ struct lldp_module *mand_register(void) 259 LLDPAD_ERR("failed to malloc LLDP Mandatory module data\n"); 260 goto out_err; 261 } 262- mud = malloc(sizeof(struct mand_user_data)); 263+ mud = malloc(sizeof(struct mand_user_data)); 264 if (!mud) { 265 free(mod); 266 LLDPAD_ERR("failed to malloc LLDP Mandatory module user data\n"); 267@@ -644,8 +642,8 @@ struct lldp_module *mand_register(void) 268 } 269 LIST_INIT(&mud->head); 270 mod->id = LLDP_MOD_MAND; 271+ mod->data = mud; 272 mod->ops = &mand_ops; 273- mod->data = mud; 274 LLDPAD_INFO("%s:done\n", __func__); 275 return mod; 276 out_err: 277diff --git a/lldp_med.c b/lldp_med.c 278index f6c373e..7b6996e 100644 279--- a/lldp_med.c 280+++ b/lldp_med.c 281@@ -40,8 +40,6 @@ 282 #include "lldp_mand_clif.h" 283 #include "lldp_med_cmds.h" 284 285-extern struct lldp_head lldp_head; 286- 287 struct tlv_info_medcaps { 288 u8 oui[OUI_SIZE]; 289 u8 subtype; 290@@ -95,7 +93,7 @@ static struct med_data *med_data(const char *ifname, enum agent_type type) 291 struct med_user_data *mud; 292 struct med_data *md = NULL; 293 294- mud = find_module_user_data_by_id(&lldp_head, LLDP_MOD_MED); 295+ mud = find_module_user_data_by_id(&lldp_mod_head, LLDP_MOD_MED); 296 if (mud) { 297 LIST_FOREACH(md, &mud->head, entry) { 298 if (!strncmp(ifname, md->ifname, IFNAMSIZ) && 299@@ -914,7 +912,7 @@ void med_ifup(char *ifname, struct lldp_agent *agent) 300 free(md); 301 goto out_err; 302 } 303- mud = find_module_user_data_by_id(&lldp_head, LLDP_MOD_MED); 304+ mud = find_module_user_data_by_id(&lldp_mod_head, LLDP_MOD_MED); 305 LIST_INSERT_HEAD(&mud->head, md, entry); 306 LLDPAD_INFO("%s:port %s added\n", __func__, ifname); 307 return; 308diff --git a/qbg_utils.c b/qbg_utils.c 309index 9daeade..0d40c5b 100644 310--- a/qbg_utils.c 311+++ b/qbg_utils.c 312@@ -36,7 +36,6 @@ 313 #include "qbg_utils.h" 314 315 extern int loglvl; /* Global lldpad log level */ 316-extern struct lldp_head lldp_head; 317 318 /* 319 * hexdump_frame - print raw evb/ecp/vdp frame 320@@ -73,7 +72,7 @@ void hexdump_frame(const char *ifname, char *txt, const unsigned char *buf, 321 */ 322 int modules_notify(int id, int sender_id, char *ifname, void *data) 323 { 324- struct lldp_module *mp = find_module_by_id(&lldp_head, id); 325+ struct lldp_module *mp = find_module_by_id(&lldp_mod_head, id); 326 int rc = 0; 327 328 if (mp && mp->ops->lldp_mod_notify) 329-- 3302.18.1 331 332