Commit 47ca6ec2 authored by James Simmons's avatar James Simmons Committed by Greg Kroah-Hartman

staging: lustre: move nidstring handling to LNet layer

Moved the source file nidstring.c from libcfs to lnet
since that is the only place it is used. With the
move of nidstring to lnet some functions in libcfs
need to be exported. In later patches those functions
that are only used by LNet also will be moved to the
LNet layer. Also add in missing MAX_NUMERIC_VALUE
defination.
Signed-off-by: default avatarJames Simmons <jsimmons@infradead.org>
Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
parent a1dfc93a
obj-$(CONFIG_LNET) += lnet.o obj-$(CONFIG_LNET) += lnet.o
lnet-y := api-ni.o config.o \ lnet-y := api-ni.o config.o nidstrings.o \
lib-me.o lib-msg.o lib-eq.o lib-md.o lib-ptl.o \ lib-me.o lib-msg.o lib-eq.o lib-md.o lib-ptl.o \
lib-socket.o lib-move.o module.o lo.o \ lib-socket.o lib-move.o module.o lo.o \
router.o router_proc.o acceptor.o peer.o router.o router_proc.o acceptor.o peer.o
...@@ -33,7 +33,7 @@ ...@@ -33,7 +33,7 @@
* This file is part of Lustre, http://www.lustre.org/ * This file is part of Lustre, http://www.lustre.org/
* Lustre is a trademark of Sun Microsystems, Inc. * Lustre is a trademark of Sun Microsystems, Inc.
* *
* libcfs/libcfs/nidstrings.c * lnet/lnet/nidstrings.c
* *
* Author: Phil Schwan <phil@clusterfs.com> * Author: Phil Schwan <phil@clusterfs.com>
*/ */
...@@ -43,6 +43,9 @@ ...@@ -43,6 +43,9 @@
#include "../../include/linux/libcfs/libcfs.h" #include "../../include/linux/libcfs/libcfs.h"
#include "../../include/linux/lnet/lnet.h" #include "../../include/linux/lnet/lnet.h"
/* max value for numeric network address */
#define MAX_NUMERIC_VALUE 0xffffffff
/* CAVEAT VENDITOR! Keep the canonical string representation of nets/nids /* CAVEAT VENDITOR! Keep the canonical string representation of nets/nids
* consistent in all conversion functions. Some code fragments are copied * consistent in all conversion functions. Some code fragments are copied
* around for the sake of clarity... * around for the sake of clarity...
...@@ -64,12 +67,13 @@ void libcfs_init_nidstrings(void) ...@@ -64,12 +67,13 @@ void libcfs_init_nidstrings(void)
{ {
spin_lock_init(&libcfs_nidstring_lock); spin_lock_init(&libcfs_nidstring_lock);
} }
EXPORT_SYMBOL(libcfs_init_nidstrings);
static char * char *
libcfs_next_nidstring(void) libcfs_next_nidstring(void)
{ {
char *str; char *str;
unsigned long flags; unsigned long flags;
spin_lock_irqsave(&libcfs_nidstring_lock, flags); spin_lock_irqsave(&libcfs_nidstring_lock, flags);
...@@ -80,6 +84,7 @@ libcfs_next_nidstring(void) ...@@ -80,6 +84,7 @@ libcfs_next_nidstring(void)
spin_unlock_irqrestore(&libcfs_nidstring_lock, flags); spin_unlock_irqrestore(&libcfs_nidstring_lock, flags);
return str; return str;
} }
EXPORT_SYMBOL(libcfs_next_nidstring);
static int libcfs_lo_str2addr(const char *str, int nob, __u32 *addr) static int libcfs_lo_str2addr(const char *str, int nob, __u32 *addr)
{ {
......
...@@ -10,7 +10,7 @@ libcfs-linux-objs += linux-mem.o ...@@ -10,7 +10,7 @@ libcfs-linux-objs += linux-mem.o
libcfs-linux-objs := $(addprefix linux/,$(libcfs-linux-objs)) libcfs-linux-objs := $(addprefix linux/,$(libcfs-linux-objs))
libcfs-all-objs := debug.o fail.o nidstrings.o module.o tracefile.o \ libcfs-all-objs := debug.o fail.o module.o tracefile.o \
libcfs_string.o hash.o kernel_user_comm.o \ libcfs_string.o hash.o kernel_user_comm.o \
prng.o workitem.o libcfs_cpu.o \ prng.o workitem.o libcfs_cpu.o \
libcfs_mem.o libcfs_lock.o libcfs_mem.o libcfs_lock.o
......
...@@ -214,6 +214,7 @@ cfs_gettok(struct cfs_lstr *next, char delim, struct cfs_lstr *res) ...@@ -214,6 +214,7 @@ cfs_gettok(struct cfs_lstr *next, char delim, struct cfs_lstr *res)
res->ls_len = end - res->ls_str + 1; res->ls_len = end - res->ls_str + 1;
return 1; return 1;
} }
EXPORT_SYMBOL(cfs_gettok);
/** /**
* Converts string to integer. * Converts string to integer.
...@@ -242,6 +243,7 @@ cfs_str2num_check(char *str, int nob, unsigned *num, ...@@ -242,6 +243,7 @@ cfs_str2num_check(char *str, int nob, unsigned *num,
return (*num >= min && *num <= max); return (*num >= min && *num <= max);
} }
EXPORT_SYMBOL(cfs_str2num_check);
/** /**
* Parses \<range_expr\> token of the syntax. If \a bracketed is false, * Parses \<range_expr\> token of the syntax. If \a bracketed is false,
...@@ -406,6 +408,7 @@ cfs_expr_list_match(__u32 value, struct cfs_expr_list *expr_list) ...@@ -406,6 +408,7 @@ cfs_expr_list_match(__u32 value, struct cfs_expr_list *expr_list)
return 0; return 0;
} }
EXPORT_SYMBOL(cfs_expr_list_match);
/** /**
* Convert express list (\a expr_list) to an array of all matched values * Convert express list (\a expr_list) to an array of all matched values
...@@ -558,6 +561,7 @@ cfs_expr_list_free_list(struct list_head *list) ...@@ -558,6 +561,7 @@ cfs_expr_list_free_list(struct list_head *list)
cfs_expr_list_free(el); cfs_expr_list_free(el);
} }
} }
EXPORT_SYMBOL(cfs_expr_list_free_list);
int int
cfs_ip_addr_parse(char *str, int len, struct list_head *list) cfs_ip_addr_parse(char *str, int len, struct list_head *list)
......
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