summaryrefslogtreecommitdiffstats
path: root/include/sys/dmu.h
diff options
context:
space:
mode:
authorMatthew Ahrens <[email protected]>2018-04-06 13:30:26 -0700
committerBrian Behlendorf <[email protected]>2018-04-06 13:30:26 -0700
commit5c27ec10889d3d8f12d59fb7e5068ed2d8697c85 (patch)
tree299ac1b7654029e6c3281baf560a1fcde4f60751 /include/sys/dmu.h
parent0ba106e75c6cda806cb5d2003b918e658f2ff86c (diff)
Fixes for SNPRINTF_BLKPTR with encrypted BP's
mdb doesn't have dmu_ot[], so we need a different mechanism for its SNPRINTF_BLKPTR() to determine if the BP is encrypted vs authenticated. Additionally, since it already relies on BP_IS_ENCRYPTED (etc), SNPRINTF_BLKPTR might as well figure out the "crypt_type" on its own, rather than making the caller do so. Reviewed-by: Brian Behlendorf <[email protected]> Reviewed-by: Tom Caputi <[email protected]> Signed-off-by: Matthew Ahrens <[email protected]> Closes #7390
Diffstat (limited to 'include/sys/dmu.h')
-rw-r--r--include/sys/dmu.h15
1 files changed, 12 insertions, 3 deletions
diff --git a/include/sys/dmu.h b/include/sys/dmu.h
index 4d805b6d7..027d3d9fc 100644
--- a/include/sys/dmu.h
+++ b/include/sys/dmu.h
@@ -119,13 +119,22 @@ typedef enum dmu_object_byteswap {
((ot) & DMU_OT_BYTESWAP_MASK) < DMU_BSWAP_NUMFUNCS : \
(ot) < DMU_OT_NUMTYPES)
+/*
+ * MDB doesn't have dmu_ot; it defines these macros itself.
+ */
+#ifndef ZFS_MDB
+#define DMU_OT_IS_METADATA_IMPL(ot) (dmu_ot[ot].ot_metadata)
+#define DMU_OT_IS_ENCRYPTED_IMPL(ot) (dmu_ot[ot].ot_encrypt)
+#define DMU_OT_BYTESWAP_IMPL(ot) (dmu_ot[ot].ot_byteswap)
+#endif
+
#define DMU_OT_IS_METADATA(ot) (((ot) & DMU_OT_NEWTYPE) ? \
((ot) & DMU_OT_METADATA) : \
- dmu_ot[(int)(ot)].ot_metadata)
+ DMU_OT_IS_METADATA_IMPL(ot))
#define DMU_OT_IS_ENCRYPTED(ot) (((ot) & DMU_OT_NEWTYPE) ? \
((ot) & DMU_OT_ENCRYPTED) : \
- dmu_ot[(int)(ot)].ot_encrypt)
+ DMU_OT_IS_ENCRYPTED_IMPL(ot))
/*
* These object types use bp_fill != 1 for their L0 bp's. Therefore they can't
@@ -137,7 +146,7 @@ typedef enum dmu_object_byteswap {
#define DMU_OT_BYTESWAP(ot) (((ot) & DMU_OT_NEWTYPE) ? \
((ot) & DMU_OT_BYTESWAP_MASK) : \
- dmu_ot[(int)(ot)].ot_byteswap)
+ DMU_OT_BYTESWAP_IMPL(ot))
typedef enum dmu_object_type {
DMU_OT_NONE,