Whamcloud - gitweb
LU-15983 lnet: Define KFILND network type
[fs/lustre-release.git] / libcfs / libcfs / util / nidstrings.c
index 7d13e47..780a8ab 100644 (file)
@@ -27,7 +27,6 @@
  */
 /*
  * This file is part of Lustre, http://www.lustre.org/
- * Lustre is a trademark of Sun Microsystems, Inc.
  *
  * libcfs/libcfs/util/nidstrings.c
  *
@@ -563,6 +562,18 @@ static struct netstrfns libcfs_netstrfns[] = {
                .nf_match_addr          = libcfs_num_match,
                .nf_min_max             = cfs_num_min_max,
                .nf_expand_addrrange    = libcfs_num_addr_range_expand
+       },
+       {
+               .nf_type                = KFILND,
+               .nf_name                = "kfi",
+               .nf_modname             = "kkfilnd",
+               .nf_addr2str            = libcfs_decnum_addr2str,
+               .nf_str2addr            = libcfs_num_str2addr,
+               .nf_parse_addrlist      = libcfs_num_parse,
+               .nf_print_addrlist      = libcfs_num_addr_range_print,
+               .nf_match_addr          = libcfs_num_match,
+               .nf_min_max             = cfs_num_min_max,
+               .nf_expand_addrrange    = libcfs_num_addr_range_expand
        }
 };
 
@@ -1230,19 +1241,6 @@ int cfs_match_nid(lnet_nid_t nid, struct list_head *nidlist)
        return 0;
 }
 
-static struct netstrfns *
-type2net_info(__u32 net_type)
-{
-       int i;
-
-       for (i = 0; i < libcfs_nnetstrfns; i++) {
-               if (libcfs_netstrfns[i].nf_type == net_type)
-                       return &libcfs_netstrfns[i];
-       }
-
-       return NULL;
-}
-
 int
 cfs_match_net(__u32 net_id, __u32 net_type, struct list_head *net_num_list)
 {
@@ -1271,30 +1269,6 @@ cfs_match_net(__u32 net_id, __u32 net_type, struct list_head *net_num_list)
        return 1;
 }
 
-int
-cfs_match_nid_net(lnet_nid_t nid, __u32 net_type,
-                 struct list_head *net_num_list,
-                 struct list_head *addr)
-{
-       __u32 address;
-       struct netstrfns *fns;
-
-       if (!addr || !net_num_list)
-               return 0;
-
-       fns = type2net_info(LNET_NETTYP(LNET_NIDNET(nid)));
-       if (!fns || !net_num_list || !addr)
-               return 0;
-
-       address = LNET_NIDADDR(nid);
-
-       /* if either the address or net number don't match then no match */
-       if (!fns->nf_match_addr(address, addr) ||
-           !cfs_match_net(LNET_NIDNET(nid), net_type, net_num_list))
-               return 0;
-
-       return 1;
-}
 /**
  * Print the network part of the nidrange \a nr into the specified \a buffer.
  *
@@ -1306,10 +1280,10 @@ cfs_print_network(char *buffer, int count, struct nidrange *nr)
        struct netstrfns *nf = nr->nr_netstrfns;
 
        if (nr->nr_netnum == 0)
-               return snprintf(buffer, count, "@%s", nf->nf_name);
+               return scnprintf(buffer, count, "@%s", nf->nf_name);
        else
-               return snprintf(buffer, count, "@%s%u",
-                                   nf->nf_name, nr->nr_netnum);
+               return scnprintf(buffer, count, "@%s%u",
+                                nf->nf_name, nr->nr_netnum);
 }