dmu.h 5.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165
  1. /*
  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. #ifndef _SYS_DMU_H
  23. #define _SYS_DMU_H
  24. #define B_FALSE 0
  25. #define B_TRUE 1
  26. #define DMU_OT_NEWTYPE 0x80
  27. #define DMU_OT_METADATA 0x40
  28. #define DMU_OT_BYTESWAP_MASK 0x3f
  29. #define DMU_OT(byteswap, metadata) \
  30. (DMU_OT_NEWTYPE | \
  31. ((metadata) ? DMU_OT_METADATA : 0) | \
  32. ((byteswap) & DMU_OT_BYTESWAP_MASK))
  33. #define DMU_OT_IS_VALID(ot) (((ot) & DMU_OT_NEWTYPE) ? \
  34. ((ot) & DMU_OT_BYTESWAP_MASK) < DMU_BSWAP_NUMFUNCS : \
  35. (ot) < DMU_OT_NUMTYPES)
  36. #define DMU_OT_IS_METADATA(ot) (((ot) & DMU_OT_NEWTYPE) ? \
  37. ((ot) & DMU_OT_METADATA) : \
  38. dmu_ot[(ot)].ot_metadata)
  39. typedef enum dmu_object_byteswap {
  40. DMU_BSWAP_UINT8,
  41. DMU_BSWAP_UINT16,
  42. DMU_BSWAP_UINT32,
  43. DMU_BSWAP_UINT64,
  44. DMU_BSWAP_ZAP,
  45. DMU_BSWAP_DNODE,
  46. DMU_BSWAP_OBJSET,
  47. DMU_BSWAP_ZNODE,
  48. DMU_BSWAP_OLDACL,
  49. DMU_BSWAP_ACL,
  50. DMU_BSWAP_NUMFUNCS
  51. } dmu_object_byteswap_t;
  52. /*
  53. * This file describes the interface that the DMU provides for its
  54. * consumers.
  55. *
  56. * The DMU also interacts with the SPA. That interface is described in
  57. * dmu_spa.h.
  58. */
  59. typedef enum dmu_object_type {
  60. DMU_OT_NONE,
  61. /* general: */
  62. DMU_OT_OBJECT_DIRECTORY, /* ZAP */
  63. DMU_OT_OBJECT_ARRAY, /* UINT64 */
  64. DMU_OT_PACKED_NVLIST, /* UINT8 (XDR by nvlist_pack/unpack) */
  65. DMU_OT_PACKED_NVLIST_SIZE, /* UINT64 */
  66. DMU_OT_BPLIST, /* UINT64 */
  67. DMU_OT_BPLIST_HDR, /* UINT64 */
  68. /* spa: */
  69. DMU_OT_SPACE_MAP_HEADER, /* UINT64 */
  70. DMU_OT_SPACE_MAP, /* UINT64 */
  71. /* zil: */
  72. DMU_OT_INTENT_LOG, /* UINT64 */
  73. /* dmu: */
  74. DMU_OT_DNODE, /* DNODE */
  75. DMU_OT_OBJSET, /* OBJSET */
  76. /* dsl: */
  77. DMU_OT_DSL_DIR, /* UINT64 */
  78. DMU_OT_DSL_DIR_CHILD_MAP, /* ZAP */
  79. DMU_OT_DSL_DS_SNAP_MAP, /* ZAP */
  80. DMU_OT_DSL_PROPS, /* ZAP */
  81. DMU_OT_DSL_DATASET, /* UINT64 */
  82. /* zpl: */
  83. DMU_OT_ZNODE, /* ZNODE */
  84. DMU_OT_OLDACL, /* OLD ACL */
  85. DMU_OT_PLAIN_FILE_CONTENTS, /* UINT8 */
  86. DMU_OT_DIRECTORY_CONTENTS, /* ZAP */
  87. DMU_OT_MASTER_NODE, /* ZAP */
  88. DMU_OT_UNLINKED_SET, /* ZAP */
  89. /* zvol: */
  90. DMU_OT_ZVOL, /* UINT8 */
  91. DMU_OT_ZVOL_PROP, /* ZAP */
  92. /* other; for testing only! */
  93. DMU_OT_PLAIN_OTHER, /* UINT8 */
  94. DMU_OT_UINT64_OTHER, /* UINT64 */
  95. DMU_OT_ZAP_OTHER, /* ZAP */
  96. /* new object types: */
  97. DMU_OT_ERROR_LOG, /* ZAP */
  98. DMU_OT_SPA_HISTORY, /* UINT8 */
  99. DMU_OT_SPA_HISTORY_OFFSETS, /* spa_his_phys_t */
  100. DMU_OT_POOL_PROPS, /* ZAP */
  101. DMU_OT_DSL_PERMS, /* ZAP */
  102. DMU_OT_ACL, /* ACL */
  103. DMU_OT_SYSACL, /* SYSACL */
  104. DMU_OT_FUID, /* FUID table (Packed NVLIST UINT8) */
  105. DMU_OT_FUID_SIZE, /* FUID table size UINT64 */
  106. DMU_OT_NEXT_CLONES, /* ZAP */
  107. DMU_OT_SCRUB_QUEUE, /* ZAP */
  108. DMU_OT_USERGROUP_USED, /* ZAP */
  109. DMU_OT_USERGROUP_QUOTA, /* ZAP */
  110. DMU_OT_USERREFS, /* ZAP */
  111. DMU_OT_DDT_ZAP, /* ZAP */
  112. DMU_OT_DDT_STATS, /* ZAP */
  113. DMU_OT_SA, /* System attr */
  114. DMU_OT_SA_MASTER_NODE, /* ZAP */
  115. DMU_OT_SA_ATTR_REGISTRATION, /* ZAP */
  116. DMU_OT_SA_ATTR_LAYOUTS, /* ZAP */
  117. DMU_OT_DSL_KEYCHAIN = 54,
  118. DMU_OT_NUMTYPES,
  119. DMU_OTN_UINT8_DATA = DMU_OT(DMU_BSWAP_UINT8, B_FALSE),
  120. DMU_OTN_UINT8_METADATA = DMU_OT(DMU_BSWAP_UINT8, B_TRUE),
  121. DMU_OTN_UINT16_DATA = DMU_OT(DMU_BSWAP_UINT16, B_FALSE),
  122. DMU_OTN_UINT16_METADATA = DMU_OT(DMU_BSWAP_UINT16, B_TRUE),
  123. DMU_OTN_UINT32_DATA = DMU_OT(DMU_BSWAP_UINT32, B_FALSE),
  124. DMU_OTN_UINT32_METADATA = DMU_OT(DMU_BSWAP_UINT32, B_TRUE),
  125. DMU_OTN_UINT64_DATA = DMU_OT(DMU_BSWAP_UINT64, B_FALSE),
  126. DMU_OTN_UINT64_METADATA = DMU_OT(DMU_BSWAP_UINT64, B_TRUE),
  127. DMU_OTN_ZAP_DATA = DMU_OT(DMU_BSWAP_ZAP, B_FALSE),
  128. DMU_OTN_ZAP_METADATA = DMU_OT(DMU_BSWAP_ZAP, B_TRUE),
  129. } dmu_object_type_t;
  130. typedef enum dmu_objset_type {
  131. DMU_OST_NONE,
  132. DMU_OST_META,
  133. DMU_OST_ZFS,
  134. DMU_OST_ZVOL,
  135. DMU_OST_OTHER, /* For testing only! */
  136. DMU_OST_ANY, /* Be careful! */
  137. DMU_OST_NUMTYPES
  138. } dmu_objset_type_t;
  139. /*
  140. * The names of zap entries in the DIRECTORY_OBJECT of the MOS.
  141. */
  142. #define DMU_POOL_DIRECTORY_OBJECT 1
  143. #define DMU_POOL_CONFIG "config"
  144. #define DMU_POOL_ROOT_DATASET "root_dataset"
  145. #define DMU_POOL_SYNC_BPLIST "sync_bplist"
  146. #define DMU_POOL_ERRLOG_SCRUB "errlog_scrub"
  147. #define DMU_POOL_ERRLOG_LAST "errlog_last"
  148. #define DMU_POOL_SPARES "spares"
  149. #define DMU_POOL_DEFLATE "deflate"
  150. #define DMU_POOL_HISTORY "history"
  151. #define DMU_POOL_PROPS "pool_props"
  152. #define DMU_POOL_L2CACHE "l2cache"
  153. #define DMU_POOL_FEATURES_FOR_READ "features_for_read"
  154. #endif /* _SYS_DMU_H */