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) 2007, 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/
30 * Lustre is a trademark of Sun Microsystems, Inc.
32 * lustre/include/lustre_param.h
34 * User-settable parameter keys
36 * Author: Nathan Rutman <nathan@clusterfs.com>
39 #ifndef _LUSTRE_PARAM_H
40 #define _LUSTRE_PARAM_H
42 #include <libcfs/libcfs.h>
43 #include <lnet/types.h>
45 /** \defgroup param param
50 /* For interoperability */
51 struct cfg_interop_param {
57 int class_find_param(char *buf, char *key, char **valp);
58 struct cfg_interop_param *class_find_old_param(const char *param,
59 struct cfg_interop_param *ptr);
60 int class_get_next_param(char **params, char *copy);
61 int class_match_param(char *buf, const char *key, char **valp);
62 int class_parse_nid(char *buf, lnet_nid_t *nid, char **endh);
63 int class_parse_nid_quiet(char *buf, lnet_nid_t *nid, char **endh);
64 int class_parse_net(char *buf, __u32 *net, char **endh);
65 int class_match_nid(char *buf, char *key, lnet_nid_t nid);
66 int class_match_net(char *buf, char *key, __u32 net);
68 int do_lcfg(char *cfgname, lnet_nid_t nid, int cmd,
69 char *s1, char *s2, char *s3, char *s4);
73 /****************** User-settable parameter keys *********************/
75 tunefs.lustre --param="failover.node=192.168.0.13@tcp0" /dev/sda
76 lctl conf_param testfs-OST0000 failover.node=3@elan,192.168.0.3@tcp0
77 ... testfs-MDT0000.lov.stripesize=4M
78 ... testfs-OST0000.ost.client_cache_seconds=15
79 ... testfs.sys.timeout=<secs>
80 ... testfs.llite.max_read_ahead_mb=16
83 /* System global or special params not handled in obd's proc
84 * See mgs_write_log_sys()
86 #define PARAM_TIMEOUT "timeout=" /* global */
87 #define PARAM_LDLM_TIMEOUT "ldlm_timeout=" /* global */
88 #define PARAM_AT_MIN "at_min=" /* global */
89 #define PARAM_AT_MAX "at_max=" /* global */
90 #define PARAM_AT_EXTRA "at_extra=" /* global */
91 #define PARAM_AT_EARLY_MARGIN "at_early_margin=" /* global */
92 #define PARAM_AT_HISTORY "at_history=" /* global */
93 #define PARAM_JOBID_VAR "jobid_var=" /* global */
94 #define PARAM_MGSNODE "mgsnode=" /* only at mounttime */
95 #define PARAM_FAILNODE "failover.node=" /* add failover nid */
96 #define PARAM_FAILMODE "failover.mode=" /* initial mount only */
97 #define PARAM_ACTIVE "active=" /* activate/deactivate */
98 #define PARAM_NETWORK "network=" /* bind on nid */
99 #define PARAM_ID_UPCALL "identity_upcall=" /* identity upcall */
101 /* Prefixes for parameters handled by obd's proc methods (XXX_process_config) */
102 #define PARAM_OST "ost."
103 #define PARAM_OSD "osd."
104 #define PARAM_OSC "osc."
105 #define PARAM_MDT "mdt."
106 #define PARAM_HSM "mdt.hsm."
107 #define PARAM_MDD "mdd."
108 #define PARAM_MDC "mdc."
109 #define PARAM_LLITE "llite."
110 #define PARAM_LOV "lov."
111 #define PARAM_LOD "lod."
112 #define PARAM_OSP "osp."
113 #define PARAM_SYS "sys." /* global */
114 #define PARAM_SRPC "srpc."
115 #define PARAM_SRPC_FLVR "srpc.flavor."
116 #define PARAM_SRPC_UDESC "srpc.udesc.cli2mdt"
117 #define PARAM_SEC "security."
118 #define PARAM_QUOTA "quota." /* global */
122 #define LUSTRE_MAXFSNAME 8
125 * Check whether the name is valid.
127 * \param name [in] the name to be checked
128 * \param minlen [in] the minimum length of the name
129 * \param maxlen [in] the maximum length of the name
131 * \retval 0 the name is valid
132 * \retval >0 the invalid character in the name
133 * \retval -1 the name is too short
134 * \retval -2 the name is too long
136 static inline int lustre_is_name_valid(const char *name, const int minlen,
150 for (tmp = name; *tmp != '\0'; ++tmp) {
151 if (isalnum(*tmp) || *tmp == '_' || *tmp == '-')
157 return *tmp == '\0' ? 0 : *tmp;
161 * Check whether the fsname is valid.
163 * \param fsname [in] the fsname to be checked
164 * \param minlen [in] the minimum length of the fsname
165 * \param maxlen [in] the maximum length of the fsname
167 * \retval 0 the fsname is valid
168 * \retval >0 the invalid character in the fsname
169 * \retval -1 the fsname is too short
170 * \retval -2 the fsname is too long
172 static inline int lustre_is_fsname_valid(const char *fsname, const int minlen,
175 return lustre_is_name_valid(fsname, minlen, maxlen);
179 * Check whether the poolname is valid.
181 * \param poolname [in] the poolname to be checked
182 * \param minlen [in] the minimum length of the poolname
183 * \param maxlen [in] the maximum length of the poolname
185 * \retval 0 the poolname is valid
186 * \retval >0 the invalid character in the poolname
187 * \retval -1 the poolname is too short
188 * \retval -2 the poolname is too long
190 static inline int lustre_is_poolname_valid(const char *poolname,
191 const int minlen, const int maxlen)
193 return lustre_is_name_valid(poolname, minlen, maxlen);
196 #endif /* _LUSTRE_PARAM_H */