4 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
6 * This program is free software; you can redistribute it and/or modify
7 * it under the terms of the GNU General Public License version 2 only,
8 * as published by the Free Software Foundation.
10 * This program is distributed in the hope that it will be useful, but
11 * WITHOUT ANY WARRANTY; without even the implied warranty of
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
13 * General Public License version 2 for more details (a copy is included
14 * in the LICENSE file that accompanied this code).
16 * You should have received a copy of the GNU General Public License
17 * version 2 along with this program; If not, see
18 * http://www.gnu.org/licenses/gpl-2.0.html
23 * Copyright (c) 2003, 2010, Oracle and/or its affiliates. All rights reserved.
24 * Use is subject to license terms.
26 * Copyright (c) 2011, 2014, Intel Corporation.
28 #ifndef _LNET_NIDSTRINGS_H
29 #define _LNET_NIDSTRINGS_H
30 #include <lnet/types.h>
34 #define LNET_NIDSTR_COUNT 1024 /* # of nidstrings */
35 #define LNET_NIDSTR_SIZE 32 /* size of each one (see below for usage) */
37 /* support decl needed by both kernel and user space */
38 char *libcfs_next_nidstring(void);
39 int libcfs_isknown_lnd(__u32 lnd);
40 char *libcfs_lnd2modname(__u32 lnd);
41 char *libcfs_lnd2str_r(__u32 lnd, char *buf, size_t buf_size);
42 static inline char *libcfs_lnd2str(__u32 lnd)
44 return libcfs_lnd2str_r(lnd, libcfs_next_nidstring(),
47 int libcfs_str2lnd(const char *str);
48 char *libcfs_net2str_r(__u32 net, char *buf, size_t buf_size);
49 static inline char *libcfs_net2str(__u32 net)
51 return libcfs_net2str_r(net, libcfs_next_nidstring(),
54 char *libcfs_nid2str_r(lnet_nid_t nid, char *buf, size_t buf_size);
55 static inline char *libcfs_nid2str(lnet_nid_t nid)
57 return libcfs_nid2str_r(nid, libcfs_next_nidstring(),
60 __u32 libcfs_str2net(const char *str);
61 lnet_nid_t libcfs_str2nid(const char *str);
62 int libcfs_str2anynid(lnet_nid_t *nid, const char *str);
63 char *libcfs_id2str(lnet_process_id_t id);
64 void cfs_free_nidlist(struct list_head *list);
65 int cfs_parse_nidlist(char *str, int len, struct list_head *list);
66 int cfs_print_nidlist(char *buffer, int count, struct list_head *list);
67 int cfs_match_nid(lnet_nid_t nid, struct list_head *list);
68 bool cfs_nidrange_is_contiguous(struct list_head *nidlist);
69 void cfs_nidrange_find_min_max(struct list_head *nidlist, char *min_nid,
70 char *max_nid, size_t nidstr_length);
72 #endif /* _LNET_NIDSTRINGS_H */