2 * GRUB -- GRand Unified Bootloader
3 * Copyright (C) 1999,2000,2001,2002,2003,2004 Free Software Foundation, Inc.
4 *
5 * GRUB is free software; you can redistribute it and/or modify
6 * it under the terms of the GNU General Public License as published by
7 * the Free Software Foundation; either version 3 of the License, or
8 * (at your option) any later version.
9 *
10 * GRUB is distributed in the hope that it will be useful,
11 * but WITHOUT ANY WARRANTY; without even the implied warranty of
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 * GNU General Public License for more details.
14 *
15 * You should have received a copy of the GNU General Public License
16 * along with GRUB. If not, see <http://www.gnu.org/licenses/>.
17 */
18 /*
19 * Copyright 2010 Sun Microsystems, Inc. All rights reserved.
20 * Use is subject to license terms.
21 */
22
23 #ifndef _SYS_DMU_H
24 #define _SYS_DMU_H
25
26 /*
27 * This file describes the interface that the DMU provides for its
28 * consumers.
29 *
30 * The DMU also interacts with the SPA. That interface is described in
31 * dmu_spa.h.
32 */
33 typedef enum dmu_object_type {
34 DMU_OT_NONE,
35 /* general: */
36 DMU_OT_OBJECT_DIRECTORY, /* ZAP */
37 DMU_OT_OBJECT_ARRAY, /* UINT64 */
38 DMU_OT_PACKED_NVLIST, /* UINT8 (XDR by nvlist_pack/unpack) */
39 DMU_OT_PACKED_NVLIST_SIZE, /* UINT64 */
40 DMU_OT_BPLIST, /* UINT64 */
41 DMU_OT_BPLIST_HDR, /* UINT64 */
42 /* spa: */
43 DMU_OT_SPACE_MAP_HEADER, /* UINT64 */
44 DMU_OT_SPACE_MAP, /* UINT64 */
45 /* zil: */
46 DMU_OT_INTENT_LOG, /* UINT64 */
47 /* dmu: */
48 DMU_OT_DNODE, /* DNODE */
49 DMU_OT_OBJSET, /* OBJSET */
50 /* dsl: */
51 DMU_OT_DSL_DIR, /* UINT64 */
52 DMU_OT_DSL_DIR_CHILD_MAP, /* ZAP */
72 DMU_OT_SPA_HISTORY, /* UINT8 */
73 DMU_OT_SPA_HISTORY_OFFSETS, /* spa_his_phys_t */
74 DMU_OT_POOL_PROPS, /* ZAP */
75 DMU_OT_DSL_PERMS, /* ZAP */
76 DMU_OT_ACL, /* ACL */
77 DMU_OT_SYSACL, /* SYSACL */
78 DMU_OT_FUID, /* FUID table (Packed NVLIST UINT8) */
79 DMU_OT_FUID_SIZE, /* FUID table size UINT64 */
80 DMU_OT_NEXT_CLONES, /* ZAP */
81 DMU_OT_SCRUB_QUEUE, /* ZAP */
82 DMU_OT_USERGROUP_USED, /* ZAP */
83 DMU_OT_USERGROUP_QUOTA, /* ZAP */
84 DMU_OT_USERREFS, /* ZAP */
85 DMU_OT_DDT_ZAP, /* ZAP */
86 DMU_OT_DDT_STATS, /* ZAP */
87 DMU_OT_SA, /* System attr */
88 DMU_OT_SA_MASTER_NODE, /* ZAP */
89 DMU_OT_SA_ATTR_REGISTRATION, /* ZAP */
90 DMU_OT_SA_ATTR_LAYOUTS, /* ZAP */
91 DMU_OT_DSL_KEYCHAIN = 54,
92 DMU_OT_NUMTYPES
93 } dmu_object_type_t;
94
95 typedef enum dmu_objset_type {
96 DMU_OST_NONE,
97 DMU_OST_META,
98 DMU_OST_ZFS,
99 DMU_OST_ZVOL,
100 DMU_OST_OTHER, /* For testing only! */
101 DMU_OST_ANY, /* Be careful! */
102 DMU_OST_NUMTYPES
103 } dmu_objset_type_t;
104
105 /*
106 * The names of zap entries in the DIRECTORY_OBJECT of the MOS.
107 */
108 #define DMU_POOL_DIRECTORY_OBJECT 1
109 #define DMU_POOL_CONFIG "config"
110 #define DMU_POOL_ROOT_DATASET "root_dataset"
111 #define DMU_POOL_SYNC_BPLIST "sync_bplist"
112 #define DMU_POOL_ERRLOG_SCRUB "errlog_scrub"
113 #define DMU_POOL_ERRLOG_LAST "errlog_last"
114 #define DMU_POOL_SPARES "spares"
115 #define DMU_POOL_DEFLATE "deflate"
116 #define DMU_POOL_HISTORY "history"
117 #define DMU_POOL_PROPS "pool_props"
118 #define DMU_POOL_L2CACHE "l2cache"
119
120 #endif /* _SYS_DMU_H */
|
2 * GRUB -- GRand Unified Bootloader
3 * Copyright (C) 1999,2000,2001,2002,2003,2004 Free Software Foundation, Inc.
4 *
5 * GRUB is free software; you can redistribute it and/or modify
6 * it under the terms of the GNU General Public License as published by
7 * the Free Software Foundation; either version 3 of the License, or
8 * (at your option) any later version.
9 *
10 * GRUB is distributed in the hope that it will be useful,
11 * but WITHOUT ANY WARRANTY; without even the implied warranty of
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 * GNU General Public License for more details.
14 *
15 * You should have received a copy of the GNU General Public License
16 * along with GRUB. If not, see <http://www.gnu.org/licenses/>.
17 */
18 /*
19 * Copyright 2010 Sun Microsystems, Inc. All rights reserved.
20 * Use is subject to license terms.
21 */
22 /*
23 * Copyright 2012, Daniil Lunev
24 */
25
26 #ifndef _SYS_DMU_H
27 #define _SYS_DMU_H
28
29 /*
30 * This file describes the interface that the DMU provides for its
31 * consumers.
32 *
33 * The DMU also interacts with the SPA. That interface is described in
34 * dmu_spa.h.
35 */
36
37 #define B_FALSE 0
38 #define B_TRUE 1
39
40 #define DMU_OT_NEWTYPE 0x80
41 #define DMU_OT_METADATA 0x40
42 #define DMU_OT_BYTESWAP_MASK 0x3f
43
44 #define DMU_OT(byteswap, metadata) \
45 (DMU_OT_NEWTYPE | \
46 ((metadata) ? DMU_OT_METADATA : 0) | \
47 ((byteswap) & DMU_OT_BYTESWAP_MASK))
48
49 #define DMU_OT_IS_VALID(ot) (((ot) & DMU_OT_NEWTYPE) ? \
50 ((ot) & DMU_OT_BYTESWAP_MASK) < DMU_BSWAP_NUMFUNCS : \
51 (ot) < DMU_OT_NUMTYPES)
52
53 #define DMU_OT_IS_METADATA(ot) (((ot) & DMU_OT_NEWTYPE) ? \
54 ((ot) & DMU_OT_METADATA) : \
55 dmu_ot[(ot)].ot_metadata)
56
57 typedef enum dmu_object_byteswap {
58 DMU_BSWAP_UINT8,
59 DMU_BSWAP_UINT16,
60 DMU_BSWAP_UINT32,
61 DMU_BSWAP_UINT64,
62 DMU_BSWAP_ZAP,
63 DMU_BSWAP_DNODE,
64 DMU_BSWAP_OBJSET,
65 DMU_BSWAP_ZNODE,
66 DMU_BSWAP_OLDACL,
67 DMU_BSWAP_ACL,
68 DMU_BSWAP_NUMFUNCS
69 } dmu_object_byteswap_t;
70
71 typedef enum dmu_object_type {
72 DMU_OT_NONE,
73 /* general: */
74 DMU_OT_OBJECT_DIRECTORY, /* ZAP */
75 DMU_OT_OBJECT_ARRAY, /* UINT64 */
76 DMU_OT_PACKED_NVLIST, /* UINT8 (XDR by nvlist_pack/unpack) */
77 DMU_OT_PACKED_NVLIST_SIZE, /* UINT64 */
78 DMU_OT_BPLIST, /* UINT64 */
79 DMU_OT_BPLIST_HDR, /* UINT64 */
80 /* spa: */
81 DMU_OT_SPACE_MAP_HEADER, /* UINT64 */
82 DMU_OT_SPACE_MAP, /* UINT64 */
83 /* zil: */
84 DMU_OT_INTENT_LOG, /* UINT64 */
85 /* dmu: */
86 DMU_OT_DNODE, /* DNODE */
87 DMU_OT_OBJSET, /* OBJSET */
88 /* dsl: */
89 DMU_OT_DSL_DIR, /* UINT64 */
90 DMU_OT_DSL_DIR_CHILD_MAP, /* ZAP */
110 DMU_OT_SPA_HISTORY, /* UINT8 */
111 DMU_OT_SPA_HISTORY_OFFSETS, /* spa_his_phys_t */
112 DMU_OT_POOL_PROPS, /* ZAP */
113 DMU_OT_DSL_PERMS, /* ZAP */
114 DMU_OT_ACL, /* ACL */
115 DMU_OT_SYSACL, /* SYSACL */
116 DMU_OT_FUID, /* FUID table (Packed NVLIST UINT8) */
117 DMU_OT_FUID_SIZE, /* FUID table size UINT64 */
118 DMU_OT_NEXT_CLONES, /* ZAP */
119 DMU_OT_SCRUB_QUEUE, /* ZAP */
120 DMU_OT_USERGROUP_USED, /* ZAP */
121 DMU_OT_USERGROUP_QUOTA, /* ZAP */
122 DMU_OT_USERREFS, /* ZAP */
123 DMU_OT_DDT_ZAP, /* ZAP */
124 DMU_OT_DDT_STATS, /* ZAP */
125 DMU_OT_SA, /* System attr */
126 DMU_OT_SA_MASTER_NODE, /* ZAP */
127 DMU_OT_SA_ATTR_REGISTRATION, /* ZAP */
128 DMU_OT_SA_ATTR_LAYOUTS, /* ZAP */
129 DMU_OT_DSL_KEYCHAIN = 54,
130 DMU_OT_NUMTYPES,
131
132 DMU_OTN_ZAP_METADATA = DMU_OT(DMU_BSWAP_ZAP, B_TRUE),
133 } dmu_object_type_t;
134
135 typedef enum dmu_objset_type {
136 DMU_OST_NONE,
137 DMU_OST_META,
138 DMU_OST_ZFS,
139 DMU_OST_ZVOL,
140 DMU_OST_OTHER, /* For testing only! */
141 DMU_OST_ANY, /* Be careful! */
142 DMU_OST_NUMTYPES
143 } dmu_objset_type_t;
144
145 /*
146 * The names of zap entries in the DIRECTORY_OBJECT of the MOS.
147 */
148 #define DMU_POOL_DIRECTORY_OBJECT 1
149 #define DMU_POOL_CONFIG "config"
150 #define DMU_POOL_ROOT_DATASET "root_dataset"
151 #define DMU_POOL_SYNC_BPLIST "sync_bplist"
152 #define DMU_POOL_ERRLOG_SCRUB "errlog_scrub"
153 #define DMU_POOL_ERRLOG_LAST "errlog_last"
154 #define DMU_POOL_SPARES "spares"
155 #define DMU_POOL_DEFLATE "deflate"
156 #define DMU_POOL_HISTORY "history"
157 #define DMU_POOL_PROPS "pool_props"
158 #define DMU_POOL_L2CACHE "l2cache"
159 #define DMU_POOL_FEATURES_FOR_READ "features_for_read"
160
161 #endif /* _SYS_DMU_H */
|