Print this page
feature flags + bug fix

@@ -17,10 +17,13 @@
  */
 /*
  * Copyright 2010 Sun Microsystems, Inc.  All rights reserved.
  * Use is subject to license terms.
  */
+/*
+ *  Copyright 2012, Daniil Lunev
+ */
 
 #ifndef _SYS_DMU_H
 #define _SYS_DMU_H
 
 /*

@@ -28,10 +31,45 @@
  * consumers.
  *
  * The DMU also interacts with the SPA.  That interface is described in
  * dmu_spa.h.
  */
+
+#define  B_FALSE  0
+#define  B_TRUE  1
+
+#define  DMU_OT_NEWTYPE 0x80
+#define  DMU_OT_METADATA 0x40
+#define  DMU_OT_BYTESWAP_MASK 0x3f
+
+#define  DMU_OT(byteswap, metadata) \
+  (DMU_OT_NEWTYPE | \
+  ((metadata) ? DMU_OT_METADATA : 0) | \
+  ((byteswap) & DMU_OT_BYTESWAP_MASK))
+
+#define  DMU_OT_IS_VALID(ot) (((ot) & DMU_OT_NEWTYPE) ? \
+  ((ot) & DMU_OT_BYTESWAP_MASK) < DMU_BSWAP_NUMFUNCS : \
+  (ot) < DMU_OT_NUMTYPES)
+
+#define  DMU_OT_IS_METADATA(ot) (((ot) & DMU_OT_NEWTYPE) ? \
+  ((ot) & DMU_OT_METADATA) : \
+  dmu_ot[(ot)].ot_metadata)
+
+typedef enum dmu_object_byteswap {
+  DMU_BSWAP_UINT8,
+  DMU_BSWAP_UINT16,
+  DMU_BSWAP_UINT32,
+  DMU_BSWAP_UINT64,
+  DMU_BSWAP_ZAP,
+  DMU_BSWAP_DNODE,
+  DMU_BSWAP_OBJSET,
+  DMU_BSWAP_ZNODE,
+  DMU_BSWAP_OLDACL,
+  DMU_BSWAP_ACL,
+  DMU_BSWAP_NUMFUNCS
+} dmu_object_byteswap_t;
+
 typedef enum dmu_object_type {
         DMU_OT_NONE,
         /* general: */
         DMU_OT_OBJECT_DIRECTORY,        /* ZAP */
         DMU_OT_OBJECT_ARRAY,            /* UINT64 */

@@ -87,11 +125,13 @@
         DMU_OT_SA,                      /* System attr */
         DMU_OT_SA_MASTER_NODE,          /* ZAP */
         DMU_OT_SA_ATTR_REGISTRATION,    /* ZAP */
         DMU_OT_SA_ATTR_LAYOUTS,         /* ZAP */
         DMU_OT_DSL_KEYCHAIN = 54,
-        DMU_OT_NUMTYPES
+        DMU_OT_NUMTYPES,
+        
+        DMU_OTN_ZAP_METADATA = DMU_OT(DMU_BSWAP_ZAP, B_TRUE),
 } dmu_object_type_t;
 
 typedef enum dmu_objset_type {
         DMU_OST_NONE,
         DMU_OST_META,

@@ -114,7 +154,8 @@
 #define DMU_POOL_SPARES                 "spares"
 #define DMU_POOL_DEFLATE                "deflate"
 #define DMU_POOL_HISTORY                "history"
 #define DMU_POOL_PROPS                  "pool_props"
 #define DMU_POOL_L2CACHE                "l2cache"
+#define DMU_POOL_FEATURES_FOR_READ      "features_for_read"
 
 #endif  /* _SYS_DMU_H */