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.sun.com/software/products/lustre/docs/GPLv2.pdf
23 * Copyright (C) 2013, Trustees of Indiana University
24 * Author: Joshua Walgenbach <jjw@iu.edu>
27 #ifndef _LUSTRE_NODEMAP_H
28 #define _LUSTRE_NODEMAP_H
30 #define LUSTRE_NODEMAP_NAME "nodemap"
31 #define LUSTRE_NODEMAP_NAME_LENGTH 16
33 #define LUSTRE_NODEMAP_DEFAULT_ID 0
35 /** The nodemap id 0 will be the default nodemap. It will have a configuration
36 * set by the MGS, but no ranges will be allowed as all NIDs that do not map
37 * will be added to the default nodemap
41 /* human readable ID */
42 char nm_name[LUSTRE_NODEMAP_NAME_LENGTH + 1];
43 /* flags to govern nodemap behavior */
44 bool nmf_trust_client_ids:1,
45 nmf_allow_root_access:1,
48 nmf_encryption_required:1;
49 /* unique ID set by MGS */
51 /* nodemap ref counter */
53 /* UID to squash unmapped UIDs */
55 /* GID to squash unmapped GIDs */
58 struct list_head nm_ranges;
59 /* UID map keyed by local UID */
60 struct rb_root nm_local_to_remote_uidmap;
61 /* UID map keyed by remote UID */
62 struct rb_root nm_remote_to_local_uidmap;
63 /* GID map keyed by local UID */
64 struct rb_root nm_local_to_remote_gidmap;
65 /* GID map keyed by remote UID */
66 struct rb_root nm_remote_to_local_gidmap;
67 /* proc directory entry */
68 struct proc_dir_entry *nm_proc_entry;
69 /* attached client members of this nodemap */
70 struct list_head nm_exports;
71 /* access by nodemap name */
72 cfs_hlist_node_t nm_hash;
75 int nodemap_add(const char *nodemap_name);
76 int nodemap_del(const char *nodemap_name);
77 struct lu_nodemap *nodemap_classify_nid(lnet_nid_t nid);
78 int nodemap_parse_range(const char *range_string, lnet_nid_t range[2]);
79 int nodemap_add_range(const char *name, const lnet_nid_t nid[2]);
80 int nodemap_del_range(const char *name, const lnet_nid_t nid[2]);
81 int nodemap_set_allow_root(const char *name, bool allow_root);
82 int nodemap_set_trust_client_ids(const char *name, bool trust_client_ids);
83 int nodemap_set_squash_uid(const char *name, uid_t uid);
84 int nodemap_set_squash_gid(const char *name, gid_t gid);