Whamcloud - gitweb
LU-5935 lnet: Fixes to make lnetctl function as expected.
[fs/lustre-release.git] / libcfs / libcfs / nidstrings.c
index d5830f3..b11cc9c 100644 (file)
@@ -27,7 +27,7 @@
  * Copyright (c) 2008, 2010, Oracle and/or its affiliates. All rights reserved.
  * Use is subject to license terms.
  *
- * Copyright (c) 2011, 2012, Intel Corporation.
+ * Copyright (c) 2011, 2014, Intel Corporation.
  */
 /*
  * This file is part of Lustre, http://www.lustre.org/
 #define DEBUG_SUBSYSTEM S_LNET
 
 #include <libcfs/libcfs.h>
-#include <lnet/lnet.h>
+#include <lnet/nidstr.h>
 #ifndef __KERNEL__
 #ifdef HAVE_GETHOSTBYNAME
 # include <netdb.h>
 #endif
 #endif
 
+/* max value for numeric network address */
+#define MAX_NUMERIC_VALUE 0xffffffff
+
 #define IPSTRING_LENGTH 16
 
 /* CAVEAT VENDITOR! Keep the canonical string representation of nets/nids
@@ -275,16 +278,17 @@ static struct netstrfns  libcfs_netstrfns[] = {
        {/* .nf_type      */  -1},
 };
 
-const int libcfs_nnetstrfns = sizeof(libcfs_netstrfns)/sizeof(libcfs_netstrfns[0]);
+static const int libcfs_nnetstrfns =
+       sizeof(libcfs_netstrfns)/sizeof(libcfs_netstrfns[0]);
 
-int
+static int
 libcfs_lo_str2addr(const char *str, int nob, __u32 *addr)
 {
         *addr = 0;
         return 1;
 }
 
-void
+static void
 libcfs_ip_addr2str(__u32 addr, char *str)
 {
 #if 0   /* never lookup */
@@ -310,7 +314,7 @@ libcfs_ip_addr2str(__u32 addr, char *str)
  * fine, if it doesn't, then the scan ended at the end of the string, which is
  * fine too :) */
 
-int
+static int
 libcfs_ip_str2addr(const char *str, int nob, __u32 *addr)
 {
        unsigned int    a;
@@ -357,19 +361,19 @@ libcfs_ip_str2addr(const char *str, int nob, __u32 *addr)
         return 0;
 }
 
-void
+static void
 libcfs_decnum_addr2str(__u32 addr, char *str)
 {
         snprintf(str, LNET_NIDSTR_SIZE, "%u", addr);
 }
 
-void
+static void
 libcfs_hexnum_addr2str(__u32 addr, char *str)
 {
         snprintf(str, LNET_NIDSTR_SIZE, "0x%x", addr);
 }
 
-int
+static int
 libcfs_num_str2addr(const char *str, int nob, __u32 *addr)
 {
         int     n;
@@ -389,7 +393,7 @@ libcfs_num_str2addr(const char *str, int nob, __u32 *addr)
         return 0;
 }
 
-struct netstrfns *
+static struct netstrfns *
 libcfs_lnd2netstrfns(int lnd)
 {
         int    i;
@@ -402,7 +406,7 @@ libcfs_lnd2netstrfns(int lnd)
         return NULL;
 }
 
-struct netstrfns *
+static struct netstrfns *
 libcfs_namenum2netstrfns(const char *name)
 {
         struct netstrfns *nf;
@@ -417,7 +421,7 @@ libcfs_namenum2netstrfns(const char *name)
         return NULL;
 }
 
-struct netstrfns *
+static struct netstrfns *
 libcfs_name2netstrfns(const char *name)
 {
         int    i;