Whamcloud - gitweb
LU-748 test: shorten the runtime of sanity subtest_220
[fs/lustre-release.git] / libcfs / libcfs / nidstrings.c
index fa8ca85..9f75501 100644 (file)
@@ -78,8 +78,8 @@ void libcfs_init_nidstrings (void)
 # define NIDSTR_LOCK(f)   cfs_spin_lock_irqsave(&libcfs_nidstring_lock, f)
 # define NIDSTR_UNLOCK(f) cfs_spin_unlock_irqrestore(&libcfs_nidstring_lock, f)
 #else
-# define NIDSTR_LOCK(f)   (f=0)                 /* avoid unused var warnings */
-# define NIDSTR_UNLOCK(f) (f=0)
+# define NIDSTR_LOCK(f)   (f=sizeof(f))  /* avoid set-but-unused warnings */
+# define NIDSTR_UNLOCK(f) (f=sizeof(f))
 #endif
 
 static char *
@@ -206,6 +206,13 @@ static struct netstrfns  libcfs_netstrfns[] = {
          /* .nf_str2addr  */  libcfs_num_str2addr,
          /* .nf_parse_addrlist*/  libcfs_num_parse,
          /* .nf_match_addr*/  libcfs_num_match},
+        {/* .nf_type      */  GNILND,
+         /* .nf_name      */  "gni",
+         /* .nf_modname   */  "kgnilnd",
+         /* .nf_addr2str  */  libcfs_decnum_addr2str,
+         /* .nf_str2addr  */  libcfs_num_str2addr,
+         /* .nf_parse_addrlist*/  libcfs_num_parse,
+         /* .nf_match_addr*/  libcfs_num_match},
         /* placeholder for net0 alias.  It MUST BE THE LAST ENTRY */
         {/* .nf_type      */  -1},
 };
@@ -434,7 +441,7 @@ libcfs_nid2str(lnet_nid_t nid)
         int               nob;
 
         if (nid == LNET_NID_ANY)
-                return "LNET_NID_ANY";
+                return "<?>";
 
         nf = libcfs_lnd2netstrfns(lnd);
         str = libcfs_next_nidstring();
@@ -557,54 +564,6 @@ libcfs_str2anynid(lnet_nid_t *nidp, const char *str)
         return *nidp != LNET_NID_ANY;
 }
 
-/* parse server details from name */
-int libcfs_str2server(char *name, int *type, __u32 *idx, char **endptr)
-{
-        char *ptr;
-        int i;
-
-        ptr = strstr(name, "-MDT");
-        if (ptr) {
-                *type = SVTYPE_MDT;
-        } else {
-                ptr = strstr(name, "-OST");
-                if (ptr)
-                        *type = SVTYPE_OST;
-                else
-                        return -EINVAL;
-        }
-        ptr += 4;
-
-        if (strncmp(ptr, "all", 3) == 0) {
-                ptr += 3;
-                *type |= SVTYPE_ALL;
-                goto out;
-        }
-        if (*ptr == '*') {
-                ptr++;
-                *type |= SVTYPE_ALL;
-                goto out;
-        }
-
-#if __KERNEL__
-        *idx = simple_strtoul(ptr, NULL, 16);
-#else
-        *idx = strtoul(ptr, NULL, 16);
-#endif
-        /* Require 4 hex digits */
-        for (i = 0; i < 4; i++)
-                if (!isxdigit(*ptr++))
-                        return -EINVAL;
-out:
-        /* Only acceptable garbage at the end of name is [-.:,] etc. */
-        if (isalnum(*ptr))
-                return -EINVAL;
-
-        if (endptr)
-                *endptr = ptr;
-        return 0;
-}
-
 /**
  * Nid range list syntax.
  * \verbatim
@@ -1322,7 +1281,6 @@ EXPORT_SYMBOL(libcfs_str2net);
 EXPORT_SYMBOL(libcfs_str2nid);
 EXPORT_SYMBOL(libcfs_id2str);
 EXPORT_SYMBOL(libcfs_str2anynid);
-EXPORT_SYMBOL(libcfs_str2server);
 EXPORT_SYMBOL(cfs_iswhite);
 EXPORT_SYMBOL(cfs_free_nidlist);
 EXPORT_SYMBOL(cfs_parse_nidlist);