Whamcloud - gitweb
LU-16479 utils: Add option to manage degraded ZFS OST
[fs/lustre-release.git] / lustre / include / uapi / linux / lustre / lustre_cfg.h
index c71be81..ab0dc0b 100644 (file)
@@ -27,7 +27,6 @@
  */
 /*
  * This file is part of Lustre, http://www.lustre.org/
- * Lustre is a trademark of Sun Microsystems, Inc.
  */
 
 #ifndef _UAPI_LUSTRE_CFG_H
 
 #include <linux/errno.h>
 #include <linux/kernel.h>
-/*
- * This is due to us being out of kernel and the way the OpenSFS branch
- * handles CFLAGS.
- */
-#ifdef __KERNEL__
-# include <uapi/linux/lustre/lustre_user.h>
-#else
-# include <linux/lustre/lustre_user.h>
-#endif
-
-/* Handle older distros */
-#ifndef __ALIGN_KERNEL
-# define __ALIGN_KERNEL(x, a)          __ALIGN_KERNEL_MASK(x, (typeof(x))(a) - 1)
-# define __ALIGN_KERNEL_MASK(x, mask)  (((x) + (mask)) & ~(mask))
-#endif
+#include <linux/types.h>
+#include <linux/lustre/lustre_user.h>
 
 /** \defgroup cfg cfg
  *
@@ -132,6 +118,8 @@ enum lcfg_command_type {
                                                 *  id mapping
                                                 */
        LCFG_NODEMAP_ADMIN        = 0x00ce049, /**< allow cluster to use id 0 */
+       LCFG_NODEMAP_ADD_PROJIDMAP        = 0x00ce04a, /**< add a projidmap */
+       LCFG_NODEMAP_DEL_PROJIDMAP        = 0x00ce04b, /**< delete a projidmap */
        LCFG_NODEMAP_TRUSTED      = 0x00ce050, /**< trust a clusters ids */
        LCFG_NODEMAP_SQUASH_UID   = 0x00ce051, /**< default map uid */
        LCFG_NODEMAP_SQUASH_GID   = 0x00ce052, /**< default map gid */
@@ -148,6 +136,11 @@ enum lcfg_command_type {
                                                 *  users
                                                 */
        LCFG_NODEMAP_MAP_MODE     = 0x00ce059, /**< set the mapping mode */
+       LCFG_NODEMAP_AUDIT_MODE   = 0x00ce05a, /**< set the audit mode */
+       LCFG_NODEMAP_SET_SEPOL    = 0x00ce05b, /**< set SELinux policy */
+       LCFG_NODEMAP_FORBID_ENCRYPT     = 0x00ce05c, /**< forbid encryption */
+       LCFG_NODEMAP_SQUASH_PROJID      = 0x00ce05d, /**< default map projid */
+       LCFG_NODEMAP_READONLY_MOUNT     = 0x00ce05e, /**< read-only mount */
 };
 
 struct lustre_cfg_bufs {
@@ -169,6 +162,57 @@ struct lustre_cfg {
        __u32 lcfg_buflens[0];
 };
 
+struct lcfg_type_data {
+       __u32    ltd_type;
+       char    *ltd_name;
+       char    *ltd_bufs[4];
+};
+
+static struct lcfg_type_data lcfg_data_table[] = {
+       { LCFG_ATTACH, "attach", { "type", "UUID", "3", "4" } },
+       { LCFG_DETACH, "detach", { "1", "2", "3", "4" } },
+       { LCFG_SETUP, "setup", { "UUID", "node", "options", "failout" } },
+       { LCFG_CLEANUP, "cleanup", { "1", "2", "3", "4" } },
+       { LCFG_ADD_UUID, "add_uuid", { "node", "2", "3", "4" }  },
+       { LCFG_DEL_UUID, "del_uuid", { "1", "2", "3", "4" }  },
+       { LCFG_MOUNTOPT, "new_profile", { "name", "lov", "lmv", "4" }  },
+       { LCFG_DEL_MOUNTOPT, "del_mountopt", { "1", "2", "3", "4" }  },
+       { LCFG_SET_TIMEOUT, "set_timeout", { "parameter", "2", "3", "4" }  },
+       { LCFG_SET_UPCALL, "set_upcall", { "1", "2", "3", "4" }  },
+       { LCFG_ADD_CONN, "add_conn", { "node", "2", "3", "4" }  },
+       { LCFG_DEL_CONN, "del_conn", { "1", "2", "3", "4" }  },
+       { LCFG_LOV_ADD_OBD, "add_osc", { "ost", "index", "gen", "UUID" } },
+       { LCFG_LOV_DEL_OBD, "del_osc", { "1", "2", "3", "4" } },
+       { LCFG_PARAM, "conf_param", { "parameter", "value", "3", "4" } },
+       { LCFG_MARKER, "marker", { "1", "2", "3", "4" } },
+       { LCFG_LOG_START, "log_start", { "1", "2", "3", "4" } },
+       { LCFG_LOG_END, "log_end", { "1", "2", "3", "4" } },
+       { LCFG_LOV_ADD_INA, "add_osc_inactive", { "1", "2", "3", "4" }  },
+       { LCFG_ADD_MDC, "add_mdc", { "mdt", "index", "gen", "UUID" } },
+       { LCFG_DEL_MDC, "del_mdc", { "1", "2", "3", "4" } },
+       { LCFG_SPTLRPC_CONF, "security", { "parameter", "2", "3", "4" } },
+       { LCFG_POOL_NEW, "new_pool", { "fsname", "pool", "3", "4" }  },
+       { LCFG_POOL_ADD, "add_pool", { "fsname", "pool", "ost", "4" } },
+       { LCFG_POOL_REM, "remove_pool", { "fsname", "pool", "ost", "4" } },
+       { LCFG_POOL_DEL, "del_pool", { "fsname", "pool", "3", "4" } },
+       { LCFG_SET_LDLM_TIMEOUT, "set_ldlm_timeout",
+         { "parameter", "2", "3", "4" } },
+       { LCFG_SET_PARAM, "set_param", { "parameter", "value", "3", "4" } },
+       { 0, NULL, { NULL, NULL, NULL, NULL } }
+};
+
+static inline struct lcfg_type_data *lcfg_cmd2data(__u32 cmd)
+{
+       int i = 0;
+
+       while (lcfg_data_table[i].ltd_type != 0) {
+               if (lcfg_data_table[i].ltd_type == cmd)
+                       return &lcfg_data_table[i];
+               i++;
+       }
+       return NULL;
+}
+
 enum cfg_record_type {
        PORTALS_CFG_TYPE        = 1,
        LUSTRE_CFG_TYPE         = 123,
@@ -210,7 +254,7 @@ static inline void lustre_cfg_bufs_reset(struct lustre_cfg_bufs *bufs,
 static inline void *lustre_cfg_buf(struct lustre_cfg *lcfg, __u32 index)
 {
        __u32 i;
-       size_t offset;
+       __kernel_size_t offset;
        __u32 bufcount;
 
        if (!lcfg)
@@ -270,7 +314,7 @@ static inline void lustre_cfg_init(struct lustre_cfg *lcfg, int cmd,
        }
 }
 
-static inline int lustre_cfg_sanity_check(void *buf, size_t len)
+static inline int lustre_cfg_sanity_check(void *buf, __kernel_size_t len)
 {
        struct lustre_cfg *lcfg = (struct lustre_cfg *)buf;