Commit 2e6e0a46 authored by Sören Brinkmann's avatar Sören Brinkmann Committed by Greg Kroah-Hartman

staging: lustre: libcfs/nidstrings: Declare internal symbols static

This fixes sparse warnings:
  staging/lustre/lustre/libcfs/nidstrings.c:200:11: warning: symbol 'libcfs_nnetstrfns' was not declared. Should it be static?
  drivers/staging/lustre/lustre/libcfs/nidstrings.c:203:1: warning: symbol 'libcfs_lo_str2addr' was not declared. Should it be static?
  drivers/staging/lustre/lustre/libcfs/nidstrings.c:210:1: warning: symbol 'libcfs_ip_addr2str' was not declared. Should it be static?
  drivers/staging/lustre/lustre/libcfs/nidstrings.c:227:1: warning: symbol 'libcfs_ip_str2addr' was not declared. Should it be static?
  drivers/staging/lustre/lustre/libcfs/nidstrings.c:248:1: warning: symbol 'libcfs_decnum_addr2str' was not declared. Should it be static?
  drivers/staging/lustre/lustre/libcfs/nidstrings.c:254:1: warning: symbol 'libcfs_hexnum_addr2str' was not declared. Should it be static?
  drivers/staging/lustre/lustre/libcfs/nidstrings.c:260:1: warning: symbol 'libcfs_num_str2addr' was not declared. Should it be static?
  staging/lustre/lustre/libcfs/nidstrings.c:279:18: warning: symbol 'libcfs_lnd2netstrfns' was not declared. Should it be static?
  drivers/staging/lustre/lustre/libcfs/nidstrings.c:292:18: warning: symbol 'libcfs_namenum2netstrfns' was not declared. Should it be static?
  drivers/staging/lustre/lustre/libcfs/nidstrings.c:307:18: warning: symbol 'libcfs_name2netstrfns' was not declared. Should it be static?

Some functions had static forward declarations followed by non-static
implementations. Those forward declarations are removed and the
implementations are declared static and moved into a location that
doesn't require forward declarations.
Signed-off-by: default avatarSören Brinkmann <soeren.brinkmann@gmail.com>
Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
parent 90d2ced9
......@@ -81,12 +81,68 @@ libcfs_next_nidstring(void)
return str;
}
static int libcfs_lo_str2addr(const char *str, int nob, __u32 *addr);
static void libcfs_ip_addr2str(__u32 addr, char *str);
static int libcfs_ip_str2addr(const char *str, int nob, __u32 *addr);
static void libcfs_decnum_addr2str(__u32 addr, char *str);
static void libcfs_hexnum_addr2str(__u32 addr, char *str);
static int libcfs_num_str2addr(const char *str, int nob, __u32 *addr);
static int libcfs_lo_str2addr(const char *str, int nob, __u32 *addr)
{
*addr = 0;
return 1;
}
static void libcfs_ip_addr2str(__u32 addr, char *str)
{
snprintf(str, LNET_NIDSTR_SIZE, "%u.%u.%u.%u",
(addr >> 24) & 0xff, (addr >> 16) & 0xff,
(addr >> 8) & 0xff, addr & 0xff);
}
static int libcfs_ip_str2addr(const char *str, int nob, __u32 *addr)
{
unsigned int a;
unsigned int b;
unsigned int c;
unsigned int d;
int n = nob; /* XscanfX */
/* numeric IP? */
if (sscanf(str, "%u.%u.%u.%u%n", &a, &b, &c, &d, &n) >= 4 &&
n == nob &&
(a & ~0xff) == 0 && (b & ~0xff) == 0 &&
(c & ~0xff) == 0 && (d & ~0xff) == 0) {
*addr = ((a<<24)|(b<<16)|(c<<8)|d);
return 1;
}
return 0;
}
static void libcfs_decnum_addr2str(__u32 addr, char *str)
{
snprintf(str, LNET_NIDSTR_SIZE, "%u", addr);
}
static void libcfs_hexnum_addr2str(__u32 addr, char *str)
{
snprintf(str, LNET_NIDSTR_SIZE, "0x%x", addr);
}
static int libcfs_num_str2addr(const char *str, int nob, __u32 *addr)
{
int n;
n = nob;
if (sscanf(str, "0x%x%n", addr, &n) >= 1 && n == nob)
return 1;
n = nob;
if (sscanf(str, "0X%x%n", addr, &n) >= 1 && n == nob)
return 1;
n = nob;
if (sscanf(str, "%u%n", addr, &n) >= 1 && n == nob)
return 1;
return 0;
}
static int libcfs_num_parse(char *str, int len, struct list_head *list);
static int libcfs_num_match(__u32 addr, struct list_head *list);
......@@ -197,24 +253,7 @@ static struct netstrfns libcfs_netstrfns[] = {
{/* .nf_type */ -1},
};
const int libcfs_nnetstrfns = ARRAY_SIZE(libcfs_netstrfns);
int
libcfs_lo_str2addr(const char *str, int nob, __u32 *addr)
{
*addr = 0;
return 1;
}
void
libcfs_ip_addr2str(__u32 addr, char *str)
{
#if 0 /* never lookup */
#endif
snprintf(str, LNET_NIDSTR_SIZE, "%u.%u.%u.%u",
(addr >> 24) & 0xff, (addr >> 16) & 0xff,
(addr >> 8) & 0xff, addr & 0xff);
}
static const int libcfs_nnetstrfns = ARRAY_SIZE(libcfs_netstrfns);
/* CAVEAT EMPTOR XscanfX
* I use "%n" at the end of a sscanf format to detect trailing junk. However
......@@ -223,60 +262,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
libcfs_ip_str2addr(const char *str, int nob, __u32 *addr)
{
unsigned int a;
unsigned int b;
unsigned int c;
unsigned int d;
int n = nob; /* XscanfX */
/* numeric IP? */
if (sscanf(str, "%u.%u.%u.%u%n", &a, &b, &c, &d, &n) >= 4 &&
n == nob &&
(a & ~0xff) == 0 && (b & ~0xff) == 0 &&
(c & ~0xff) == 0 && (d & ~0xff) == 0) {
*addr = ((a<<24)|(b<<16)|(c<<8)|d);
return 1;
}
return 0;
}
void
libcfs_decnum_addr2str(__u32 addr, char *str)
{
snprintf(str, LNET_NIDSTR_SIZE, "%u", addr);
}
void
libcfs_hexnum_addr2str(__u32 addr, char *str)
{
snprintf(str, LNET_NIDSTR_SIZE, "0x%x", addr);
}
int
libcfs_num_str2addr(const char *str, int nob, __u32 *addr)
{
int n;
n = nob;
if (sscanf(str, "0x%x%n", addr, &n) >= 1 && n == nob)
return 1;
n = nob;
if (sscanf(str, "0X%x%n", addr, &n) >= 1 && n == nob)
return 1;
n = nob;
if (sscanf(str, "%u%n", addr, &n) >= 1 && n == nob)
return 1;
return 0;
}
struct netstrfns *
static struct netstrfns *
libcfs_lnd2netstrfns(int lnd)
{
int i;
......@@ -289,7 +275,7 @@ libcfs_lnd2netstrfns(int lnd)
return NULL;
}
struct netstrfns *
static struct netstrfns *
libcfs_namenum2netstrfns(const char *name)
{
struct netstrfns *nf;
......@@ -304,7 +290,7 @@ libcfs_namenum2netstrfns(const char *name)
return NULL;
}
struct netstrfns *
static struct netstrfns *
libcfs_name2netstrfns(const char *name)
{
int i;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment