Whamcloud - gitweb
LU-13274 uapi: make lnet UAPI headers C99 compliant
[fs/lustre-release.git] / lnet / include / uapi / linux / lnet / nidstr.h
index 0d09d4c..a32f379 100644 (file)
  * Copyright (c) 2003, 2010, Oracle and/or its affiliates. All rights reserved.
  * Use is subject to license terms.
  *
- * Copyright (c) 2014, 2015, Intel Corporation.
+ * Copyright (c) 2015, 2017, Intel Corporation.
  */
 #ifndef _LNET_NIDSTRINGS_H
 #define _LNET_NIDSTRINGS_H
 
-/*
- * This is due to us being out of kernel and the way the OpenSFS branch
- * handles CFLAGS.
- */
-#ifdef __KERNEL__
-# include <uapi/linux/lnet/lnet-types.h>
-#else
-# include <linux/lnet/lnet-types.h>
-#endif
+#include <linux/types.h>
+#include <linux/lnet/lnet-types.h>
 
 /**
  *  Lustre Network Driver types.
@@ -59,6 +52,8 @@ enum {
        GNILND          = 13,
        GNIIPLND        = 14,
        PTL4LND         = 15,
+
+       NUM_LNDS
 };
 
 struct list_head;
@@ -70,20 +65,20 @@ struct list_head;
 char *libcfs_next_nidstring(void);
 int libcfs_isknown_lnd(__u32 lnd);
 char *libcfs_lnd2modname(__u32 lnd);
-char *libcfs_lnd2str_r(__u32 lnd, char *buf, size_t buf_size);
+char *libcfs_lnd2str_r(__u32 lnd, char *buf, __kernel_size_t buf_size);
 static inline char *libcfs_lnd2str(__u32 lnd)
 {
        return libcfs_lnd2str_r(lnd, libcfs_next_nidstring(),
                                LNET_NIDSTR_SIZE);
 }
 int libcfs_str2lnd(const char *str);
-char *libcfs_net2str_r(__u32 net, char *buf, size_t buf_size);
+char *libcfs_net2str_r(__u32 net, char *buf, __kernel_size_t buf_size);
 static inline char *libcfs_net2str(__u32 net)
 {
        return libcfs_net2str_r(net, libcfs_next_nidstring(),
                                LNET_NIDSTR_SIZE);
 }
-char *libcfs_nid2str_r(lnet_nid_t nid, char *buf, size_t buf_size);
+char *libcfs_nid2str_r(lnet_nid_t nid, char *buf, __kernel_size_t buf_size);
 static inline char *libcfs_nid2str(lnet_nid_t nid)
 {
        return libcfs_nid2str_r(nid, libcfs_next_nidstring(),
@@ -97,27 +92,28 @@ void cfs_free_nidlist(struct list_head *list);
 int cfs_parse_nidlist(char *str, int len, struct list_head *list);
 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_ip_addr_parse(char *str, int len, struct list_head *list);
 int cfs_ip_addr_match(__u32 addr, struct list_head *list);
-bool cfs_nidrange_is_contiguous(struct list_head *nidlist);
-void cfs_nidrange_find_min_max(struct list_head *nidlist, char *min_nid,
-                              char *max_nid, size_t nidstr_length);
+int cfs_nidrange_find_min_max(struct list_head *nidlist, char *min_nid,
+                              char *max_nid, __kernel_size_t nidstr_length);
 
 struct netstrfns {
        __u32   nf_type;
        char    *nf_name;
        char    *nf_modname;
-       void    (*nf_addr2str)(__u32 addr, char *str, size_t size);
+       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);
-       bool    (*nf_is_contiguous)(struct list_head *nidlist);
-       void    (*nf_min_max)(struct list_head *nidlist, __u32 *min_nid,
+       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 */