Whamcloud - gitweb
LU-6401 uapi: turn lustre_param.h into a proper UAPI header 25/24325/13
authorJames Simmons <uja.ornl@yahoo.com>
Wed, 3 May 2017 20:00:21 +0000 (16:00 -0400)
committerOleg Drokin <oleg.drokin@intel.com>
Sat, 20 May 2017 18:45:39 +0000 (18:45 +0000)
Move all the kernel specific function prototypes from
lustre_param.h into obd_config.h which is a kernel only
header. The inline functions lustre_is_*_valid are used
only by user land so we can remove them. Remove the user
land error checking with lustre_is_*_valid() since its
the job of the kernel to validate the date passed in.
The libcfs.h header shouldn't be exposed to user land
so remove it.

Change-Id: I6b6b4fe8f4d6799608c0e74318afecb85168ad54
Signed-off-by: James Simmons <uja.ornl@yahoo.com>
Reviewed-on: https://review.whamcloud.com/24325
Tested-by: Jenkins
Reviewed-by: Ben Evans <bevans@cray.com>
Tested-by: Maloo <hpdd-maloo@intel.com>
Reviewed-by: John L. Hammond <john.hammond@intel.com>
Reviewed-by: Oleg Drokin <oleg.drokin@intel.com>
38 files changed:
lustre/include/Makefile.am
lustre/include/lustre_param.h [deleted file]
lustre/include/obd_class.h
lustre/include/uapi/linux/Makefile.am
lustre/include/uapi/linux/lustre_param.h [new file with mode: 0644]
lustre/llite/llite_lib.c
lustre/llite/lproc_llite.c
lustre/lod/lod_dev.c
lustre/lod/lod_object.c
lustre/lod/lod_sub_object.c
lustre/lod/lproc_lod.c
lustre/lov/lov_obd.c
lustre/lov/lproc_lov.c
lustre/mdc/mdc_request.c
lustre/mdd/mdd_device.c
lustre/mdd/mdd_object.c
lustre/mdt/mdt_handler.c
lustre/mdt/mdt_mds.c
lustre/mgs/lproc_mgs.c
lustre/mgs/mgs_handler.c
lustre/mgs/mgs_llog.c
lustre/obdclass/obd_config.c
lustre/obdclass/obd_mount.c
lustre/obdclass/obd_mount_server.c
lustre/ofd/ofd_dev.c
lustre/osc/osc_request.c
lustre/osd-ldiskfs/osd_handler.c
lustre/osd-zfs/osd_handler.c
lustre/osp/lwp_dev.c
lustre/osp/osp_dev.c
lustre/ptlrpc/sec_config.c
lustre/quota/qsd_config.c
lustre/utils/lfs.c
lustre/utils/liblustreapi.c
lustre/utils/mkfs_lustre.c
lustre/utils/mount_utils.h
lustre/utils/mount_utils_ldiskfs.c
lustre/utils/obd.c

index 44ff84d..b00a1be 100644 (file)
@@ -78,7 +78,6 @@ EXTRA_DIST = \
        lustre_nrs_orr.h \
        lustre_nrs_tbf.h \
        lustre_obdo.h \
-       lustre_param.h \
        lustre_patchless_compat.h \
        lustre_quota.h \
        lustre_req_layout.h \
diff --git a/lustre/include/lustre_param.h b/lustre/include/lustre_param.h
deleted file mode 100644 (file)
index eb2f5fa..0000000
+++ /dev/null
@@ -1,196 +0,0 @@
-/*
- * GPL HEADER START
- *
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License version 2 only,
- * as published by the Free Software Foundation.
- *
- * This program is distributed in the hope that it will be useful, but
- * WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
- * General Public License version 2 for more details (a copy is included
- * in the LICENSE file that accompanied this code).
- *
- * You should have received a copy of the GNU General Public License
- * version 2 along with this program; If not, see
- * http://www.gnu.org/licenses/gpl-2.0.html
- *
- * GPL HEADER END
- */
-/*
- * Copyright (c) 2007, 2010, Oracle and/or its affiliates. All rights reserved.
- * Use is subject to license terms.
- *
- * Copyright (c) 2011, 2015, Intel Corporation.
- */
-/*
- * This file is part of Lustre, http://www.lustre.org/
- * Lustre is a trademark of Sun Microsystems, Inc.
- *
- * lustre/include/lustre_param.h
- *
- * User-settable parameter keys
- *
- * Author: Nathan Rutman <nathan@clusterfs.com>
- */
-
-#ifndef _LUSTRE_PARAM_H
-#define _LUSTRE_PARAM_H
-
-#include <libcfs/libcfs.h>
-#include <lnet/types.h>
-
-/** \defgroup param param
- *
- * @{
- */
-
-/* For interoperability */
-struct cfg_interop_param {
-       char *old_param;
-       char *new_param;
-};
-
-/* obd_config.c */
-int class_find_param(char *buf, char *key, char **valp);
-struct cfg_interop_param *class_find_old_param(const char *param,
-                                              struct cfg_interop_param *ptr);
-int class_get_next_param(char **params, char *copy);
-int class_match_param(char *buf, const char *key, char **valp);
-int class_parse_nid(char *buf, lnet_nid_t *nid, char **endh);
-int class_parse_nid_quiet(char *buf, lnet_nid_t *nid, char **endh);
-int class_parse_net(char *buf, __u32 *net, char **endh);
-int class_match_nid(char *buf, char *key, lnet_nid_t nid);
-int class_match_net(char *buf, char *key, __u32 net);
-/* obd_mount.c */
-int do_lcfg(char *cfgname, lnet_nid_t nid, int cmd,
-            char *s1, char *s2, char *s3, char *s4);
-
-
-
-/****************** User-settable parameter keys *********************/
-/* e.g.
-        tunefs.lustre --param="failover.node=192.168.0.13@tcp0" /dev/sda
-        lctl conf_param testfs-OST0000 failover.node=3@elan,192.168.0.3@tcp0
-                    ... testfs-MDT0000.lov.stripesize=4M
-                    ... testfs-OST0000.ost.client_cache_seconds=15
-                    ... testfs.sys.timeout=<secs>
-                    ... testfs.llite.max_read_ahead_mb=16
-*/
-
-/* System global or special params not handled in obd's proc
- * See mgs_write_log_sys()
- */
-#define PARAM_TIMEOUT              "timeout="          /* global */
-#define PARAM_LDLM_TIMEOUT         "ldlm_timeout="     /* global */
-#define PARAM_AT_MIN               "at_min="           /* global */
-#define PARAM_AT_MAX               "at_max="           /* global */
-#define PARAM_AT_EXTRA             "at_extra="         /* global */
-#define PARAM_AT_EARLY_MARGIN      "at_early_margin="  /* global */
-#define PARAM_AT_HISTORY           "at_history="       /* global */
-#define PARAM_JOBID_VAR                   "jobid_var="        /* global */
-#define PARAM_MGSNODE              "mgsnode="          /* only at mounttime */
-#define PARAM_FAILNODE             "failover.node="    /* add failover nid */
-#define PARAM_FAILMODE             "failover.mode="    /* initial mount only */
-#define PARAM_ACTIVE               "active="           /* activate/deactivate */
-#define PARAM_NETWORK              "network="          /* bind on nid */
-#define PARAM_ID_UPCALL                "identity_upcall="  /* identity upcall */
-
-/* Prefixes for parameters handled by obd's proc methods (XXX_process_config) */
-#define PARAM_OST              "ost."
-#define PARAM_OSD              "osd."
-#define PARAM_OSC              "osc."
-#define PARAM_MDT              "mdt."
-#define PARAM_HSM              "mdt.hsm."
-#define PARAM_MDD              "mdd."
-#define PARAM_MDC              "mdc."
-#define PARAM_LLITE            "llite."
-#define PARAM_LOV              "lov."
-#define PARAM_LOD              "lod."
-#define PARAM_OSP              "osp."
-#define PARAM_SYS              "sys."          /* global */
-#define PARAM_SRPC             "srpc."
-#define PARAM_SRPC_FLVR                "srpc.flavor."
-#define PARAM_SRPC_UDESC       "srpc.udesc.cli2mdt"
-#define PARAM_SEC              "security."
-#define PARAM_QUOTA            "quota."        /* global */
-
-/** @} param */
-
-#define LUSTRE_MAXFSNAME       8
-
-/**
- * Check whether the name is valid.
- *
- * \param name [in]    the name to be checked
- * \param minlen [in]  the minimum length of the name
- * \param maxlen [in]  the maximum length of the name
- *
- * \retval 0   the name is valid
- * \retval >0  the invalid character in the name
- * \retval -1  the name is too short
- * \retval -2  the name is too long
- */
-static inline int lustre_is_name_valid(const char *name, const int minlen,
-                                      const int maxlen)
-{
-       const char      *tmp;
-       size_t          len;
-
-       len = strlen(name);
-
-       if (len < minlen)
-               return -1;
-
-       if (len > maxlen)
-               return -2;
-
-       for (tmp = name; *tmp != '\0'; ++tmp) {
-               if (isalnum(*tmp) || *tmp == '_' || *tmp == '-')
-                       continue;
-               else
-                       break;
-       }
-
-       return *tmp == '\0' ? 0 : *tmp;
-}
-
-/**
- * Check whether the fsname is valid.
- *
- * \param fsname [in]  the fsname to be checked
- * \param minlen [in]  the minimum length of the fsname
- * \param maxlen [in]  the maximum length of the fsname
- *
- * \retval 0   the fsname is valid
- * \retval >0  the invalid character in the fsname
- * \retval -1  the fsname is too short
- * \retval -2  the fsname is too long
- */
-static inline int lustre_is_fsname_valid(const char *fsname, const int minlen,
-                                        const int maxlen)
-{
-       return lustre_is_name_valid(fsname, minlen, maxlen);
-}
-
-/**
- * Check whether the poolname is valid.
- *
- * \param poolname [in]        the poolname to be checked
- * \param minlen [in]  the minimum length of the poolname
- * \param maxlen [in]  the maximum length of the poolname
- *
- * \retval 0   the poolname is valid
- * \retval >0  the invalid character in the poolname
- * \retval -1  the poolname is too short
- * \retval -2  the poolname is too long
- */
-static inline int lustre_is_poolname_valid(const char *poolname,
-                                          const int minlen, const int maxlen)
-{
-       return lustre_is_name_valid(poolname, minlen, maxlen);
-}
-
-#endif /* _LUSTRE_PARAM_H */
index 0fafed0..5ae50e0 100644 (file)
@@ -122,6 +122,12 @@ void obd_stale_export_put(struct obd_export *exp);
 void obd_stale_export_adjust(struct obd_export *exp);
 
 /* obd_config.c */
+/* For interoperability */
+struct cfg_interop_param {
+       char *old_param;
+       char *new_param;
+};
+
 struct lustre_cfg *lustre_cfg_rename(struct lustre_cfg *cfg,
                                     const char *new_name);
 int class_process_config(struct lustre_cfg *lcfg);
@@ -131,6 +137,18 @@ int class_attach(struct lustre_cfg *lcfg);
 int class_setup(struct obd_device *obd, struct lustre_cfg *lcfg);
 int class_cleanup(struct obd_device *obd, struct lustre_cfg *lcfg);
 int class_detach(struct obd_device *obd, struct lustre_cfg *lcfg);
+
+int class_find_param(char *buf, char *key, char **valp);
+struct cfg_interop_param *class_find_old_param(const char *param,
+                                              struct cfg_interop_param *ptr);
+int class_get_next_param(char **params, char *copy);
+int class_match_param(char *buf, const char *key, char **valp);
+int class_parse_nid(char *buf, lnet_nid_t *nid, char **endh);
+int class_parse_nid_quiet(char *buf, lnet_nid_t *nid, char **endh);
+int class_parse_net(char *buf, u32 *net, char **endh);
+int class_match_nid(char *buf, char *key, lnet_nid_t nid);
+int class_match_net(char *buf, char *key, u32 net);
+
 struct obd_device *class_incref(struct obd_device *obd,
                                 const char *scope, const void *source);
 void class_decref(struct obd_device *obd,
index b07e08a..fa01e3d 100644 (file)
@@ -33,4 +33,5 @@ EXTRA_DIST = \
        lustre_disk.h \
        lustre_fid.h \
        lustre_ioctl.h \
-       lustre_ostid.h
+       lustre_ostid.h \
+       lustre_param.h
diff --git a/lustre/include/uapi/linux/lustre_param.h b/lustre/include/uapi/linux/lustre_param.h
new file mode 100644 (file)
index 0000000..022d253
--- /dev/null
@@ -0,0 +1,94 @@
+/*
+ * GPL HEADER START
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License version 2 only,
+ * as published by the Free Software Foundation.
+ *
+ * This program is distributed in the hope that it will be useful, but
+ * WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+ * General Public License version 2 for more details (a copy is included
+ * in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License
+ * version 2 along with this program; If not, see
+ * http://www.gnu.org/licenses/gpl-2.0.html
+ *
+ * GPL HEADER END
+ */
+/*
+ * Copyright (c) 2007, 2010, Oracle and/or its affiliates. All rights reserved.
+ * Use is subject to license terms.
+ *
+ * Copyright (c) 2011, 2015, Intel Corporation.
+ */
+/*
+ * This file is part of Lustre, http://www.lustre.org/
+ * Lustre is a trademark of Sun Microsystems, Inc.
+ *
+ * User-settable parameter keys
+ *
+ * Author: Nathan Rutman <nathan@clusterfs.com>
+ */
+
+#ifndef _UAPI_LUSTRE_PARAM_H
+#define _UAPI_LUSTRE_PARAM_H
+
+/** \defgroup param param
+ *
+ * @{
+ */
+
+/****************** User-settable parameter keys *********************/
+/* e.g.
+ *     tunefs.lustre --param="failover.node=192.168.0.13@tcp0" /dev/sda
+ *     lctl conf_param testfs-OST0000 failover.node=3@elan,192.168.0.3@tcp0
+ *                 ... testfs-MDT0000.lov.stripesize=4M
+ *                 ... testfs-OST0000.ost.client_cache_seconds=15
+ *                 ... testfs.sys.timeout=<secs>
+ *                 ... testfs.llite.max_read_ahead_mb=16
+ */
+
+/* System global or special params not handled in obd's proc
+ * See mgs_write_log_sys()
+ */
+#define PARAM_TIMEOUT              "timeout="          /* global */
+#define PARAM_LDLM_TIMEOUT         "ldlm_timeout="     /* global */
+#define PARAM_AT_MIN               "at_min="           /* global */
+#define PARAM_AT_MAX               "at_max="           /* global */
+#define PARAM_AT_EXTRA             "at_extra="         /* global */
+#define PARAM_AT_EARLY_MARGIN      "at_early_margin="  /* global */
+#define PARAM_AT_HISTORY           "at_history="       /* global */
+#define PARAM_JOBID_VAR                   "jobid_var="        /* global */
+#define PARAM_MGSNODE              "mgsnode="          /* only at mounttime */
+#define PARAM_FAILNODE             "failover.node="    /* add failover nid */
+#define PARAM_FAILMODE             "failover.mode="    /* initial mount only */
+#define PARAM_ACTIVE               "active="           /* activate/deactivate */
+#define PARAM_NETWORK              "network="          /* bind on nid */
+#define PARAM_ID_UPCALL                "identity_upcall="  /* identity upcall */
+
+/* Prefixes for parameters handled by obd's proc methods (XXX_process_config) */
+#define PARAM_OST              "ost."
+#define PARAM_OSD              "osd."
+#define PARAM_OSC              "osc."
+#define PARAM_MDT              "mdt."
+#define PARAM_HSM              "mdt.hsm."
+#define PARAM_MDD              "mdd."
+#define PARAM_MDC              "mdc."
+#define PARAM_LLITE            "llite."
+#define PARAM_LOV              "lov."
+#define PARAM_LOD              "lod."
+#define PARAM_OSP              "osp."
+#define PARAM_SYS              "sys."          /* global */
+#define PARAM_SRPC             "srpc."
+#define PARAM_SRPC_FLVR                "srpc.flavor."
+#define PARAM_SRPC_UDESC       "srpc.udesc.cli2mdt"
+#define PARAM_SEC              "security."
+#define PARAM_QUOTA            "quota."        /* global */
+
+/** @} param */
+
+#endif /* _UAPI_LUSTRE_PARAM_H */
index 53ac328..c3c149c 100644 (file)
@@ -53,7 +53,7 @@
 #include <lustre_dlm.h>
 #include <lprocfs_status.h>
 #include <lustre_disk.h>
-#include <lustre_param.h>
+#include <uapi/linux/lustre_param.h>
 #include <lustre_log.h>
 #include <cl_object.h>
 #include <obd_cksum.h>
index 30fad42..63ccf88 100644 (file)
@@ -36,7 +36,7 @@
 #ifdef HAVE_UIDGID_HEADER
 # include <linux/uidgid.h>
 #endif
-#include <lustre_param.h>
+#include <uapi/linux/lustre_param.h>
 #include <lprocfs_status.h>
 #include <obd_support.h>
 
index 7c4078e..8d95026 100644 (file)
@@ -93,7 +93,7 @@
 #include <obd_class.h>
 #include <md_object.h>
 #include <lustre_fid.h>
-#include <lustre_param.h>
+#include <uapi/linux/lustre_param.h>
 #include <lustre_update.h>
 #include <lustre_log.h>
 
index 52537b6..2318bdb 100644 (file)
@@ -47,7 +47,7 @@
 #include <lustre_fid.h>
 #include <lustre_linkea.h>
 #include <lustre_lmv.h>
-#include <lustre_param.h>
+#include <uapi/linux/lustre_param.h>
 #include <lustre_swab.h>
 #include <lustre_ver.h>
 #include <lprocfs_status.h>
index 2b0d71e..a81d619 100644 (file)
@@ -47,7 +47,7 @@
 #include <lprocfs_status.h>
 
 #include <lustre_fid.h>
-#include <lustre_param.h>
+#include <uapi/linux/lustre_param.h>
 #include <md_object.h>
 #include <lustre_linkea.h>
 #include <lustre_log.h>
index 0c4a391..1144165 100644 (file)
@@ -35,7 +35,7 @@
 #include <obd_class.h>
 #include <linux/seq_file.h>
 #include "lod_internal.h"
-#include <lustre_param.h>
+#include <uapi/linux/lustre_param.h>
 
 /*
  * Notice, all the functions below (except for lod_procfs_init() and
index d5a9f7a..563f121 100644 (file)
@@ -49,7 +49,7 @@
 #include <lustre_lib.h>
 #include <lustre_mds.h>
 #include <lustre_net.h>
-#include <lustre_param.h>
+#include <uapi/linux/lustre_param.h>
 #include <lustre_swab.h>
 #include <lprocfs_status.h>
 #include <obd_class.h>
index 1bd4275..25b4e17 100644 (file)
@@ -35,7 +35,7 @@
 #include <asm/statfs.h>
 #include <lprocfs_status.h>
 #include <obd_class.h>
-#include <lustre_param.h>
+#include <uapi/linux/lustre_param.h>
 #include "lov_internal.h"
 
 #ifdef CONFIG_PROC_FS
index 2410df8..349ba27 100644 (file)
@@ -53,7 +53,7 @@
 #include <lustre_kernelcomm.h>
 #include <lustre_lmv.h>
 #include <lustre_log.h>
-#include <lustre_param.h>
+#include <uapi/linux/lustre_param.h>
 #include <lustre_swab.h>
 #include <obd_class.h>
 
index 91b3fee..d11d1ea 100644 (file)
@@ -45,7 +45,7 @@
 #include <lustre_mds.h>
 #include <obd_support.h>
 #include <lu_object.h>
-#include <lustre_param.h>
+#include <uapi/linux/lustre_param.h>
 #include <lustre_fid.h>
 #include <lustre_nodemap.h>
 #include <lustre_barrier.h>
index cc32f59..03e8e5a 100644 (file)
@@ -46,7 +46,7 @@
 /* fid_be_cpu(), fid_cpu_to_be(). */
 #include <lustre_fid.h>
 #include <lustre_idmap.h>
-#include <lustre_param.h>
+#include <uapi/linux/lustre_param.h>
 #include <lustre_mds.h>
 #include <lustre/lustre_idl.h>
 
index f90593c..2a2063e 100644 (file)
@@ -56,7 +56,7 @@
 #include <lustre_net.h>
 #include <lustre_nodemap.h>
 #include <lustre_mds.h>
-#include <lustre_param.h>
+#include <uapi/linux/lustre_param.h>
 #include <lustre_quota.h>
 #include <lustre_swab.h>
 #include <obd.h>
index 1105242..7c5560d 100644 (file)
@@ -52,7 +52,7 @@
 #include "mdt_internal.h"
 #include <lustre_quota.h>
 #include <lustre_acl.h>
-#include <lustre_param.h>
+#include <uapi/linux/lustre_param.h>
 
 struct mds_device {
        /* super-class */
index 4be26c5..3caf79c 100644 (file)
@@ -36,7 +36,7 @@
 #include <obd.h>
 #include <obd_class.h>
 #include <lprocfs_status.h>
-#include <lustre_param.h>
+#include <uapi/linux/lustre_param.h>
 #include "mgs_internal.h"
 
 #ifdef CONFIG_PROC_FS
index 1c73276..7ef4c27 100644 (file)
@@ -42,7 +42,7 @@
 #include <obd_class.h>
 #include <lprocfs_status.h>
 #include <uapi/linux/lustre_ioctl.h>
-#include <lustre_param.h>
+#include <uapi/linux/lustre_param.h>
 #include <lustre/lustre_barrier_user.h>
 
 #include "mgs_internal.h"
@@ -729,22 +729,43 @@ static inline int mgs_destroy_export(struct obd_export *exp)
         RETURN(0);
 }
 
-static int mgs_extract_fs_pool(char * arg, char *fsname, char *poolname)
+static int mgs_extract_fs_pool(char *arg, char *fsname, char *poolname)
 {
-        char *ptr;
+       size_t len;
+       char *ptr;
 
-        ENTRY;
-        for (ptr = arg;  (*ptr != '\0') && (*ptr != '.'); ptr++ ) {
-                *fsname = *ptr;
-                fsname++;
-        }
-        if (*ptr == '\0')
-                return -EINVAL;
-        *fsname = '\0';
-        ptr++;
-        strcpy(poolname, ptr);
+       ENTRY;
+       /* Validate name */
+       for (ptr = arg; *ptr != '\0'; ptr++) {
+               if (!isalnum(*ptr) && *ptr != '_' && *ptr != '-' && *ptr != '.')
+                       return -EINVAL;
+       }
 
-        RETURN(0);
+       /* Test for fsname.poolname format.
+        * strlen() test if poolname is empty
+        */
+       ptr = strchr(arg, '.');
+       if (!ptr || !strlen(ptr))
+               return -EINVAL;
+       ptr++;
+
+       /* Also make sure poolname is not to long. */
+       if (strlen(ptr) > LOV_MAXPOOLNAME)
+               return -ENAMETOOLONG;
+       strncpy(poolname, ptr, strlen(ptr));
+
+       /* Test if fsname is empty */
+       len = strlen(arg) - strlen(ptr) - 1;
+       if (!len)
+               return -EINVAL;
+
+       /* or too long */
+       if (len > MTI_NAME_MAXLEN)
+               return -ENAMETOOLONG;
+
+       strncpy(fsname, arg, len);
+
+       RETURN(0);
 }
 
 static int mgs_iocontrol_nodemap(const struct lu_env *env,
index 895a1e2..68c8681 100644 (file)
@@ -43,7 +43,7 @@
 
 #include <obd.h>
 #include <uapi/linux/lustre_ioctl.h>
-#include <lustre_param.h>
+#include <uapi/linux/lustre_param.h>
 #include <lustre_sec.h>
 #include <lustre_quota.h>
 
index 07b3ab0..2df9664 100644 (file)
@@ -43,7 +43,7 @@
 #include <lustre_disk.h>
 #include <uapi/linux/lustre_ioctl.h>
 #include <lustre_log.h>
-#include <lustre_param.h>
+#include <uapi/linux/lustre_param.h>
 #include <obd_class.h>
 
 #include "llog_internal.h"
index db8a225..394ee14 100644 (file)
@@ -47,7 +47,7 @@
 #include <linux/version.h>
 #include <lustre_log.h>
 #include <lustre_disk.h>
-#include <lustre_param.h>
+#include <uapi/linux/lustre_param.h>
 
 static int (*client_fill_super)(struct super_block *sb,
                                struct vfsmount *mnt);
@@ -151,11 +151,11 @@ EXPORT_SYMBOL(lustre_end_log);
 /** lustre_cfg_bufs are a holdover from 1.4; we can still set these up from
  * lctl (and do for echo cli/srv.
  */
-int do_lcfg(char *cfgname, lnet_nid_t nid, int cmd,
-            char *s1, char *s2, char *s3, char *s4)
+static int do_lcfg(char *cfgname, lnet_nid_t nid, int cmd,
+                  char *s1, char *s2, char *s3, char *s4)
 {
         struct lustre_cfg_bufs bufs;
-        struct lustre_cfg    * lcfg = NULL;
+       struct lustre_cfg *lcfg = NULL;
         int rc;
 
         CDEBUG(D_TRACE, "lcfg %s %#x %s %s %s %s\n", cfgname,
index e3e675e..cec80aa 100644 (file)
@@ -57,7 +57,7 @@
 #include <lustre_disk.h>
 #include <uapi/linux/lustre_ioctl.h>
 #include <lustre_log.h>
-#include <lustre_param.h>
+#include <uapi/linux/lustre_param.h>
 #include <obd.h>
 #include <obd_class.h>
 
index 96d5de9..31c17f9 100644 (file)
@@ -70,7 +70,7 @@
 
 #include <obd_class.h>
 #include <obd_cksum.h>
-#include <lustre_param.h>
+#include <uapi/linux/lustre_param.h>
 #include <lustre_fid.h>
 #include <lustre_lfsck.h>
 #include <lustre/lustre_idl.h>
index b9c2153..6038107 100644 (file)
@@ -44,7 +44,7 @@
 #include <uapi/linux/lustre_ioctl.h>
 #include <lustre_net.h>
 #include <lustre_obdo.h>
-#include <lustre_param.h>
+#include <uapi/linux/lustre_param.h>
 #include <obd.h>
 #include <obd_cksum.h>
 #include <obd_class.h>
index e440762..c950c21 100644 (file)
@@ -67,7 +67,7 @@
 #include <lustre_net.h>
 #include <lustre_fid.h>
 /* process_config */
-#include <lustre_param.h>
+#include <uapi/linux/lustre_param.h>
 
 #include "osd_internal.h"
 #include "osd_dynlocks.h"
index 4954e2a..47a8e82 100644 (file)
@@ -47,7 +47,7 @@
 #include <obd_class.h>
 #include <lustre_disk.h>
 #include <lustre_fid.h>
-#include <lustre_param.h>
+#include <uapi/linux/lustre_param.h>
 #include <md_object.h>
 
 #include "osd_internal.h"
index 7d47dc7..d11a320 100644 (file)
@@ -40,7 +40,7 @@
 #define DEBUG_SUBSYSTEM S_OST
 
 #include <obd_class.h>
-#include <lustre_param.h>
+#include <uapi/linux/lustre_param.h>
 #include <lustre_log.h>
 #include <linux/kthread.h>
 
index 8c0e0c5..52b624c 100644 (file)
@@ -75,7 +75,7 @@
 #include <uapi/linux/lustre_ioctl.h>
 #include <lustre_log.h>
 #include <lustre_obdo.h>
-#include <lustre_param.h>
+#include <uapi/linux/lustre_param.h>
 #include <obd_class.h>
 
 #include "osp_internal.h"
index 5fc4dc4..4951efe 100644 (file)
@@ -44,7 +44,7 @@
 #include <lustre_log.h>
 #include <lustre_disk.h>
 #include <lustre_dlm.h>
-#include <lustre_param.h>
+#include <uapi/linux/lustre_param.h>
 #include <lustre_sec.h>
 
 #include "ptlrpc_internal.h"
index 08cbeb6..91e1386 100644 (file)
@@ -31,7 +31,7 @@
 #define DEBUG_SUBSYSTEM S_LQUOTA
 
 #include <obd_class.h>
-#include <lustre_param.h>
+#include <uapi/linux/lustre_param.h>
 
 #include "qsd_internal.h"
 
index aa46f2d..4b21114 100644 (file)
@@ -66,7 +66,7 @@
 #include <libcfs/util/parser.h>
 #include <lustre/lustreapi.h>
 #include <lustre_ver.h>
-#include <lustre_param.h>
+#include <linux/lustre_param.h>
 
 #ifndef ARRAY_SIZE
 # define ARRAY_SIZE(a) ((sizeof(a)) / (sizeof((a)[0])))
@@ -1011,42 +1011,19 @@ static int parse_targets(__u32 *osts, int size, int offset, char *arg)
 
 static int verify_pool_name(char *prog_name, char *pool_name)
 {
-       char    *ptr;
-       int      rc;
+       char *ptr;
 
        if (pool_name == NULL)
                return 0;
 
        ptr = strchr(pool_name, '.');
-       if (ptr == NULL) {
-               ptr = pool_name;
-       } else {
-               if (ptr == pool_name) {
-                       fprintf(stderr, "error: %s: fsname is empty "
-                               "in pool name '%s'\n",
-                               prog_name, pool_name);
-                       return -EINVAL;
-               }
-               ++ptr;
-       }
-
-       rc = lustre_is_poolname_valid(ptr, 1, LOV_MAXPOOLNAME);
-       if (rc == -1) {
-               fprintf(stderr, "error: %s: poolname '%s' is empty\n",
+       if (ptr != NULL && ptr == pool_name) {
+               fprintf(stderr, "error: %s: fsname is empty in pool name '%s'\n",
                        prog_name, pool_name);
                return -EINVAL;
-       } else if (rc == -2) {
-               fprintf(stderr, "error: %s: pool name '%s' is too long "
-                       "(max is %d characters)\n",
-                       prog_name, pool_name, LOV_MAXPOOLNAME);
-               return -EINVAL;
-       } else if (rc > 0) {
-               fprintf(stderr, "error: %s: char '%c' not allowed in "
-                       "pool name '%s'\n",
-                       prog_name, rc, pool_name);
-               return -EINVAL;
        }
-       return rc;
+
+       return 0;
 }
 
 struct lfs_setstripe_args {
index df4c165..5073a73 100644 (file)
@@ -41,6 +41,7 @@
 #define _GNU_SOURCE
 #endif
 
+#include <ctype.h>
 #include <mntent.h>
 #include <stdlib.h>
 #include <stdio.h>
index 69fc7e8..7bf83ea 100644 (file)
@@ -61,7 +61,7 @@
 #include <limits.h>
 #include <ctype.h>
 #include <lnet/nidstr.h>
-#include <lustre_param.h>
+#include <linux/lustre_param.h>
 #include <lnet/lnetctl.h>
 #include <lustre_ver.h>
 
@@ -514,23 +514,9 @@ int parse_opts(int argc, char *const argv[], struct mkfs_opts *mop,
                        ldd->ldd_flags &= ~LDD_F_NEED_INDEX;
                        break;
                }
-               case 'L': {
-                       rc = lustre_is_fsname_valid(optarg, 1,
-                                                   LUSTRE_MAXFSNAME);
-                       if (rc < 0) {
-                               fprintf(stderr, "%s: filesystem name must be "
-                                       "1-%d chars\n", progname,
-                                       LUSTRE_MAXFSNAME);
-                               return 1;
-                       } else if (rc > 0) {
-                               fprintf(stderr, "%s: char '%c' not allowed in "
-                                       "filesystem name\n", progname, rc);
-                               return 1;
-                       }
-
+               case 'L':
                        strscpy(new_fsname, optarg, sizeof(new_fsname));
                        break;
-               }
                case 'm': {
                        char *nids = convert_hostnames(optarg);
 
index 613dd65..7540d06 100644 (file)
@@ -56,7 +56,7 @@
 
 #include <libcfs/util/list.h>
 #include <linux/lustre_disk.h>
-#include <lustre_param.h>
+#include <linux/lustre_param.h>
 
 extern char *progname;
 extern int verbose;
index f8999db..94a795f 100644 (file)
@@ -68,7 +68,6 @@
 #endif
 #include <linux/types.h>
 #include <linux/version.h>
-#include <lustre_param.h>
 #include <lnet/lnetctl.h>
 #include <lustre_ver.h>
 
index 08047e5..07fb7a9 100644 (file)
@@ -75,7 +75,7 @@
 
 #include <lnet/lnetctl.h>
 #include <lustre/lustreapi.h>
-#include <lustre_param.h>
+#include <linux/lustre_param.h>
 #include <lustre/lustre_barrier_user.h>
 
 #define MAX_STRING_SIZE 128
@@ -4011,35 +4011,10 @@ static int extract_fsname_poolname(const char *arg, char *fsname,
        *ptr = '\0';
        ++ptr;
 
-       rc = lustre_is_fsname_valid(fsname, 1, LUSTRE_MAXFSNAME);
-       if (rc < 0) {
-               fprintf(stderr, "filesystem name %s must be 1-%d chars\n",
-                       fsname, LUSTRE_MAXFSNAME);
-               rc = -EINVAL;
-               goto err;
-       } else if (rc > 0) {
-               fprintf(stderr, "char '%c' not allowed in filesystem name\n",
-                       rc);
-               rc = -EINVAL;
-               goto err;
-       }
-
-       rc = lustre_is_poolname_valid(ptr, 1, LOV_MAXPOOLNAME);
-       if (rc == -1) {
+       if (strlen(ptr) == 0) {
                fprintf(stderr, "poolname is empty\n");
                rc = -EINVAL;
                goto err;
-       } else if (rc == -2) {
-               fprintf(stderr,
-                       "poolname %s is too long (max is %d)\n",
-                       ptr, LOV_MAXPOOLNAME);
-               rc = -ENAMETOOLONG;
-               goto err;
-       } else if (rc > 0) {
-               fprintf(stderr, "char '%c' not allowed in pool name '%s'\n",
-                       rc, ptr);
-               rc = -EINVAL;
-               goto err;
        }
 
        strncpy(poolname, ptr, LOV_MAXPOOLNAME);