Whamcloud - gitweb
LU-15956 gss: allow build without ssk
[fs/lustre-release.git] / lustre / include / lustre_nodemap.h
index 9d200bf..80f123a 100644 (file)
@@ -44,6 +44,7 @@
 enum nodemap_id_type {
        NODEMAP_UID,
        NODEMAP_GID,
+       NODEMAP_PROJID,
 };
 
 enum nodemap_tree_type {
@@ -52,9 +53,14 @@ enum nodemap_tree_type {
 };
 
 enum nodemap_mapping_modes {
-       NODEMAP_MAP_BOTH,
-       NODEMAP_MAP_UID_ONLY,
-       NODEMAP_MAP_GID_ONLY,
+       NODEMAP_MAP_BOTH_LEGACY = 0x0,  /* for compatibility */
+       NODEMAP_MAP_UID         = 0x01,
+       NODEMAP_MAP_GID         = 0x02,
+       NODEMAP_MAP_BOTH        = 0x03, /* for compatibility */
+       NODEMAP_MAP_PROJID      = 0x04,
+       NODEMAP_MAP_ALL         = NODEMAP_MAP_UID |
+                                 NODEMAP_MAP_GID |
+                                 NODEMAP_MAP_PROJID,
 };
 
 struct nodemap_pde {
@@ -75,9 +81,11 @@ struct lu_nodemap {
        bool                     nmf_trust_client_ids:1,
                                 nmf_deny_unknown:1,
                                 nmf_allow_root_access:1,
-                                nmf_map_uid_only:1,
-                                nmf_map_gid_only:1,
-                                nmf_enable_audit:1;
+                                nmf_enable_audit:1,
+                                nmf_forbid_encryption:1;
+       /* bitmap for mapping type */
+       enum nodemap_mapping_modes
+                               nmf_map_mode;
        /* unique ID set by MGS */
        unsigned int             nm_id;
        /* nodemap ref counter */
@@ -86,6 +94,8 @@ struct lu_nodemap {
        uid_t                    nm_squash_uid;
        /* GID to squash unmapped GIDs */
        gid_t                    nm_squash_gid;
+       /* PROJID to squash unmapped PROJIDs */
+       projid_t                 nm_squash_projid;
        /* NID range list */
        struct list_head         nm_ranges;
        /* lock for idmap red/black trees */
@@ -98,6 +108,10 @@ struct lu_nodemap {
        struct rb_root           nm_fs_to_client_gidmap;
        /* GID map keyed by remote UID */
        struct rb_root           nm_client_to_fs_gidmap;
+       /* PROJID map keyed by local UID */
+       struct rb_root           nm_fs_to_client_projidmap;
+       /* PROJID map keyed by remote UID */
+       struct rb_root           nm_client_to_fs_projidmap;
        /* attached client members of this nodemap */
        struct mutex             nm_member_list_lock;
        struct list_head         nm_member_list;
@@ -135,11 +149,14 @@ int nodemap_del_range(const char *name, const lnet_nid_t nid[2]);
 int nodemap_set_allow_root(const char *name, bool allow_root);
 int nodemap_set_trust_client_ids(const char *name, bool trust_client_ids);
 int nodemap_set_deny_unknown(const char *name, bool deny_unknown);
-int nodemap_set_mapping_mode(const char *name, enum nodemap_mapping_modes mode);
+int nodemap_set_mapping_mode(const char *name,
+                            enum nodemap_mapping_modes map_mode);
 int nodemap_set_squash_uid(const char *name, uid_t uid);
 int nodemap_set_squash_gid(const char *name, gid_t gid);
+int nodemap_set_squash_projid(const char *name, projid_t projid);
 int nodemap_set_audit_mode(const char *name, bool enable_audit);
-bool nodemap_can_setquota(const struct lu_nodemap *nodemap);
+int nodemap_set_forbid_encryption(const char *name, bool forbid_encryption);
+bool nodemap_can_setquota(struct lu_nodemap *nodemap, __u32 qc_type, __u32 id);
 int nodemap_add_idmap(const char *name, enum nodemap_id_type id_type,
                      const __u32 map[2]);
 int nodemap_del_idmap(const char *name, enum nodemap_id_type id_type,
@@ -176,8 +193,9 @@ struct lu_nodemap *nodemap_get_from_exp(struct obd_export *exp);
 void nodemap_putref(struct lu_nodemap *nodemap);
 
 #ifdef HAVE_SERVER_SUPPORT
+
 struct nodemap_range_tree {
-       struct interval_node *nmrt_range_interval_root;
+       struct interval_tree_root nmrt_range_interval_root;
        unsigned int nmrt_range_highest_id;
 };