Whamcloud - gitweb
LU-13903 utils: move userland only nidstr.h handling 15/39115/5
authorJames Simmons <jsimmons@infradead.org>
Mon, 8 Mar 2021 14:09:40 +0000 (09:09 -0500)
committerOleg Drokin <green@whamcloud.com>
Tue, 16 Mar 2021 18:16:47 +0000 (18:16 +0000)
The function cfs_expand_nidlist() no longer exist for kernel
internals. We can move the function prototype from the UAPI
header to string.h which is a libcfs user land header.
The structure netstrfns that is defined in a UAPI header
has been adding user land only handling. Additional its
use struct list_head which will confuse reviewers since
kernel developers see this as a kernel only thing.

Test-Parameters: trivial

Change-Id: Ifc3c87f6d3237a94d282d009455ff389278e73ea
Signed-off-by: James Simmons <jsimmons@infradead.org>
Reviewed-on: https://review.whamcloud.com/39115
Tested-by: jenkins <devops@whamcloud.com>
Tested-by: Maloo <maloo@whamcloud.com>
Reviewed-by: Arshad Hussain <arshad.hussain@aeoncomputing.com>
Reviewed-by: Chris Horn <chris.horn@hpe.com>
Reviewed-by: Oleg Drokin <green@whamcloud.com>
libcfs/include/libcfs/util/string.h
lnet/include/lnet/lib-types.h
lnet/include/uapi/linux/lnet/nidstr.h
lnet/lnet/nidstrings.c

index 1b6e819..fc524b1 100644 (file)
@@ -43,6 +43,7 @@
 #include <stdarg.h>
 
 #include <linux/types.h>
+#include <linux/lnet/lnet-types.h>
 #include <libcfs/util/list.h>
 
 static inline
@@ -75,6 +76,22 @@ static inline int scnprintf(char *buf, size_t bufsz, const char *format, ...)
        return ret;
 }
 
+struct netstrfns {
+       __u32   nf_type;
+       char    *nf_name;
+       char    *nf_modname;
+       void    (*nf_addr2str)(__u32 addr, char *str, size_t size);
+       int     (*nf_str2addr)(const char *str, int nob, __u32 *addr);
+       int     (*nf_parse_addrlist)(char *str, int len,
+                                    struct list_head *list);
+       int     (*nf_print_addrlist)(char *buffer, int count,
+                                    struct list_head *list);
+       int     (*nf_match_addr)(__u32 addr, struct list_head *list);
+       int     (*nf_min_max)(struct list_head *nidlist, __u32 *min_nid,
+                             __u32 *max_nid);
+       int     (*nf_expand_addrrange)(struct list_head *addrranges,
+                                      __u32 *addrs, int max_addrs);
+};
 
 /**
  * Structure to represent NULL-less strings.
@@ -118,6 +135,10 @@ int cfs_ip_addr_parse(char *str, int len, struct list_head *list);
 int cfs_ip_addr_range_gen(__u32 *ip_list, int count,
                          struct list_head *ip_addr_expr);
 int cfs_ip_addr_match(__u32 addr, struct list_head *list);
+int cfs_expand_nidlist(struct list_head *nidlist, lnet_nid_t *lnet_nidlist,
+                      int max_nids);
+int cfs_parse_nid_parts(char *str, struct list_head *addr,
+                       struct list_head *net_num, __u32 *net_type);
 int cfs_abs_path(const char *request_path, char **resolved_path);
 
 #endif
index 41565ee..2bf7039 100644 (file)
@@ -242,6 +242,21 @@ struct lnet_test_peer {
 #define LNET_COOKIE_TYPE_BITS  2
 #define LNET_COOKIE_MASK       ((1ULL << LNET_COOKIE_TYPE_BITS) - 1ULL)
 
+struct netstrfns {
+       u32     nf_type;
+       char    *nf_name;
+       char    *nf_modname;
+       void    (*nf_addr2str)(u32 addr, char *str, size_t size);
+       int     (*nf_str2addr)(const char *str, int nob, u32 *addr);
+       int     (*nf_parse_addrlist)(char *str, int len,
+                                    struct list_head *list);
+       int     (*nf_print_addrlist)(char *buffer, int count,
+                                    struct list_head *list);
+       int     (*nf_match_addr)(u32 addr, struct list_head *list);
+       int     (*nf_min_max)(struct list_head *nidlist, u32 *min_nid,
+                             u32 *max_nid);
+};
+
 struct lnet_ni;                                         /* forward ref */
 struct socket;
 
index 1e4da91..7ac7f9a 100644 (file)
@@ -91,12 +91,8 @@ int libcfs_num_parse(char *str, int len, struct list_head *list);
 char *libcfs_id2str(struct lnet_process_id id);
 void cfs_free_nidlist(struct list_head *list);
 int cfs_parse_nidlist(char *str, int len, struct list_head *list);
-int cfs_parse_nid_parts(char *str, struct list_head *addr,
-                       struct list_head *net_num, __u32 *net_type);
 int cfs_print_nidlist(char *buffer, int count, struct list_head *list);
 int cfs_match_nid(lnet_nid_t nid, struct list_head *list);
-int cfs_expand_nidlist(struct list_head *nidlist, lnet_nid_t *lnet_nidlist,
-                      int max_nids);
 int cfs_match_nid_net(lnet_nid_t nid, __u32 net, struct list_head *net_num_list,
                      struct list_head *addr);
 int cfs_match_net(__u32 net_id, __u32 net_type,
@@ -108,21 +104,4 @@ int cfs_nidrange_find_min_max(struct list_head *nidlist, char *min_nid,
                               char *max_nid, __kernel_size_t nidstr_length);
 void cfs_expr_list_free_list(struct list_head *list);
 
-struct netstrfns {
-       __u32   nf_type;
-       char    *nf_name;
-       char    *nf_modname;
-       void    (*nf_addr2str)(__u32 addr, char *str, __kernel_size_t size);
-       int     (*nf_str2addr)(const char *str, int nob, __u32 *addr);
-       int     (*nf_parse_addrlist)(char *str, int len,
-                                    struct list_head *list);
-       int     (*nf_print_addrlist)(char *buffer, int count,
-                                    struct list_head *list);
-       int     (*nf_match_addr)(__u32 addr, struct list_head *list);
-       int     (*nf_min_max)(struct list_head *nidlist, __u32 *min_nid,
-                             __u32 *max_nid);
-       int     (*nf_expand_addrrange)(struct list_head *addrranges,
-                                      __u32 *addrs, int max_addrs);
-};
-
 #endif /* _LNET_NIDSTRINGS_H */
index df82695..821025b 100644 (file)
@@ -38,6 +38,7 @@
 
 #include <libcfs/libcfs.h>
 #include <uapi/linux/lnet/nidstr.h>
+#include <lnet/lib-types.h>
 
 /* max value for numeric network address */
 #define MAX_NUMERIC_VALUE 0xffffffff