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.sun.com/software/products/lustre/docs/GPLv2.pdf
20 * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara,
21 * CA 95054 USA or visit www.sun.com if you need additional information or
27 * Copyright (c) 2007, 2010, Oracle and/or its affiliates. All rights reserved.
28 * Use is subject to license terms.
30 * Copyright (c) 2011, 2014, Intel Corporation.
33 * This file is part of Lustre, http://www.lustre.org/
34 * Lustre is a trademark of Sun Microsystems, Inc.
36 * lustre/include/lustre_param.h
38 * User-settable parameter keys
40 * Author: Nathan Rutman <nathan@clusterfs.com>
43 #ifndef _LUSTRE_PARAM_H
44 #define _LUSTRE_PARAM_H
46 #include <libcfs/libcfs.h>
47 #include <lnet/types.h>
49 /** \defgroup param param
54 /* For interoperability */
55 struct cfg_interop_param {
61 int class_find_param(char *buf, char *key, char **valp);
62 struct cfg_interop_param *class_find_old_param(const char *param,
63 struct cfg_interop_param *ptr);
64 int class_get_next_param(char **params, char *copy);
65 int class_match_param(char *buf, const char *key, char **valp);
66 int class_parse_nid(char *buf, lnet_nid_t *nid, char **endh);
67 int class_parse_nid_quiet(char *buf, lnet_nid_t *nid, char **endh);
68 int class_parse_net(char *buf, __u32 *net, char **endh);
69 int class_match_nid(char *buf, char *key, lnet_nid_t nid);
70 int class_match_net(char *buf, char *key, __u32 net);
72 int do_lcfg(char *cfgname, lnet_nid_t nid, int cmd,
73 char *s1, char *s2, char *s3, char *s4);
77 /****************** User-settable parameter keys *********************/
79 tunefs.lustre --param="failover.node=192.168.0.13@tcp0" /dev/sda
80 lctl conf_param testfs-OST0000 failover.node=3@elan,192.168.0.3@tcp0
81 ... testfs-MDT0000.lov.stripesize=4M
82 ... testfs-OST0000.ost.client_cache_seconds=15
83 ... testfs.sys.timeout=<secs>
84 ... testfs.llite.max_read_ahead_mb=16
87 /* System global or special params not handled in obd's proc
88 * See mgs_write_log_sys()
90 #define PARAM_TIMEOUT "timeout=" /* global */
91 #define PARAM_LDLM_TIMEOUT "ldlm_timeout=" /* global */
92 #define PARAM_AT_MIN "at_min=" /* global */
93 #define PARAM_AT_MAX "at_max=" /* global */
94 #define PARAM_AT_EXTRA "at_extra=" /* global */
95 #define PARAM_AT_EARLY_MARGIN "at_early_margin=" /* global */
96 #define PARAM_AT_HISTORY "at_history=" /* global */
97 #define PARAM_JOBID_VAR "jobid_var=" /* global */
98 #define PARAM_MGSNODE "mgsnode=" /* only at mounttime */
99 #define PARAM_FAILNODE "failover.node=" /* add failover nid */
100 #define PARAM_FAILMODE "failover.mode=" /* initial mount only */
101 #define PARAM_ACTIVE "active=" /* activate/deactivate */
102 #define PARAM_NETWORK "network=" /* bind on nid */
103 #define PARAM_ID_UPCALL "identity_upcall=" /* identity upcall */
105 /* Prefixes for parameters handled by obd's proc methods (XXX_process_config) */
106 #define PARAM_OST "ost."
107 #define PARAM_OSD "osd."
108 #define PARAM_OSC "osc."
109 #define PARAM_MDT "mdt."
110 #define PARAM_HSM "mdt.hsm."
111 #define PARAM_MDD "mdd."
112 #define PARAM_MDC "mdc."
113 #define PARAM_LLITE "llite."
114 #define PARAM_LOV "lov."
115 #define PARAM_LOD "lod."
116 #define PARAM_OSP "osp."
117 #define PARAM_SYS "sys." /* global */
118 #define PARAM_SRPC "srpc."
119 #define PARAM_SRPC_FLVR "srpc.flavor."
120 #define PARAM_SRPC_UDESC "srpc.udesc.cli2mdt"
121 #define PARAM_SEC "security."
122 #define PARAM_QUOTA "quota." /* global */
126 #define LUSTRE_MAXFSNAME 8
129 * Check whether the name is valid.
131 * \param name [in] the name to be checked
132 * \param minlen [in] the minimum length of the name
133 * \param maxlen [in] the maximum length of the name
135 * \retval 0 the name is valid
136 * \retval >0 the invalid character in the name
137 * \retval -1 the name is too short
138 * \retval -2 the name is too long
140 static inline int lustre_is_name_valid(const char *name, const int minlen,
154 for (tmp = name; *tmp != '\0'; ++tmp) {
155 if (isalnum(*tmp) || *tmp == '_' || *tmp == '-')
161 return *tmp == '\0' ? 0 : *tmp;
165 * Check whether the fsname is valid.
167 * \param fsname [in] the fsname to be checked
168 * \param minlen [in] the minimum length of the fsname
169 * \param maxlen [in] the maximum length of the fsname
171 * \retval 0 the fsname is valid
172 * \retval >0 the invalid character in the fsname
173 * \retval -1 the fsname is too short
174 * \retval -2 the fsname is too long
176 static inline int lustre_is_fsname_valid(const char *fsname, const int minlen,
179 return lustre_is_name_valid(fsname, minlen, maxlen);
183 * Check whether the poolname is valid.
185 * \param poolname [in] the poolname to be checked
186 * \param minlen [in] the minimum length of the poolname
187 * \param maxlen [in] the maximum length of the poolname
189 * \retval 0 the poolname is valid
190 * \retval >0 the invalid character in the poolname
191 * \retval -1 the poolname is too short
192 * \retval -2 the poolname is too long
194 static inline int lustre_is_poolname_valid(const char *poolname,
195 const int minlen, const int maxlen)
197 return lustre_is_name_valid(poolname, minlen, maxlen);
200 #endif /* _LUSTRE_PARAM_H */