]> git.puffer.fish Git - mirror/frr.git/commitdiff
isisd: changes for code maintainability 11869/head
authorsri-mohan1 <sri.mohan@samsung.com>
Mon, 29 Aug 2022 06:53:46 +0000 (12:23 +0530)
committersri-mohan1 <sri.mohan@samsung.com>
Mon, 29 Aug 2022 06:57:03 +0000 (12:27 +0530)
these changes are for improving the code maintainability

Signed-off-by: sri-mohan1 <sri.mohan@samsung.com>
isisd/isis_adjacency.c
isisd/isis_bpf.c
isisd/isis_circuit.c
isisd/isis_dlpi.c
isisd/isis_dr.c

index 86cf10ae1796bcb9744ae1c2c81ae230629af234..00763135e69e28912ce6742bf7fc3874988ba87e 100644 (file)
@@ -860,13 +860,13 @@ void isis_adj_build_neigh_list(struct list *adjdb, struct list *list)
        struct listnode *node;
 
        if (!list) {
-               zlog_warn("isis_adj_build_neigh_list(): NULL list");
+               zlog_warn("%s: NULL list", __func__);
                return;
        }
 
        for (ALL_LIST_ELEMENTS_RO(adjdb, node, adj)) {
                if (!adj) {
-                       zlog_warn("isis_adj_build_neigh_list(): NULL adj");
+                       zlog_warn("%s: NULL adj", __func__);
                        return;
                }
 
@@ -883,18 +883,18 @@ void isis_adj_build_up_list(struct list *adjdb, struct list *list)
        struct listnode *node;
 
        if (adjdb == NULL) {
-               zlog_warn("isis_adj_build_up_list(): adjacency DB is empty");
+               zlog_warn("%s: adjacency DB is empty", __func__);
                return;
        }
 
        if (!list) {
-               zlog_warn("isis_adj_build_up_list(): NULL list");
+               zlog_warn("%s: NULL list", __func__);
                return;
        }
 
        for (ALL_LIST_ELEMENTS_RO(adjdb, node, adj)) {
                if (!adj) {
-                       zlog_warn("isis_adj_build_up_list(): NULL adj");
+                       zlog_warn("%s: NULL adj", __func__);
                        return;
                }
 
index 5f3d70ed3a02b98ae75bf0b0196cc542beceb8b3..11f43279ec2784f1df930eab4403afad3c884e92 100644 (file)
@@ -165,7 +165,7 @@ static int open_bpf_dev(struct isis_circuit *circuit)
        bpf_prog.bf_len = 8;
        bpf_prog.bf_insns = &(llcfilter[0]);
        if (ioctl(fd, BIOCSETF, (caddr_t)&bpf_prog) < 0) {
-               zlog_warn("open_bpf_dev(): failed to install filter: %s",
+               zlog_warn("%s: failed to install filter: %s", __func__,
                          safe_strerror(errno));
                return ISIS_WARNING;
        }
@@ -198,7 +198,7 @@ int isis_sock_init(struct isis_circuit *circuit)
                        circuit->tx = isis_send_pdu_bcast;
                        circuit->rx = isis_recv_pdu_bcast;
                } else {
-                       zlog_warn("isis_sock_init(): unknown circuit type");
+                       zlog_warn("%s: unknown circuit type", __func__);
                        retval = ISIS_WARNING;
                        break;
                }
@@ -223,8 +223,8 @@ int isis_recv_pdu_bcast(struct isis_circuit *circuit, uint8_t *ssnpa)
                bytesread = read(circuit->fd, readbuff, readblen);
        }
        if (bytesread < 0) {
-               zlog_warn("isis_recv_pdu_bcast(): read() failed: %s",
-                               safe_strerror(errno));
+               zlog_warn("%s: read() failed: %s", __func__,
+                         safe_strerror(errno));
                return ISIS_WARNING;
        }
 
@@ -267,8 +267,9 @@ int isis_send_pdu_bcast(struct isis_circuit *circuit, int level)
        buflen = stream_get_endp(circuit->snd_stream) + LLC_LEN + ETHER_HDR_LEN;
        if (buflen > sizeof(sock_buff)) {
                zlog_warn(
-                       "isis_send_pdu_bcast: sock_buff size %zu is less than output pdu size %zu on circuit %s",
-                       sizeof(sock_buff), buflen, circuit->interface->name);
+                       "%s: sock_buff size %zu is less than output pdu size %zu on circuit %s",
+                       __func__, sizeof(sock_buff), buflen,
+                       circuit->interface->name);
                return ISIS_WARNING;
        }
 
index 9e97e489373a6c2f75924e0c7a2203c3a89baaa3..178fbe790374a7a862944c1fbc06d2b65daa765f 100644 (file)
@@ -513,7 +513,7 @@ void isis_circuit_if_add(struct isis_circuit *circuit, struct interface *ifp)
        } else {
                /* It's normal in case of loopback etc. */
                if (IS_DEBUG_EVENTS)
-                       zlog_debug("isis_circuit_if_add: unsupported media");
+                       zlog_debug("%s: unsupported media", __func__);
                circuit->circ_type = CIRCUIT_T_UNKNOWN;
        }
 
@@ -678,10 +678,10 @@ int isis_circuit_up(struct isis_circuit *circuit)
                }
 #ifdef EXTREME_DEGUG
                if (IS_DEBUG_EVENTS)
-                       zlog_debug(
-                               "isis_circuit_if_add: if_id %d, isomtu %d snpa %s",
-                               circuit->interface->ifindex, ISO_MTU(circuit),
-                               snpa_print(circuit->u.bc.snpa));
+                       zlog_debug("%s: if_id %d, isomtu %d snpa %s", __func__,
+                                  circuit->interface->ifindex,
+                                  ISO_MTU(circuit),
+                                  snpa_print(circuit->u.bc.snpa));
 #endif /* EXTREME_DEBUG */
 
                circuit->u.bc.adjdb[0] = list_new();
index bb8c54259768e97a57b17320ee42c2e7e21e7fed..f6ea0aea60d2a82cd1683b5156fa7ff384757615 100644 (file)
@@ -336,9 +336,8 @@ static int open_dlpi_dev(struct isis_circuit *circuit)
 
                /* Double check the DLPI style */
                if (dia->dl_provider_style != DL_STYLE2) {
-                       zlog_warn(
-                               "open_dlpi_dev(): interface %s: %s is not style 2",
-                               circuit->interface->name, devpath);
+                       zlog_warn("%s: interface %s: %s is not style 2",
+                                 __func__, circuit->interface->name, devpath);
                        close(fd);
                        return ISIS_WARNING;
                }
@@ -355,9 +354,8 @@ static int open_dlpi_dev(struct isis_circuit *circuit)
        } else {
                /* Double check the DLPI style */
                if (dia->dl_provider_style != DL_STYLE1) {
-                       zlog_warn(
-                               "open_dlpi_dev(): interface %s: %s is not style 1",
-                               circuit->interface->name, devpath);
+                       zlog_warn("%s: interface %s: %s is not style 1",
+                                 __func__, circuit->interface->name, devpath);
                        close(fd);
                        return ISIS_WARNING;
                }
@@ -404,9 +402,8 @@ static int open_dlpi_dev(struct isis_circuit *circuit)
         * so we need to be careful and use DL_PHYS_ADDR_REQ instead.
         */
        if (dlpiaddr(fd, circuit->u.bc.snpa) == -1) {
-               zlog_warn(
-                       "open_dlpi_dev(): interface %s: unable to get MAC address",
-                       circuit->interface->name);
+               zlog_warn("%s: interface %s: unable to get MAC address",
+                         __func__, circuit->interface->name);
                close(fd);
                return ISIS_WARNING;
        }
@@ -479,7 +476,7 @@ int isis_sock_init(struct isis_circuit *circuit)
                        circuit->tx = isis_send_pdu_bcast;
                        circuit->rx = isis_recv_pdu_bcast;
                } else {
-                       zlog_warn("isis_sock_init(): unknown circuit type");
+                       zlog_warn("%s: unknown circuit type", __func__);
                        retval = ISIS_WARNING;
                        break;
                }
@@ -511,7 +508,7 @@ int isis_recv_pdu_bcast(struct isis_circuit *circuit, uint8_t *ssnpa)
        retv = getmsg(circuit->fd, &ctlbuf, &databuf, &flags);
 
        if (retv < 0) {
-               zlog_warn("isis_recv_pdu_bcast: getmsg failed: %s",
+               zlog_warn("%s: getmsg failed: %s", __func__,
                          safe_strerror(errno));
                return ISIS_WARNING;
        }
@@ -561,8 +558,9 @@ int isis_send_pdu_bcast(struct isis_circuit *circuit, int level)
        buflen = stream_get_endp(circuit->snd_stream) + LLC_LEN;
        if ((size_t)buflen > sizeof(sock_buff)) {
                zlog_warn(
-                       "isis_send_pdu_bcast: sock_buff size %zu is less than output pdu size %d on circuit %s",
-                       sizeof(sock_buff), buflen, circuit->interface->name);
+                       "%s: sock_buff size %zu is less than output pdu size %d on circuit %s",
+                       __func__, sizeof(sock_buff), buflen,
+                       circuit->interface->name);
                return ISIS_WARNING;
        }
 
index b9bf49867d09568b45baba57ac3b89edcf7b7dd3..400982f2fc16025f2e1a75389bd8184fe918426f 100644 (file)
@@ -80,7 +80,8 @@ void isis_run_dr(struct thread *thread)
        }
 
        if (circuit->u.bc.run_dr_elect[level - 1])
-               zlog_warn("isis_run_dr(): run_dr_elect already set for l%d", level);
+               zlog_warn("%s: run_dr_elect already set for l%d", __func__,
+                         level);
 
        circuit->u.bc.t_run_dr[level - 1] = NULL;
        circuit->u.bc.run_dr_elect[level - 1] = 1;
@@ -126,7 +127,7 @@ int isis_dr_elect(struct isis_circuit *circuit, int level)
        adjdb = circuit->u.bc.adjdb[level - 1];
 
        if (!adjdb) {
-               zlog_warn("isis_dr_elect() adjdb == NULL");
+               zlog_warn("%s adjdb == NULL", __func__);
                list_delete(&list);
                return ISIS_WARNING;
        }
@@ -155,7 +156,8 @@ int isis_dr_elect(struct isis_circuit *circuit, int level)
                                }
                                if (cmp_res == 0)
                                        zlog_warn(
-                                               "isis_dr_elect(): multiple adjacencies with same SNPA");
+                                               "%s: multiple adjacencies with same SNPA",
+                                               __func__);
                        } else {
                                adj_dr = adj;
                        }
@@ -218,7 +220,7 @@ int isis_dr_resign(struct isis_circuit *circuit, int level)
        uint8_t id[ISIS_SYS_ID_LEN + 2];
 
        if (IS_DEBUG_EVENTS)
-               zlog_debug("isis_dr_resign l%d", level);
+               zlog_debug("%s l%d", __func__, level);
 
        circuit->u.bc.is_dr[level - 1] = 0;
        circuit->u.bc.run_dr_elect[level - 1] = 0;
@@ -266,7 +268,7 @@ int isis_dr_commence(struct isis_circuit *circuit, int level)
        uint8_t old_dr[ISIS_SYS_ID_LEN + 2];
 
        if (IS_DEBUG_EVENTS)
-               zlog_debug("isis_dr_commence l%d", level);
+               zlog_debug("%s l%d", __func__, level);
 
        /* Lets keep a pause in DR election */
        circuit->u.bc.run_dr_elect[level - 1] = 0;