Whamcloud - gitweb
LU-17844 lnet: remove a few LCONSOLE_ERROR_MSG() 97/55097/2
authorTimothy Day <timday@amazon.com>
Tue, 14 May 2024 01:12:05 +0000 (01:12 +0000)
committerOleg Drokin <green@whamcloud.com>
Wed, 29 May 2024 04:51:26 +0000 (04:51 +0000)
These magic numbers aren't so magical anymore. Just
use LCONSOLE_ERROR().

Test-Parameters: trivial
Signed-off-by: Timothy Day <timday@amazon.com>
Change-Id: I6c1d46449487127545d785a9fdc368005197d3e2
Reviewed-on: https://review.whamcloud.com/c/fs/lustre-release/+/55097
Tested-by: jenkins <devops@whamcloud.com>
Tested-by: Maloo <maloo@whamcloud.com>
Reviewed-by: Andreas Dilger <adilger@whamcloud.com>
Reviewed-by: James Simmons <jsimmons@infradead.org>
Reviewed-by: Oleg Drokin <green@whamcloud.com>
lnet/lnet/acceptor.c
lnet/lnet/config.c
lnet/lnet/router.c

index 0b01a7d..732fa63 100644 (file)
@@ -88,25 +88,21 @@ lnet_connect_console_error(int rc, struct lnet_nid *peer_nid,
                        libcfs_nidstr(peer_nid), sa);
                break;
        case -ECONNRESET:
-               LCONSOLE_ERROR_MSG(0x11b,
-                                  "Connection to %s at host %pIScp was reset: is it running a compatible version of Lustre and is %s one of its NIDs?\n",
-                                  libcfs_nidstr(peer_nid), sa,
-                                  libcfs_nidstr(peer_nid));
+               LCONSOLE_ERROR("Connection to %s at host %pIScp was reset: is it running a compatible version of Lustre and is %s one of its NIDs?\n",
+                              libcfs_nidstr(peer_nid), sa,
+                              libcfs_nidstr(peer_nid));
                break;
        case -EPROTO:
-               LCONSOLE_ERROR_MSG(0x11c,
-                                  "Protocol error connecting to %s at host %pIScp: is it running a compatible version of Lustre?\n",
-                                  libcfs_nidstr(peer_nid), sa);
+               LCONSOLE_ERROR("Protocol error connecting to %s at host %pIScp: is it running a compatible version of Lustre?\n",
+                              libcfs_nidstr(peer_nid), sa);
                break;
        case -EADDRINUSE:
-               LCONSOLE_ERROR_MSG(0x11d,
-                                  "No privileged ports available to connect to %s at host %pIScp\n",
-                                  libcfs_nidstr(peer_nid), sa);
+               LCONSOLE_ERROR("No privileged ports available to connect to %s at host %pIScp\n",
+                              libcfs_nidstr(peer_nid), sa);
                break;
        default:
-               LCONSOLE_ERROR_MSG(0x11e,
-                                  "Unexpected error %d connecting to %s at host %pIScp\n",
-                                  rc, libcfs_nidstr(peer_nid), sa);
+               LCONSOLE_ERROR("Unexpected error %d connecting to %s at host %pIScp\n",
+                              rc, libcfs_nidstr(peer_nid), sa);
                break;
        }
 }
@@ -233,9 +229,8 @@ lnet_accept(struct socket *sock, __u32 magic)
                else
                        str = "unrecognised";
 
-               LCONSOLE_ERROR_MSG(0x11f, "Refusing connection from %pISc"
-                                  " magic %08x: %s acceptor protocol\n",
-                                  &peer, magic, str);
+               LCONSOLE_ERROR("Refusing connection from %pISc magic %08x: %s acceptor protocol\n",
+                              &peer, magic, str);
                return -EPROTO;
        }
 
@@ -311,18 +306,16 @@ lnet_accept(struct socket *sock, __u32 magic)
                /* right NET, wrong NID! */
                if (ni != NULL)
                        lnet_ni_decref(ni);
-               LCONSOLE_ERROR_MSG(0x120,
-                                  "Refusing connection from %pISc for %s: No matching NI\n",
-                                  &peer, libcfs_nidstr(&nid));
+               LCONSOLE_ERROR("Refusing connection from %pISc for %s: No matching NI\n",
+                              &peer, libcfs_nidstr(&nid));
                return -EPERM;
        }
 
        if (ni->ni_net->net_lnd->lnd_accept == NULL) {
                /* This catches a request for the loopback LND */
                lnet_ni_decref(ni);
-               LCONSOLE_ERROR_MSG(0x121,
-                                  "Refusing connection from %pISc for %s: NI doesn not accept IP connections\n",
-                                 &peer, libcfs_nidstr(&nid));
+               LCONSOLE_ERROR("Refusing connection from %pISc for %s: NI doesn not accept IP connections\n",
+                              &peer, libcfs_nidstr(&nid));
                return -EPERM;
        }
 
@@ -369,13 +362,11 @@ lnet_acceptor(void *arg)
        if (IS_ERR(lnet_acceptor_state.pta_sock)) {
                rc = PTR_ERR(lnet_acceptor_state.pta_sock);
                if (rc == -EADDRINUSE)
-                       LCONSOLE_ERROR_MSG(0x122, "Can't start acceptor on port"
-                                          " %d: port already in use\n",
-                                          accept_port);
+                       LCONSOLE_ERROR("Can't start acceptor on port %d: port already in use\n",
+                                      accept_port);
                else
-                       LCONSOLE_ERROR_MSG(0x123, "Can't start acceptor on port "
-                                          "%d: unexpected error %d\n",
-                                          accept_port, rc);
+                       LCONSOLE_ERROR("Can't start acceptor on port %d: unexpected error %d\n",
+                                      accept_port, rc);
 
                lnet_acceptor_state.pta_sock = NULL;
        } else {
@@ -478,8 +469,7 @@ accept2secure(const char *acc, long *sec)
        } else if (!strcmp(acc, "none")) {
                return 0;
        } else {
-               LCONSOLE_ERROR_MSG(0x124, "Can't parse 'accept=\"%s\"'\n",
-                                  acc);
+               LCONSOLE_ERROR("Can't parse 'accept=\"%s\"'\n", acc);
                return -EINVAL;
        }
 }
index fcdf3d6..4f25683 100644 (file)
@@ -41,14 +41,14 @@ lnet_syntax(const char *name, const char *str, int offset, int width)
        memset(dashes, '-', sizeof(dashes));
        dashes[sizeof(dashes)-1] = 0;
 
-       LCONSOLE_ERROR_MSG(0x10f, "Error parsing '%s=\"%s\"'\n", name, str);
-       LCONSOLE_ERROR_MSG(0x110, "here...........%.*s..%.*s|%.*s|\n",
-                          (int)strlen(name), dots, offset, dots,
-                           (width < 1) ? 0 : width - 1, dashes);
+       LCONSOLE_ERROR("Error parsing '%s=\"%s\"'\n", name, str);
+       LCONSOLE_ERROR("here...........%.*s..%.*s|%.*s|\n",
+                      (int)strlen(name), dots, offset, dots,
+                      (width < 1) ? 0 : width - 1, dashes);
 }
 
 static int
-lnet_issep (char c)
+lnet_issep(char c)
 {
        switch (c) {
        case '\n':
@@ -366,10 +366,10 @@ int lnet_ni_add_interface(struct lnet_ni *ni, char *iface)
                return -ENOMEM;
 
        if (ni->ni_interface != NULL) {
-               LCONSOLE_ERROR_MSG(0x115, "%s: interface %s already set for net %s: rc = %d\n",
-                                  iface, ni->ni_interface,
-                                  libcfs_net2str(LNET_NID_NET(&ni->ni_nid)),
-                                  -EINVAL);
+               LCONSOLE_ERROR("%s: interface %s already set for net %s: rc = %d\n",
+                              iface, ni->ni_interface,
+                              libcfs_net2str(LNET_NID_NET(&ni->ni_nid)),
+                              -EINVAL);
                return -EINVAL;
        }
 
@@ -562,8 +562,7 @@ lnet_parse_networks(struct list_head *netlist, const char *networks)
 
        if (strlen(networks) > LNET_SINGLE_TEXTBUF_NOB) {
                /* _WAY_ conservative */
-               LCONSOLE_ERROR_MSG(0x112, "Can't parse networks: string too "
-                                  "long\n");
+               LCONSOLE_ERROR("Can't parse networks: string too long\n");
                return -EINVAL;
        }
 
@@ -657,8 +656,7 @@ lnet_parse_networks(struct list_head *netlist, const char *networks)
                 */
                net_id = libcfs_str2net(name);
                if (net_id == LNET_NET_ANY) {
-                       LCONSOLE_ERROR_MSG(0x113,
-                                       "Unrecognised network type\n");
+                       LCONSOLE_ERROR("Unrecognised network type\n");
                        str = name;
                        goto failed_syntax;
                }
@@ -1581,12 +1579,10 @@ lnet_parse_ip2nets(const char **networksp, const char *ip2nets)
                                          the_lnet.ln_nis_use_large_nids);
        if (nip < 0) {
                if (nip != -ENOENT) {
-                       LCONSOLE_ERROR_MSG(0x117,
-                                          "Error %d enumerating local IP interfaces for ip2nets to match\n",
+                       LCONSOLE_ERROR("Error %d enumerating local IP interfaces for ip2nets to match\n",
                                           nip);
                } else {
-                       LCONSOLE_ERROR_MSG(0x118,
-                                          "No local IP interfaces for ip2nets to match\n");
+                       LCONSOLE_ERROR("No local IP interfaces for ip2nets to match\n");
                }
                return nip;
        }
@@ -1604,10 +1600,9 @@ lnet_parse_ip2nets(const char **networksp, const char *ip2nets)
 
        rc = lnet_match_networks(networksp, ip2nets, ipaddrs, nip);
        if (rc < 0) {
-               LCONSOLE_ERROR_MSG(0x119, "Error %d parsing ip2nets\n", rc);
+               LCONSOLE_ERROR("Error %d parsing ip2nets\n", rc);
        } else if (rc == 0) {
-               LCONSOLE_ERROR_MSG(0x11a, "ip2nets does not match "
-                                  "any local IP interfaces\n");
+               LCONSOLE_ERROR("ip2nets does not match any local IP interfaces\n");
                rc = -ENOENT;
        }
        CFS_FREE_PTR_ARRAY(ipaddrs, nip);
index f608e49..6bc84b6 100644 (file)
@@ -1394,9 +1394,8 @@ lnet_nrb_tiny_calculate(void)
        int nrbs = LNET_NRB_TINY;
 
        if (tiny_router_buffers < 0) {
-               LCONSOLE_ERROR_MSG(0x10c,
-                                  "tiny_router_buffers=%d invalid when "
-                                  "routing enabled\n", tiny_router_buffers);
+               LCONSOLE_ERROR("tiny_router_buffers=%d invalid when routing enabled\n",
+                              tiny_router_buffers);
                return -EINVAL;
        }
 
@@ -1417,9 +1416,8 @@ lnet_nrb_small_calculate(void)
        int nrbs = LNET_NRB_SMALL;
 
        if (small_router_buffers < 0) {
-               LCONSOLE_ERROR_MSG(0x10c,
-                                  "small_router_buffers=%d invalid when "
-                                  "routing enabled\n", small_router_buffers);
+               LCONSOLE_ERROR("small_router_buffers=%d invalid when routing enabled\n",
+                              small_router_buffers);
                return -EINVAL;
        }
 
@@ -1440,9 +1438,8 @@ lnet_nrb_large_calculate(void)
        int nrbs = LNET_NRB_LARGE;
 
        if (large_router_buffers < 0) {
-               LCONSOLE_ERROR_MSG(0x10c,
-                                  "large_router_buffers=%d invalid when "
-                                  "routing enabled\n", large_router_buffers);
+               LCONSOLE_ERROR("large_router_buffers=%d invalid when routing enabled\n",
+                              large_router_buffers);
                return -EINVAL;
        }
 
@@ -1478,9 +1475,8 @@ lnet_rtrpools_alloc(int im_a_router)
                /* explicitly enabled */
        } else {
                rc = -EINVAL;
-               LCONSOLE_ERROR_MSG(0x10b,
-                                  "lnet: forwarding='%s' not set to either 'enabled' or 'disabled': rc = %d\n",
-                                  forwarding, rc);
+               LCONSOLE_ERROR("lnet: forwarding='%s' not set to either 'enabled' or 'disabled': rc = %d\n",
+                              forwarding, rc);
                return rc;
        }
 
@@ -1501,9 +1497,8 @@ lnet_rtrpools_alloc(int im_a_router)
                                                sizeof(struct lnet_rtrbufpool));
        if (the_lnet.ln_rtrpools == NULL) {
                rc = -ENOMEM;
-               LCONSOLE_ERROR_MSG(0x10c,
-                       "lnet: error allocating router buffer pool: rc = %d\n",
-                       rc);
+               LCONSOLE_ERROR("lnet: error allocating router buffer pool: rc = %d\n",
+                              rc);
                return rc;
        }