+/* first 4 bits of the nodemap_id is the index type */
+struct nodemap_key {
+ __u32 nk_nodemap_id;
+ union {
+ __u32 nk_range_id;
+ __u32 nk_id_client;
+ __u32 nk_unused;
+ };
+};
+
+enum nodemap_idx_type {
+ NODEMAP_EMPTY_IDX = 0, /* index created with blank record */
+ NODEMAP_CLUSTER_IDX = 1, /* a nodemap cluster of nodes */
+ NODEMAP_RANGE_IDX = 2, /* nid range assigned to a nm cluster */
+ NODEMAP_UIDMAP_IDX = 3, /* uid map assigned to a nm cluster */
+ NODEMAP_GIDMAP_IDX = 4, /* gid map assigned to a nm cluster */
+ NODEMAP_GLOBAL_IDX = 15, /* stores nodemap activation status */
+};
+
+#define NM_TYPE_MASK 0x0FFFFFFF
+#define NM_TYPE_SHIFT 28
+
+static inline enum nodemap_idx_type nm_idx_get_type(unsigned int id)
+{
+ return id >> NM_TYPE_SHIFT;
+}
+
+static inline __u32 nm_idx_set_type(unsigned int id, enum nodemap_idx_type t)
+{
+ return (id & NM_TYPE_MASK) | (t << NM_TYPE_SHIFT);
+}
+
+void nodemap_config_set_active(struct nodemap_config *config);
+struct lu_nodemap *nodemap_create(const char *name,
+ struct nodemap_config *config,
+ bool is_default);
+void nodemap_putref(struct lu_nodemap *nodemap);
+struct lu_nodemap *nodemap_lookup(const char *name);
+