14 * |
14 * |
15 * You should have received a copy of the GNU General Public License |
15 * You should have received a copy of the GNU General Public License |
16 * along with this program; if not, write to the Free Software |
16 * along with this program; if not, write to the Free Software |
17 * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. |
17 * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. |
18 */ |
18 */ |
|
19 |
19 /* |
20 /* |
20 * Copyright 2010 Sun Microsystems, Inc. All rights reserved. |
21 * Copyright 2010 Sun Microsystems, Inc. All rights reserved. |
21 * Use is subject to license terms. |
22 * Use is subject to license terms. |
|
23 */ |
|
24 |
|
25 /* |
|
26 * Copyright (c) 2012 by Delphix. All rights reserved. |
22 */ |
27 */ |
23 |
28 |
24 #ifndef _SYS_DMU_H |
29 #ifndef _SYS_DMU_H |
25 #define _SYS_DMU_H |
30 #define _SYS_DMU_H |
26 |
31 |
29 * consumers. |
34 * consumers. |
30 * |
35 * |
31 * The DMU also interacts with the SPA. That interface is described in |
36 * The DMU also interacts with the SPA. That interface is described in |
32 * dmu_spa.h. |
37 * dmu_spa.h. |
33 */ |
38 */ |
|
39 |
|
40 #define B_FALSE 0 |
|
41 #define B_TRUE 1 |
|
42 |
|
43 #define DMU_OT_NEWTYPE 0x80 |
|
44 #define DMU_OT_METADATA 0x40 |
|
45 #define DMU_OT_BYTESWAP_MASK 0x3f |
|
46 |
|
47 #define DMU_OT(byteswap, metadata) \ |
|
48 (DMU_OT_NEWTYPE | \ |
|
49 ((metadata) ? DMU_OT_METADATA : 0) | \ |
|
50 ((byteswap) & DMU_OT_BYTESWAP_MASK)) |
|
51 |
|
52 #define DMU_OT_IS_VALID(ot) (((ot) & DMU_OT_NEWTYPE) ? \ |
|
53 ((ot) & DMU_OT_BYTESWAP_MASK) < DMU_BSWAP_NUMFUNCS : \ |
|
54 (ot) < DMU_OT_NUMTYPES) |
|
55 |
|
56 #define DMU_OT_IS_METADATA(ot) (((ot) & DMU_OT_NEWTYPE) ? \ |
|
57 ((ot) & DMU_OT_METADATA) : \ |
|
58 dmu_ot[(ot)].ot_metadata) |
|
59 |
|
60 typedef enum dmu_object_byteswap { |
|
61 DMU_BSWAP_UINT8, |
|
62 DMU_BSWAP_UINT16, |
|
63 DMU_BSWAP_UINT32, |
|
64 DMU_BSWAP_UINT64, |
|
65 DMU_BSWAP_ZAP, |
|
66 DMU_BSWAP_DNODE, |
|
67 DMU_BSWAP_OBJSET, |
|
68 DMU_BSWAP_ZNODE, |
|
69 DMU_BSWAP_OLDACL, |
|
70 DMU_BSWAP_ACL, |
|
71 DMU_BSWAP_NUMFUNCS |
|
72 } dmu_object_byteswap_t; |
|
73 |
34 typedef enum dmu_object_type { |
74 typedef enum dmu_object_type { |
35 DMU_OT_NONE, |
75 DMU_OT_NONE, |
36 /* general: */ |
76 /* general: */ |
37 DMU_OT_OBJECT_DIRECTORY, /* ZAP */ |
77 DMU_OT_OBJECT_DIRECTORY, /* ZAP */ |
38 DMU_OT_OBJECT_ARRAY, /* UINT64 */ |
78 DMU_OT_OBJECT_ARRAY, /* UINT64 */ |
39 DMU_OT_PACKED_NVLIST, /* UINT8 (XDR by nvlist_pack/unpack) */ |
79 DMU_OT_PACKED_NVLIST, /* UINT8 (XDR by nvlist_pack/unpack) */ |
40 DMU_OT_PACKED_NVLIST_SIZE, /* UINT64 */ |
80 DMU_OT_PACKED_NVLIST_SIZE, /* UINT64 */ |
41 DMU_OT_BPLIST, /* UINT64 */ |
81 DMU_OT_BPOBJ, /* UINT64 */ |
42 DMU_OT_BPLIST_HDR, /* UINT64 */ |
82 DMU_OT_BPOBJ_HDR, /* UINT64 */ |
43 /* spa: */ |
83 /* spa: */ |
44 DMU_OT_SPACE_MAP_HEADER, /* UINT64 */ |
84 DMU_OT_SPACE_MAP_HEADER, /* UINT64 */ |
45 DMU_OT_SPACE_MAP, /* UINT64 */ |
85 DMU_OT_SPACE_MAP, /* UINT64 */ |
46 /* zil: */ |
86 /* zil: */ |
47 DMU_OT_INTENT_LOG, /* UINT64 */ |
87 DMU_OT_INTENT_LOG, /* UINT64 */ |
54 DMU_OT_DSL_DS_SNAP_MAP, /* ZAP */ |
94 DMU_OT_DSL_DS_SNAP_MAP, /* ZAP */ |
55 DMU_OT_DSL_PROPS, /* ZAP */ |
95 DMU_OT_DSL_PROPS, /* ZAP */ |
56 DMU_OT_DSL_DATASET, /* UINT64 */ |
96 DMU_OT_DSL_DATASET, /* UINT64 */ |
57 /* zpl: */ |
97 /* zpl: */ |
58 DMU_OT_ZNODE, /* ZNODE */ |
98 DMU_OT_ZNODE, /* ZNODE */ |
59 DMU_OT_OLDACL, /* OLD ACL */ |
99 DMU_OT_OLDACL, /* Old ACL */ |
60 DMU_OT_PLAIN_FILE_CONTENTS, /* UINT8 */ |
100 DMU_OT_PLAIN_FILE_CONTENTS, /* UINT8 */ |
61 DMU_OT_DIRECTORY_CONTENTS, /* ZAP */ |
101 DMU_OT_DIRECTORY_CONTENTS, /* ZAP */ |
62 DMU_OT_MASTER_NODE, /* ZAP */ |
102 DMU_OT_MASTER_NODE, /* ZAP */ |
63 DMU_OT_UNLINKED_SET, /* ZAP */ |
103 DMU_OT_UNLINKED_SET, /* ZAP */ |
64 /* zvol: */ |
104 /* zvol: */ |
77 DMU_OT_ACL, /* ACL */ |
117 DMU_OT_ACL, /* ACL */ |
78 DMU_OT_SYSACL, /* SYSACL */ |
118 DMU_OT_SYSACL, /* SYSACL */ |
79 DMU_OT_FUID, /* FUID table (Packed NVLIST UINT8) */ |
119 DMU_OT_FUID, /* FUID table (Packed NVLIST UINT8) */ |
80 DMU_OT_FUID_SIZE, /* FUID table size UINT64 */ |
120 DMU_OT_FUID_SIZE, /* FUID table size UINT64 */ |
81 DMU_OT_NEXT_CLONES, /* ZAP */ |
121 DMU_OT_NEXT_CLONES, /* ZAP */ |
82 DMU_OT_SCRUB_QUEUE, /* ZAP */ |
122 DMU_OT_SCAN_QUEUE, /* ZAP */ |
83 DMU_OT_USERGROUP_USED, /* ZAP */ |
123 DMU_OT_USERGROUP_USED, /* ZAP */ |
84 DMU_OT_USERGROUP_QUOTA, /* ZAP */ |
124 DMU_OT_USERGROUP_QUOTA, /* ZAP */ |
85 DMU_OT_USERREFS, /* ZAP */ |
125 DMU_OT_USERREFS, /* ZAP */ |
86 DMU_OT_DDT_ZAP, /* ZAP */ |
126 DMU_OT_DDT_ZAP, /* ZAP */ |
87 DMU_OT_DDT_STATS, /* ZAP */ |
127 DMU_OT_DDT_STATS, /* ZAP */ |
88 DMU_OT_SA, /* System attr */ |
128 DMU_OT_SA, /* System attr */ |
89 DMU_OT_SA_MASTER_NODE, /* ZAP */ |
129 DMU_OT_SA_MASTER_NODE, /* ZAP */ |
90 DMU_OT_SA_ATTR_REGISTRATION, /* ZAP */ |
130 DMU_OT_SA_ATTR_REGISTRATION, /* ZAP */ |
91 DMU_OT_SA_ATTR_LAYOUTS, /* ZAP */ |
131 DMU_OT_SA_ATTR_LAYOUTS, /* ZAP */ |
92 DMU_OT_NUMTYPES |
132 DMU_OT_SCAN_XLATE, /* ZAP */ |
|
133 DMU_OT_DEDUP, /* fake dedup BP from ddt_bp_create() */ |
|
134 DMU_OT_DEADLIST, /* ZAP */ |
|
135 DMU_OT_DEADLIST_HDR, /* UINT64 */ |
|
136 DMU_OT_DSL_CLONES, /* ZAP */ |
|
137 DMU_OT_BPOBJ_SUBOBJ, /* UINT64 */ |
|
138 DMU_OT_NUMTYPES, |
|
139 |
|
140 DMU_OTN_UINT8_DATA = DMU_OT(DMU_BSWAP_UINT8, B_FALSE), |
|
141 DMU_OTN_UINT8_METADATA = DMU_OT(DMU_BSWAP_UINT8, B_TRUE), |
|
142 DMU_OTN_UINT16_DATA = DMU_OT(DMU_BSWAP_UINT16, B_FALSE), |
|
143 DMU_OTN_UINT16_METADATA = DMU_OT(DMU_BSWAP_UINT16, B_TRUE), |
|
144 DMU_OTN_UINT32_DATA = DMU_OT(DMU_BSWAP_UINT32, B_FALSE), |
|
145 DMU_OTN_UINT32_METADATA = DMU_OT(DMU_BSWAP_UINT32, B_TRUE), |
|
146 DMU_OTN_UINT64_DATA = DMU_OT(DMU_BSWAP_UINT64, B_FALSE), |
|
147 DMU_OTN_UINT64_METADATA = DMU_OT(DMU_BSWAP_UINT64, B_TRUE), |
|
148 DMU_OTN_ZAP_DATA = DMU_OT(DMU_BSWAP_ZAP, B_FALSE), |
|
149 DMU_OTN_ZAP_METADATA = DMU_OT(DMU_BSWAP_ZAP, B_TRUE), |
93 } dmu_object_type_t; |
150 } dmu_object_type_t; |
94 |
151 |
95 typedef enum dmu_objset_type { |
152 typedef enum dmu_objset_type { |
96 DMU_OST_NONE, |
153 DMU_OST_NONE, |
97 DMU_OST_META, |
154 DMU_OST_META, |
105 /* |
162 /* |
106 * The names of zap entries in the DIRECTORY_OBJECT of the MOS. |
163 * The names of zap entries in the DIRECTORY_OBJECT of the MOS. |
107 */ |
164 */ |
108 #define DMU_POOL_DIRECTORY_OBJECT 1 |
165 #define DMU_POOL_DIRECTORY_OBJECT 1 |
109 #define DMU_POOL_CONFIG "config" |
166 #define DMU_POOL_CONFIG "config" |
|
167 #define DMU_POOL_FEATURES_FOR_READ "features_for_read" |
|
168 #define DMU_POOL_FEATURES_FOR_WRITE "features_for_write" |
|
169 #define DMU_POOL_FEATURE_DESCRIPTIONS "feature_descriptions" |
110 #define DMU_POOL_ROOT_DATASET "root_dataset" |
170 #define DMU_POOL_ROOT_DATASET "root_dataset" |
111 #define DMU_POOL_SYNC_BPLIST "sync_bplist" |
171 #define DMU_POOL_SYNC_BPLIST "sync_bplist" |
112 #define DMU_POOL_ERRLOG_SCRUB "errlog_scrub" |
172 #define DMU_POOL_ERRLOG_SCRUB "errlog_scrub" |
113 #define DMU_POOL_ERRLOG_LAST "errlog_last" |
173 #define DMU_POOL_ERRLOG_LAST "errlog_last" |
114 #define DMU_POOL_SPARES "spares" |
174 #define DMU_POOL_SPARES "spares" |