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) 2008, 2010, Oracle and/or its affiliates. All rights reserved.
24 * Use is subject to license terms.
26 * Copyright (c) 2011, 2015, Intel Corporation.
29 * This file is part of Lustre, http://www.lustre.org/
31 * lnet/lnet/nidstrings.c
33 * Author: Phil Schwan <phil@clusterfs.com>
36 #define DEBUG_SUBSYSTEM S_LNET
38 #include <libcfs/libcfs.h>
39 #include <uapi/linux/lnet/nidstr.h>
40 #include <lnet/lib-types.h>
42 /* max value for numeric network address */
43 #define MAX_NUMERIC_VALUE 0xffffffff
45 #define IPSTRING_LENGTH 16
47 /* CAVEAT VENDITOR! Keep the canonical string representation of nets/nids
48 * consistent in all conversion functions. Some code fragments are copied
49 * around for the sake of clarity...
52 /* CAVEAT EMPTOR! Racey temporary buffer allocation!
53 * Choose the number of nidstrings to support the MAXIMUM expected number of
54 * concurrent users. If there are more, the returned string will be volatile.
55 * NB this number must allow for a process to be descheduled for a timeslice
56 * between getting its string and using it.
59 static char libcfs_nidstrings[LNET_NIDSTR_COUNT][LNET_NIDSTR_SIZE];
60 static int libcfs_nidstring_idx;
62 static DEFINE_SPINLOCK(libcfs_nidstring_lock);
64 static struct netstrfns *libcfs_namenum2netstrfns(const char *name);
67 libcfs_next_nidstring(void)
72 spin_lock_irqsave(&libcfs_nidstring_lock, flags);
74 str = libcfs_nidstrings[libcfs_nidstring_idx++];
75 if (libcfs_nidstring_idx == ARRAY_SIZE(libcfs_nidstrings))
76 libcfs_nidstring_idx = 0;
78 spin_unlock_irqrestore(&libcfs_nidstring_lock, flags);
81 EXPORT_SYMBOL(libcfs_next_nidstring);
84 * Nid range list syntax.
87 * <nidlist> :== <nidrange> [ ' ' <nidrange> ]
88 * <nidrange> :== <addrrange> '@' <net>
89 * <addrrange> :== '*' |
92 * <ipaddr_range> :== <cfs_expr_list>.<cfs_expr_list>.<cfs_expr_list>.
94 * <cfs_expr_list> :== <number> |
96 * <expr_list> :== '[' <range_expr> [ ',' <range_expr>] ']'
97 * <range_expr> :== <number> |
98 * <number> '-' <number> |
99 * <number> '-' <number> '/' <number>
100 * <net> :== <netname> | <netname><number>
101 * <netname> :== "lo" | "tcp" | "o2ib" | "cib" | "openib" | "iib" |
102 * "vib" | "ra" | "elan" | "mx" | "ptl"
107 * Structure to represent \<nidrange\> token of the syntax.
109 * One of this is created for each \<net\> parsed.
113 * Link to list of this structures which is built on nid range
116 struct list_head nr_link;
118 * List head for addrrange::ar_link.
120 struct list_head nr_addrranges;
122 * Flag indicating that *@<net> is found.
126 * Pointer to corresponding element of libcfs_netstrfns.
128 struct netstrfns *nr_netstrfns;
130 * Number of network. E.g. 5 if \<net\> is "elan5".
136 * Structure to represent \<addrrange\> token of the syntax.
140 * Link to nidrange::nr_addrranges.
142 struct list_head ar_link;
144 * List head for cfs_expr_list::el_list.
146 struct list_head ar_numaddr_ranges;
150 * Parses \<addrrange\> token on the syntax.
152 * Allocates struct addrrange and links to \a nidrange via
153 * (nidrange::nr_addrranges)
155 * \retval 0 if \a src parses to '*' | \<ipaddr_range\> | \<cfs_expr_list\>
156 * \retval -errno otherwise
159 parse_addrange(const struct cfs_lstr *src, struct nidrange *nidrange)
161 struct addrrange *addrrange;
163 if (src->ls_len == 1 && src->ls_str[0] == '*') {
164 nidrange->nr_all = 1;
168 CFS_ALLOC_PTR(addrrange);
169 if (addrrange == NULL)
171 list_add_tail(&addrrange->ar_link, &nidrange->nr_addrranges);
172 INIT_LIST_HEAD(&addrrange->ar_numaddr_ranges);
174 return nidrange->nr_netstrfns->nf_parse_addrlist(src->ls_str,
176 &addrrange->ar_numaddr_ranges);
180 * Finds or creates struct nidrange.
182 * Checks if \a src is a valid network name, looks for corresponding
183 * nidrange on the ist of nidranges (\a nidlist), creates new struct
184 * nidrange if it is not found.
186 * \retval pointer to struct nidrange matching network specified via \a src
187 * \retval NULL if \a src does not match any network
189 static struct nidrange *
190 add_nidrange(const struct cfs_lstr *src,
191 struct list_head *nidlist)
193 struct netstrfns *nf;
198 if (src->ls_len >= LNET_NIDSTR_SIZE)
201 nf = libcfs_namenum2netstrfns(src->ls_str);
204 endlen = src->ls_len - strlen(nf->nf_name);
206 /* network name only, e.g. "elan" or "tcp" */
209 /* e.g. "elan25" or "tcp23", refuse to parse if
210 * network name is not appended with decimal or
211 * hexadecimal number */
212 if (!cfs_str2num_check(src->ls_str + strlen(nf->nf_name),
213 endlen, &netnum, 0, MAX_NUMERIC_VALUE))
217 list_for_each_entry(nr, nidlist, nr_link) {
218 if (nr->nr_netstrfns != nf)
220 if (nr->nr_netnum != netnum)
228 list_add_tail(&nr->nr_link, nidlist);
229 INIT_LIST_HEAD(&nr->nr_addrranges);
230 nr->nr_netstrfns = nf;
232 nr->nr_netnum = netnum;
238 * Parses \<nidrange\> token of the syntax.
240 * \retval 1 if \a src parses to \<addrrange\> '@' \<net\>
241 * \retval 0 otherwise
244 parse_nidrange(struct cfs_lstr *src, struct list_head *nidlist)
246 struct cfs_lstr addrrange;
250 if (cfs_gettok(src, '@', &addrrange) == 0)
253 if (cfs_gettok(src, '@', &net) == 0 || src->ls_str != NULL)
256 nr = add_nidrange(&net, nidlist);
260 if (parse_addrange(&addrrange, nr) != 0)
269 * Frees addrrange structures of \a list.
271 * For each struct addrrange structure found on \a list it frees
272 * cfs_expr_list list attached to it and frees the addrrange itself.
277 free_addrranges(struct list_head *list)
279 while (!list_empty(list)) {
280 struct addrrange *ar;
282 ar = list_entry(list->next, struct addrrange, ar_link);
284 cfs_expr_list_free_list(&ar->ar_numaddr_ranges);
285 list_del(&ar->ar_link);
291 * Frees nidrange strutures of \a list.
293 * For each struct nidrange structure found on \a list it frees
294 * addrrange list attached to it and frees the nidrange itself.
299 cfs_free_nidlist(struct list_head *list)
301 struct list_head *pos, *next;
304 list_for_each_safe(pos, next, list) {
305 nr = list_entry(pos, struct nidrange, nr_link);
306 free_addrranges(&nr->nr_addrranges);
311 EXPORT_SYMBOL(cfs_free_nidlist);
314 * Parses nid range list.
316 * Parses with rigorous syntax and overflow checking \a str into
317 * \<nidrange\> [ ' ' \<nidrange\> ], compiles \a str into set of
318 * structures and links that structure to \a nidlist. The resulting
319 * list can be used to match a NID againts set of NIDS defined by \a
323 * \retval 1 on success
324 * \retval 0 otherwise
327 cfs_parse_nidlist(char *str, int len, struct list_head *nidlist)
335 INIT_LIST_HEAD(nidlist);
337 rc = cfs_gettok(&src, ' ', &res);
339 cfs_free_nidlist(nidlist);
342 rc = parse_nidrange(&res, nidlist);
344 cfs_free_nidlist(nidlist);
350 EXPORT_SYMBOL(cfs_parse_nidlist);
353 * Matches a nid (\a nid) against the compiled list of nidranges (\a nidlist).
355 * \see cfs_parse_nidlist()
358 * \retval 0 otherwises
360 int cfs_match_nid(lnet_nid_t nid, struct list_head *nidlist)
363 struct addrrange *ar;
365 list_for_each_entry(nr, nidlist, nr_link) {
366 if (nr->nr_netstrfns->nf_type != LNET_NETTYP(LNET_NIDNET(nid)))
368 if (nr->nr_netnum != LNET_NETNUM(LNET_NIDNET(nid)))
372 list_for_each_entry(ar, &nr->nr_addrranges, ar_link)
373 if (nr->nr_netstrfns->nf_match_addr(LNET_NIDADDR(nid),
374 &ar->ar_numaddr_ranges))
379 EXPORT_SYMBOL(cfs_match_nid);
382 * Print the network part of the nidrange \a nr into the specified \a buffer.
384 * \retval number of characters written
387 cfs_print_network(char *buffer, int count, struct nidrange *nr)
389 struct netstrfns *nf = nr->nr_netstrfns;
391 if (nr->nr_netnum == 0)
392 return scnprintf(buffer, count, "@%s", nf->nf_name);
394 return scnprintf(buffer, count, "@%s%u",
395 nf->nf_name, nr->nr_netnum);
399 * Print a list of addrrange (\a addrranges) into the specified \a buffer.
400 * At max \a count characters can be printed into \a buffer.
402 * \retval number of characters written
405 cfs_print_addrranges(char *buffer, int count, struct list_head *addrranges,
409 struct addrrange *ar;
410 struct netstrfns *nf = nr->nr_netstrfns;
412 list_for_each_entry(ar, addrranges, ar_link) {
414 i += scnprintf(buffer + i, count - i, " ");
415 i += nf->nf_print_addrlist(buffer + i, count - i,
416 &ar->ar_numaddr_ranges);
417 i += cfs_print_network(buffer + i, count - i, nr);
423 * Print a list of nidranges (\a nidlist) into the specified \a buffer.
424 * At max \a count characters can be printed into \a buffer.
425 * Nidranges are separated by a space character.
427 * \retval number of characters written
429 int cfs_print_nidlist(char *buffer, int count, struct list_head *nidlist)
437 list_for_each_entry(nr, nidlist, nr_link) {
439 i += scnprintf(buffer + i, count - i, " ");
441 if (nr->nr_all != 0) {
442 LASSERT(list_empty(&nr->nr_addrranges));
443 i += scnprintf(buffer + i, count - i, "*");
444 i += cfs_print_network(buffer + i, count - i, nr);
446 i += cfs_print_addrranges(buffer + i, count - i,
447 &nr->nr_addrranges, nr);
452 EXPORT_SYMBOL(cfs_print_nidlist);
455 libcfs_lo_str2addr(const char *str, int nob, __u32 *addr)
462 libcfs_ip_addr2str(__u32 addr, char *str, size_t size)
464 snprintf(str, size, "%u.%u.%u.%u",
465 (addr >> 24) & 0xff, (addr >> 16) & 0xff,
466 (addr >> 8) & 0xff, addr & 0xff);
469 /* CAVEAT EMPTOR XscanfX
470 * I use "%n" at the end of a sscanf format to detect trailing junk. However
471 * sscanf may return immediately if it sees the terminating '0' in a string, so
472 * I initialise the %n variable to the expected length. If sscanf sets it;
473 * fine, if it doesn't, then the scan ended at the end of the string, which is
476 libcfs_ip_str2addr(const char *str, int nob, __u32 *addr)
482 int n = nob; /* XscanfX */
485 if (sscanf(str, "%u.%u.%u.%u%n", &a, &b, &c, &d, &n) >= 4 &&
487 (a & ~0xff) == 0 && (b & ~0xff) == 0 &&
488 (c & ~0xff) == 0 && (d & ~0xff) == 0) {
489 *addr = ((a<<24)|(b<<16)|(c<<8)|d);
495 /* Used by lnet/config.c so it can't be static */
497 cfs_ip_addr_parse(char *str, int len, struct list_head *list)
499 struct cfs_expr_list *el;
508 while (src.ls_str != NULL) {
511 if (!cfs_gettok(&src, '.', &res)) {
516 rc = cfs_expr_list_parse(res.ls_str, res.ls_len, 0, 255, &el);
520 list_add_tail(&el->el_link, list);
529 cfs_expr_list_free_list(list);
535 libcfs_ip_addr_range_print(char *buffer, int count, struct list_head *list)
538 struct cfs_expr_list *el;
540 list_for_each_entry(el, list, el_link) {
543 i += scnprintf(buffer + i, count - i, ".");
544 i += cfs_expr_list_print(buffer + i, count - i, el);
550 * Matches address (\a addr) against address set encoded in \a list.
552 * \retval 1 if \a addr matches
553 * \retval 0 otherwise
556 cfs_ip_addr_match(__u32 addr, struct list_head *list)
558 struct cfs_expr_list *el;
561 list_for_each_entry_reverse(el, list, el_link) {
562 if (!cfs_expr_list_match(addr & 0xff, el))
572 * Print the network part of the nidrange \a nr into the specified \a buffer.
574 * \retval number of characters written
577 libcfs_decnum_addr2str(__u32 addr, char *str, size_t size)
579 snprintf(str, size, "%u", addr);
583 libcfs_num_str2addr(const char *str, int nob, __u32 *addr)
588 if (sscanf(str, "0x%x%n", addr, &n) >= 1 && n == nob)
592 if (sscanf(str, "0X%x%n", addr, &n) >= 1 && n == nob)
596 if (sscanf(str, "%u%n", addr, &n) >= 1 && n == nob)
603 * Nf_parse_addrlist method for networks using numeric addresses.
605 * Examples of such networks are gm and elan.
607 * \retval 0 if \a str parsed to numeric address
608 * \retval errno otherwise
611 libcfs_num_parse(char *str, int len, struct list_head *list)
613 struct cfs_expr_list *el;
616 rc = cfs_expr_list_parse(str, len, 0, MAX_NUMERIC_VALUE, &el);
618 list_add_tail(&el->el_link, list);
624 libcfs_num_addr_range_print(char *buffer, int count, struct list_head *list)
627 struct cfs_expr_list *el;
629 list_for_each_entry(el, list, el_link) {
631 i += cfs_expr_list_print(buffer + i, count - i, el);
637 * Nf_match_addr method for networks using numeric addresses
640 * \retval 0 otherwise
643 libcfs_num_match(__u32 addr, struct list_head *numaddr)
645 struct cfs_expr_list *el;
647 LASSERT(!list_empty(numaddr));
648 el = list_entry(numaddr->next, struct cfs_expr_list, el_link);
650 return cfs_expr_list_match(addr, el);
653 static struct netstrfns libcfs_netstrfns[] = {
656 .nf_modname = "klolnd",
657 .nf_addr2str = libcfs_decnum_addr2str,
658 .nf_str2addr = libcfs_lo_str2addr,
659 .nf_parse_addrlist = libcfs_num_parse,
660 .nf_print_addrlist = libcfs_num_addr_range_print,
661 .nf_match_addr = libcfs_num_match
663 { .nf_type = SOCKLND,
665 .nf_modname = "ksocklnd",
666 .nf_addr2str = libcfs_ip_addr2str,
667 .nf_str2addr = libcfs_ip_str2addr,
668 .nf_parse_addrlist = cfs_ip_addr_parse,
669 .nf_print_addrlist = libcfs_ip_addr_range_print,
670 .nf_match_addr = cfs_ip_addr_match
672 { .nf_type = O2IBLND,
674 .nf_modname = "ko2iblnd",
675 .nf_addr2str = libcfs_ip_addr2str,
676 .nf_str2addr = libcfs_ip_str2addr,
677 .nf_parse_addrlist = cfs_ip_addr_parse,
678 .nf_print_addrlist = libcfs_ip_addr_range_print,
679 .nf_match_addr = cfs_ip_addr_match
683 .nf_modname = "kgnilnd",
684 .nf_addr2str = libcfs_decnum_addr2str,
685 .nf_str2addr = libcfs_num_str2addr,
686 .nf_parse_addrlist = libcfs_num_parse,
687 .nf_print_addrlist = libcfs_num_addr_range_print,
688 .nf_match_addr = libcfs_num_match
690 { .nf_type = GNIIPLND,
692 .nf_modname = "kgnilnd",
693 .nf_addr2str = libcfs_ip_addr2str,
694 .nf_str2addr = libcfs_ip_str2addr,
695 .nf_parse_addrlist = cfs_ip_addr_parse,
696 .nf_print_addrlist = libcfs_ip_addr_range_print,
697 .nf_match_addr = cfs_ip_addr_match
699 { .nf_type = PTL4LND,
701 .nf_modname = "kptl4lnd",
702 .nf_addr2str = libcfs_decnum_addr2str,
703 .nf_str2addr = libcfs_num_str2addr,
704 .nf_parse_addrlist = libcfs_num_parse,
705 .nf_print_addrlist = libcfs_num_addr_range_print,
706 .nf_match_addr = libcfs_num_match
710 static const size_t libcfs_nnetstrfns = ARRAY_SIZE(libcfs_netstrfns);
712 static struct netstrfns *
713 type2net_info(__u32 net_type)
717 for (i = 0; i < libcfs_nnetstrfns; i++) {
718 if (libcfs_netstrfns[i].nf_type == net_type)
719 return &libcfs_netstrfns[i];
726 cfs_match_net(__u32 net_id, __u32 net_type, struct list_head *net_num_list)
733 if (net_type != LNET_NETTYP(net_id))
736 net_num = LNET_NETNUM(net_id);
738 /* if there is a net number but the list passed in is empty, then
741 if (!net_num && list_empty(net_num_list))
743 else if (list_empty(net_num_list))
746 if (!libcfs_num_match(net_num, net_num_list))
753 cfs_match_nid_net(lnet_nid_t nid, __u32 net_type,
754 struct list_head *net_num_list,
755 struct list_head *addr)
758 struct netstrfns *nf;
760 if (!addr || !net_num_list)
763 nf = type2net_info(LNET_NETTYP(LNET_NIDNET(nid)));
764 if (!nf || !net_num_list || !addr)
767 address = LNET_NIDADDR(nid);
769 /* if either the address or net number don't match then no match */
770 if (!nf->nf_match_addr(address, addr) ||
771 !cfs_match_net(LNET_NIDNET(nid), net_type, net_num_list))
776 EXPORT_SYMBOL(cfs_match_nid_net);
778 static struct netstrfns *
779 libcfs_lnd2netstrfns(__u32 lnd)
783 for (i = 0; i < libcfs_nnetstrfns; i++)
784 if (lnd == libcfs_netstrfns[i].nf_type)
785 return &libcfs_netstrfns[i];
790 static struct netstrfns *
791 libcfs_namenum2netstrfns(const char *name)
793 struct netstrfns *nf;
796 for (i = 0; i < libcfs_nnetstrfns; i++) {
797 nf = &libcfs_netstrfns[i];
798 if (!strncmp(name, nf->nf_name, strlen(nf->nf_name)))
804 static struct netstrfns *
805 libcfs_name2netstrfns(const char *name)
809 for (i = 0; i < libcfs_nnetstrfns; i++)
810 if (!strcmp(libcfs_netstrfns[i].nf_name, name))
811 return &libcfs_netstrfns[i];
817 libcfs_isknown_lnd(__u32 lnd)
819 return libcfs_lnd2netstrfns(lnd) != NULL;
821 EXPORT_SYMBOL(libcfs_isknown_lnd);
824 libcfs_lnd2modname(__u32 lnd)
826 struct netstrfns *nf = libcfs_lnd2netstrfns(lnd);
828 return (nf == NULL) ? NULL : nf->nf_modname;
830 EXPORT_SYMBOL(libcfs_lnd2modname);
833 libcfs_str2lnd(const char *str)
835 struct netstrfns *nf = libcfs_name2netstrfns(str);
842 EXPORT_SYMBOL(libcfs_str2lnd);
845 libcfs_lnd2str_r(__u32 lnd, char *buf, size_t buf_size)
847 struct netstrfns *nf;
849 nf = libcfs_lnd2netstrfns(lnd);
851 snprintf(buf, buf_size, "?%u?", lnd);
853 snprintf(buf, buf_size, "%s", nf->nf_name);
857 EXPORT_SYMBOL(libcfs_lnd2str_r);
860 libcfs_net2str_r(__u32 net, char *buf, size_t buf_size)
862 __u32 nnum = LNET_NETNUM(net);
863 __u32 lnd = LNET_NETTYP(net);
864 struct netstrfns *nf;
866 nf = libcfs_lnd2netstrfns(lnd);
868 snprintf(buf, buf_size, "<%u:%u>", lnd, nnum);
870 snprintf(buf, buf_size, "%s", nf->nf_name);
872 snprintf(buf, buf_size, "%s%u", nf->nf_name, nnum);
876 EXPORT_SYMBOL(libcfs_net2str_r);
879 libcfs_nid2str_r(lnet_nid_t nid, char *buf, size_t buf_size)
881 __u32 addr = LNET_NIDADDR(nid);
882 __u32 net = LNET_NIDNET(nid);
883 __u32 nnum = LNET_NETNUM(net);
884 __u32 lnd = LNET_NETTYP(net);
885 struct netstrfns *nf;
887 if (nid == LNET_NID_ANY) {
888 strncpy(buf, "<?>", buf_size);
889 buf[buf_size - 1] = '\0';
893 nf = libcfs_lnd2netstrfns(lnd);
895 snprintf(buf, buf_size, "%x@<%u:%u>", addr, lnd, nnum);
899 nf->nf_addr2str(addr, buf, buf_size);
900 addr_len = strlen(buf);
902 snprintf(buf + addr_len, buf_size - addr_len, "@%s",
905 snprintf(buf + addr_len, buf_size - addr_len, "@%s%u",
911 EXPORT_SYMBOL(libcfs_nid2str_r);
913 static struct netstrfns *
914 libcfs_str2net_internal(const char *str, __u32 *net)
916 struct netstrfns *nf = NULL;
921 for (i = 0; i < libcfs_nnetstrfns; i++) {
922 nf = &libcfs_netstrfns[i];
923 if (!strncmp(str, nf->nf_name, strlen(nf->nf_name)))
927 if (i == libcfs_nnetstrfns)
930 nob = strlen(nf->nf_name);
932 if (strlen(str) == (unsigned int)nob) {
935 if (nf->nf_type == LOLND) /* net number not allowed */
940 if (sscanf(str, "%u%n", &netnum, &i) < 1 ||
941 i != (int)strlen(str))
945 *net = LNET_MKNET(nf->nf_type, netnum);
950 libcfs_str2net(const char *str)
954 if (libcfs_str2net_internal(str, &net) != NULL)
959 EXPORT_SYMBOL(libcfs_str2net);
962 libcfs_str2nid(const char *str)
964 const char *sep = strchr(str, '@');
965 struct netstrfns *nf;
970 nf = libcfs_str2net_internal(sep + 1, &net);
974 sep = str + strlen(str);
975 net = LNET_MKNET(SOCKLND, 0);
976 nf = libcfs_lnd2netstrfns(SOCKLND);
980 if (!nf->nf_str2addr(str, (int)(sep - str), &addr))
983 return LNET_MKNID(net, addr);
985 EXPORT_SYMBOL(libcfs_str2nid);
988 libcfs_id2str(struct lnet_process_id id)
990 char *str = libcfs_next_nidstring();
992 if (id.pid == LNET_PID_ANY) {
993 snprintf(str, LNET_NIDSTR_SIZE,
994 "LNET_PID_ANY-%s", libcfs_nid2str(id.nid));
998 snprintf(str, LNET_NIDSTR_SIZE, "%s%u-%s",
999 ((id.pid & LNET_PID_USERFLAG) != 0) ? "U" : "",
1000 (id.pid & ~LNET_PID_USERFLAG), libcfs_nid2str(id.nid));
1003 EXPORT_SYMBOL(libcfs_id2str);
1006 libcfs_str2anynid(lnet_nid_t *nidp, const char *str)
1008 if (!strcmp(str, "*")) {
1009 *nidp = LNET_NID_ANY;
1013 *nidp = libcfs_str2nid(str);
1014 return *nidp != LNET_NID_ANY;
1016 EXPORT_SYMBOL(libcfs_str2anynid);