4 * The contents of this file are subject to the terms of the
5 * Common Development and Distribution License (the "License").
6 * You may not use this file except in compliance with the License.
7 *
8 * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
9 * or http://www.opensolaris.org/os/licensing.
10 * See the License for the specific language governing permissions
11 * and limitations under the License.
12 *
13 * When distributing Covered Code, include this CDDL HEADER in each
14 * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
15 * If applicable, add the following below this CDDL HEADER, with the
16 * fields enclosed by brackets "[]" replaced with your own identifying
17 * information: Portions Copyright [yyyy] [name of copyright owner]
18 *
19 * CDDL HEADER END
20 */
21 /*
22 * Copyright 2010 Sun Microsystems, Inc. All rights reserved.
23 * Use is subject to license terms.
24 */
25
26 #ifndef _SYS_FS_ZFS_FUID_H
27 #define _SYS_FS_ZFS_FUID_H
28
29 #ifdef _KERNEL
30 #include <sys/kidmap.h>
31 #include <sys/sid.h>
32 #include <sys/dmu.h>
33 #include <sys/zfs_vfsops.h>
34 #endif
35 #include <sys/avl.h>
36
37 #ifdef __cplusplus
38 extern "C" {
39 #endif
40
41 typedef enum {
42 ZFS_OWNER,
43 ZFS_GROUP,
94 char **z_domain_table; /* Used during replay */
95 uint32_t z_fuid_cnt; /* How many fuids in z_fuids */
96 uint32_t z_domain_cnt; /* How many domains */
97 size_t z_domain_str_sz; /* len of domain strings z_domain list */
98 } zfs_fuid_info_t;
99
100 #ifdef _KERNEL
101 struct znode;
102 extern uid_t zfs_fuid_map_id(zfsvfs_t *, uint64_t, cred_t *, zfs_fuid_type_t);
103 extern void zfs_fuid_node_add(zfs_fuid_info_t **, const char *, uint32_t,
104 uint64_t, uint64_t, zfs_fuid_type_t);
105 extern void zfs_fuid_destroy(zfsvfs_t *);
106 extern uint64_t zfs_fuid_create_cred(zfsvfs_t *, zfs_fuid_type_t,
107 cred_t *, zfs_fuid_info_t **);
108 extern uint64_t zfs_fuid_create(zfsvfs_t *, uint64_t, cred_t *, zfs_fuid_type_t,
109 zfs_fuid_info_t **);
110 extern void zfs_fuid_map_ids(struct znode *zp, cred_t *cr,
111 uid_t *uid, uid_t *gid);
112 extern zfs_fuid_info_t *zfs_fuid_info_alloc(void);
113 extern void zfs_fuid_info_free(zfs_fuid_info_t *);
114 extern boolean_t zfs_groupmember(zfsvfs_t *, uint64_t, cred_t *);
115 void zfs_fuid_sync(zfsvfs_t *, dmu_tx_t *);
116 extern int zfs_fuid_find_by_domain(zfsvfs_t *, const char *domain,
117 char **retdomain, boolean_t addok);
118 extern const char *zfs_fuid_find_by_idx(zfsvfs_t *zfsvfs, uint32_t idx);
119 extern void zfs_fuid_txhold(zfsvfs_t *zfsvfs, dmu_tx_t *tx);
120 #endif
121
122 char *zfs_fuid_idx_domain(avl_tree_t *, uint32_t);
123 void zfs_fuid_avl_tree_create(avl_tree_t *, avl_tree_t *);
124 uint64_t zfs_fuid_table_load(objset_t *, uint64_t, avl_tree_t *, avl_tree_t *);
125 void zfs_fuid_table_destroy(avl_tree_t *, avl_tree_t *);
126
127 #ifdef __cplusplus
128 }
129 #endif
130
131 #endif /* _SYS_FS_ZFS_FUID_H */
|
4 * The contents of this file are subject to the terms of the
5 * Common Development and Distribution License (the "License").
6 * You may not use this file except in compliance with the License.
7 *
8 * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
9 * or http://www.opensolaris.org/os/licensing.
10 * See the License for the specific language governing permissions
11 * and limitations under the License.
12 *
13 * When distributing Covered Code, include this CDDL HEADER in each
14 * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
15 * If applicable, add the following below this CDDL HEADER, with the
16 * fields enclosed by brackets "[]" replaced with your own identifying
17 * information: Portions Copyright [yyyy] [name of copyright owner]
18 *
19 * CDDL HEADER END
20 */
21 /*
22 * Copyright 2010 Sun Microsystems, Inc. All rights reserved.
23 * Use is subject to license terms.
24 *
25 * Copyright 2017 Nexenta Systems, Inc. All rights reserved.
26 */
27
28 #ifndef _SYS_FS_ZFS_FUID_H
29 #define _SYS_FS_ZFS_FUID_H
30
31 #ifdef _KERNEL
32 #include <sys/kidmap.h>
33 #include <sys/sid.h>
34 #include <sys/dmu.h>
35 #include <sys/zfs_vfsops.h>
36 #endif
37 #include <sys/avl.h>
38
39 #ifdef __cplusplus
40 extern "C" {
41 #endif
42
43 typedef enum {
44 ZFS_OWNER,
45 ZFS_GROUP,
96 char **z_domain_table; /* Used during replay */
97 uint32_t z_fuid_cnt; /* How many fuids in z_fuids */
98 uint32_t z_domain_cnt; /* How many domains */
99 size_t z_domain_str_sz; /* len of domain strings z_domain list */
100 } zfs_fuid_info_t;
101
102 #ifdef _KERNEL
103 struct znode;
104 extern uid_t zfs_fuid_map_id(zfsvfs_t *, uint64_t, cred_t *, zfs_fuid_type_t);
105 extern void zfs_fuid_node_add(zfs_fuid_info_t **, const char *, uint32_t,
106 uint64_t, uint64_t, zfs_fuid_type_t);
107 extern void zfs_fuid_destroy(zfsvfs_t *);
108 extern uint64_t zfs_fuid_create_cred(zfsvfs_t *, zfs_fuid_type_t,
109 cred_t *, zfs_fuid_info_t **);
110 extern uint64_t zfs_fuid_create(zfsvfs_t *, uint64_t, cred_t *, zfs_fuid_type_t,
111 zfs_fuid_info_t **);
112 extern void zfs_fuid_map_ids(struct znode *zp, cred_t *cr,
113 uid_t *uid, uid_t *gid);
114 extern zfs_fuid_info_t *zfs_fuid_info_alloc(void);
115 extern void zfs_fuid_info_free(zfs_fuid_info_t *);
116 extern boolean_t zfs_user_in_cred(zfsvfs_t *, uint64_t, cred_t *);
117 extern boolean_t zfs_groupmember(zfsvfs_t *, uint64_t, cred_t *);
118 void zfs_fuid_sync(zfsvfs_t *, dmu_tx_t *);
119 extern int zfs_fuid_find_by_domain(zfsvfs_t *, const char *domain,
120 char **retdomain, boolean_t addok);
121 extern const char *zfs_fuid_find_by_idx(zfsvfs_t *zfsvfs, uint32_t idx);
122 extern void zfs_fuid_txhold(zfsvfs_t *zfsvfs, dmu_tx_t *tx);
123 #endif
124
125 char *zfs_fuid_idx_domain(avl_tree_t *, uint32_t);
126 void zfs_fuid_avl_tree_create(avl_tree_t *, avl_tree_t *);
127 uint64_t zfs_fuid_table_load(objset_t *, uint64_t, avl_tree_t *, avl_tree_t *);
128 void zfs_fuid_table_destroy(avl_tree_t *, avl_tree_t *);
129
130 #ifdef __cplusplus
131 }
132 #endif
133
134 #endif /* _SYS_FS_ZFS_FUID_H */
|