1b1b8ab34Slling /* 2b1b8ab34Slling * GRUB -- GRand Unified Bootloader 3b1b8ab34Slling * Copyright (C) 1999,2000,2001,2002,2003,2004 Free Software Foundation, Inc. 4b1b8ab34Slling * 5b1b8ab34Slling * This program is free software; you can redistribute it and/or modify 6b1b8ab34Slling * it under the terms of the GNU General Public License as published by 7b1b8ab34Slling * the Free Software Foundation; either version 2 of the License, or 8b1b8ab34Slling * (at your option) any later version. 9b1b8ab34Slling * 10b1b8ab34Slling * This program is distributed in the hope that it will be useful, 11b1b8ab34Slling * but WITHOUT ANY WARRANTY; without even the implied warranty of 12b1b8ab34Slling * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13b1b8ab34Slling * GNU General Public License for more details. 14b1b8ab34Slling * 15b1b8ab34Slling * You should have received a copy of the GNU General Public License 16b1b8ab34Slling * along with this program; if not, write to the Free Software 17b1b8ab34Slling * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. 18b1b8ab34Slling */ 19*ad135b5dSChristopher Siden 20b1b8ab34Slling /* 210a586ceaSMark Shellenbaum * Copyright 2010 Sun Microsystems, Inc. All rights reserved. 22b1b8ab34Slling * Use is subject to license terms. 23b1b8ab34Slling */ 24b1b8ab34Slling 25*ad135b5dSChristopher Siden /* 26*ad135b5dSChristopher Siden * Copyright (c) 2012 by Delphix. All rights reserved. 27*ad135b5dSChristopher Siden */ 28*ad135b5dSChristopher Siden 29b1b8ab34Slling #ifndef _SYS_DMU_H 30b1b8ab34Slling #define _SYS_DMU_H 31b1b8ab34Slling 32b1b8ab34Slling /* 33b1b8ab34Slling * This file describes the interface that the DMU provides for its 34b1b8ab34Slling * consumers. 35b1b8ab34Slling * 36b1b8ab34Slling * The DMU also interacts with the SPA. That interface is described in 37b1b8ab34Slling * dmu_spa.h. 38b1b8ab34Slling */ 39*ad135b5dSChristopher Siden 40*ad135b5dSChristopher Siden #define B_FALSE 0 41*ad135b5dSChristopher Siden #define B_TRUE 1 42*ad135b5dSChristopher Siden 43*ad135b5dSChristopher Siden #define DMU_OT_NEWTYPE 0x80 44*ad135b5dSChristopher Siden #define DMU_OT_METADATA 0x40 45*ad135b5dSChristopher Siden #define DMU_OT_BYTESWAP_MASK 0x3f 46*ad135b5dSChristopher Siden 47*ad135b5dSChristopher Siden #define DMU_OT(byteswap, metadata) \ 48*ad135b5dSChristopher Siden (DMU_OT_NEWTYPE | \ 49*ad135b5dSChristopher Siden ((metadata) ? DMU_OT_METADATA : 0) | \ 50*ad135b5dSChristopher Siden ((byteswap) & DMU_OT_BYTESWAP_MASK)) 51*ad135b5dSChristopher Siden 52*ad135b5dSChristopher Siden #define DMU_OT_IS_VALID(ot) (((ot) & DMU_OT_NEWTYPE) ? \ 53*ad135b5dSChristopher Siden ((ot) & DMU_OT_BYTESWAP_MASK) < DMU_BSWAP_NUMFUNCS : \ 54*ad135b5dSChristopher Siden (ot) < DMU_OT_NUMTYPES) 55*ad135b5dSChristopher Siden 56*ad135b5dSChristopher Siden #define DMU_OT_IS_METADATA(ot) (((ot) & DMU_OT_NEWTYPE) ? \ 57*ad135b5dSChristopher Siden ((ot) & DMU_OT_METADATA) : \ 58*ad135b5dSChristopher Siden dmu_ot[(ot)].ot_metadata) 59*ad135b5dSChristopher Siden 60*ad135b5dSChristopher Siden typedef enum dmu_object_byteswap { 61*ad135b5dSChristopher Siden DMU_BSWAP_UINT8, 62*ad135b5dSChristopher Siden DMU_BSWAP_UINT16, 63*ad135b5dSChristopher Siden DMU_BSWAP_UINT32, 64*ad135b5dSChristopher Siden DMU_BSWAP_UINT64, 65*ad135b5dSChristopher Siden DMU_BSWAP_ZAP, 66*ad135b5dSChristopher Siden DMU_BSWAP_DNODE, 67*ad135b5dSChristopher Siden DMU_BSWAP_OBJSET, 68*ad135b5dSChristopher Siden DMU_BSWAP_ZNODE, 69*ad135b5dSChristopher Siden DMU_BSWAP_OLDACL, 70*ad135b5dSChristopher Siden DMU_BSWAP_ACL, 71*ad135b5dSChristopher Siden DMU_BSWAP_NUMFUNCS 72*ad135b5dSChristopher Siden } dmu_object_byteswap_t; 73*ad135b5dSChristopher Siden 74b1b8ab34Slling typedef enum dmu_object_type { 75b1b8ab34Slling DMU_OT_NONE, 76b1b8ab34Slling /* general: */ 77b1b8ab34Slling DMU_OT_OBJECT_DIRECTORY, /* ZAP */ 78b1b8ab34Slling DMU_OT_OBJECT_ARRAY, /* UINT64 */ 79b1b8ab34Slling DMU_OT_PACKED_NVLIST, /* UINT8 (XDR by nvlist_pack/unpack) */ 80b1b8ab34Slling DMU_OT_PACKED_NVLIST_SIZE, /* UINT64 */ 81*ad135b5dSChristopher Siden DMU_OT_BPOBJ, /* UINT64 */ 82*ad135b5dSChristopher Siden DMU_OT_BPOBJ_HDR, /* UINT64 */ 83b1b8ab34Slling /* spa: */ 84b1b8ab34Slling DMU_OT_SPACE_MAP_HEADER, /* UINT64 */ 85b1b8ab34Slling DMU_OT_SPACE_MAP, /* UINT64 */ 86b1b8ab34Slling /* zil: */ 87b1b8ab34Slling DMU_OT_INTENT_LOG, /* UINT64 */ 88b1b8ab34Slling /* dmu: */ 89b1b8ab34Slling DMU_OT_DNODE, /* DNODE */ 90b1b8ab34Slling DMU_OT_OBJSET, /* OBJSET */ 91b1b8ab34Slling /* dsl: */ 92b1b8ab34Slling DMU_OT_DSL_DIR, /* UINT64 */ 93b1b8ab34Slling DMU_OT_DSL_DIR_CHILD_MAP, /* ZAP */ 94b1b8ab34Slling DMU_OT_DSL_DS_SNAP_MAP, /* ZAP */ 95b1b8ab34Slling DMU_OT_DSL_PROPS, /* ZAP */ 96b1b8ab34Slling DMU_OT_DSL_DATASET, /* UINT64 */ 97b1b8ab34Slling /* zpl: */ 98b1b8ab34Slling DMU_OT_ZNODE, /* ZNODE */ 99*ad135b5dSChristopher Siden DMU_OT_OLDACL, /* Old ACL */ 100b1b8ab34Slling DMU_OT_PLAIN_FILE_CONTENTS, /* UINT8 */ 101b1b8ab34Slling DMU_OT_DIRECTORY_CONTENTS, /* ZAP */ 102b1b8ab34Slling DMU_OT_MASTER_NODE, /* ZAP */ 103b1b8ab34Slling DMU_OT_UNLINKED_SET, /* ZAP */ 104b1b8ab34Slling /* zvol: */ 105b1b8ab34Slling DMU_OT_ZVOL, /* UINT8 */ 106b1b8ab34Slling DMU_OT_ZVOL_PROP, /* ZAP */ 107b1b8ab34Slling /* other; for testing only! */ 108b1b8ab34Slling DMU_OT_PLAIN_OTHER, /* UINT8 */ 109b1b8ab34Slling DMU_OT_UINT64_OTHER, /* UINT64 */ 110b1b8ab34Slling DMU_OT_ZAP_OTHER, /* ZAP */ 111b1b8ab34Slling /* new object types: */ 112b1b8ab34Slling DMU_OT_ERROR_LOG, /* ZAP */ 113b1b8ab34Slling DMU_OT_SPA_HISTORY, /* UINT8 */ 114b1b8ab34Slling DMU_OT_SPA_HISTORY_OFFSETS, /* spa_his_phys_t */ 115b1b8ab34Slling DMU_OT_POOL_PROPS, /* ZAP */ 1160a586ceaSMark Shellenbaum DMU_OT_DSL_PERMS, /* ZAP */ 1170a586ceaSMark Shellenbaum DMU_OT_ACL, /* ACL */ 1180a586ceaSMark Shellenbaum DMU_OT_SYSACL, /* SYSACL */ 1190a586ceaSMark Shellenbaum DMU_OT_FUID, /* FUID table (Packed NVLIST UINT8) */ 1200a586ceaSMark Shellenbaum DMU_OT_FUID_SIZE, /* FUID table size UINT64 */ 1210a586ceaSMark Shellenbaum DMU_OT_NEXT_CLONES, /* ZAP */ 122*ad135b5dSChristopher Siden DMU_OT_SCAN_QUEUE, /* ZAP */ 1230a586ceaSMark Shellenbaum DMU_OT_USERGROUP_USED, /* ZAP */ 1240a586ceaSMark Shellenbaum DMU_OT_USERGROUP_QUOTA, /* ZAP */ 1250a586ceaSMark Shellenbaum DMU_OT_USERREFS, /* ZAP */ 1260a586ceaSMark Shellenbaum DMU_OT_DDT_ZAP, /* ZAP */ 1270a586ceaSMark Shellenbaum DMU_OT_DDT_STATS, /* ZAP */ 1280a586ceaSMark Shellenbaum DMU_OT_SA, /* System attr */ 1290a586ceaSMark Shellenbaum DMU_OT_SA_MASTER_NODE, /* ZAP */ 1300a586ceaSMark Shellenbaum DMU_OT_SA_ATTR_REGISTRATION, /* ZAP */ 1310a586ceaSMark Shellenbaum DMU_OT_SA_ATTR_LAYOUTS, /* ZAP */ 132*ad135b5dSChristopher Siden DMU_OT_SCAN_XLATE, /* ZAP */ 133*ad135b5dSChristopher Siden DMU_OT_DEDUP, /* fake dedup BP from ddt_bp_create() */ 134*ad135b5dSChristopher Siden DMU_OT_DEADLIST, /* ZAP */ 135*ad135b5dSChristopher Siden DMU_OT_DEADLIST_HDR, /* UINT64 */ 136*ad135b5dSChristopher Siden DMU_OT_DSL_CLONES, /* ZAP */ 137*ad135b5dSChristopher Siden DMU_OT_BPOBJ_SUBOBJ, /* UINT64 */ 138*ad135b5dSChristopher Siden DMU_OT_NUMTYPES, 139*ad135b5dSChristopher Siden 140*ad135b5dSChristopher Siden DMU_OTN_UINT8_DATA = DMU_OT(DMU_BSWAP_UINT8, B_FALSE), 141*ad135b5dSChristopher Siden DMU_OTN_UINT8_METADATA = DMU_OT(DMU_BSWAP_UINT8, B_TRUE), 142*ad135b5dSChristopher Siden DMU_OTN_UINT16_DATA = DMU_OT(DMU_BSWAP_UINT16, B_FALSE), 143*ad135b5dSChristopher Siden DMU_OTN_UINT16_METADATA = DMU_OT(DMU_BSWAP_UINT16, B_TRUE), 144*ad135b5dSChristopher Siden DMU_OTN_UINT32_DATA = DMU_OT(DMU_BSWAP_UINT32, B_FALSE), 145*ad135b5dSChristopher Siden DMU_OTN_UINT32_METADATA = DMU_OT(DMU_BSWAP_UINT32, B_TRUE), 146*ad135b5dSChristopher Siden DMU_OTN_UINT64_DATA = DMU_OT(DMU_BSWAP_UINT64, B_FALSE), 147*ad135b5dSChristopher Siden DMU_OTN_UINT64_METADATA = DMU_OT(DMU_BSWAP_UINT64, B_TRUE), 148*ad135b5dSChristopher Siden DMU_OTN_ZAP_DATA = DMU_OT(DMU_BSWAP_ZAP, B_FALSE), 149*ad135b5dSChristopher Siden DMU_OTN_ZAP_METADATA = DMU_OT(DMU_BSWAP_ZAP, B_TRUE), 150b1b8ab34Slling } dmu_object_type_t; 151b1b8ab34Slling 152b1b8ab34Slling typedef enum dmu_objset_type { 153b1b8ab34Slling DMU_OST_NONE, 154b1b8ab34Slling DMU_OST_META, 155b1b8ab34Slling DMU_OST_ZFS, 156b1b8ab34Slling DMU_OST_ZVOL, 157b1b8ab34Slling DMU_OST_OTHER, /* For testing only! */ 158b1b8ab34Slling DMU_OST_ANY, /* Be careful! */ 159b1b8ab34Slling DMU_OST_NUMTYPES 160b1b8ab34Slling } dmu_objset_type_t; 161b1b8ab34Slling 162b1b8ab34Slling /* 163b1b8ab34Slling * The names of zap entries in the DIRECTORY_OBJECT of the MOS. 164b1b8ab34Slling */ 165b1b8ab34Slling #define DMU_POOL_DIRECTORY_OBJECT 1 166b1b8ab34Slling #define DMU_POOL_CONFIG "config" 167*ad135b5dSChristopher Siden #define DMU_POOL_FEATURES_FOR_READ "features_for_read" 168*ad135b5dSChristopher Siden #define DMU_POOL_FEATURES_FOR_WRITE "features_for_write" 169*ad135b5dSChristopher Siden #define DMU_POOL_FEATURE_DESCRIPTIONS "feature_descriptions" 170b1b8ab34Slling #define DMU_POOL_ROOT_DATASET "root_dataset" 171b1b8ab34Slling #define DMU_POOL_SYNC_BPLIST "sync_bplist" 172b1b8ab34Slling #define DMU_POOL_ERRLOG_SCRUB "errlog_scrub" 173b1b8ab34Slling #define DMU_POOL_ERRLOG_LAST "errlog_last" 174b1b8ab34Slling #define DMU_POOL_SPARES "spares" 175b1b8ab34Slling #define DMU_POOL_DEFLATE "deflate" 176b1b8ab34Slling #define DMU_POOL_HISTORY "history" 177b1b8ab34Slling #define DMU_POOL_PROPS "pool_props" 178fa94a07fSbrendan #define DMU_POOL_L2CACHE "l2cache" 179b1b8ab34Slling 180b1b8ab34Slling #endif /* _SYS_DMU_H */ 181