summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--ufs/ufs.h15
1 files changed, 15 insertions, 0 deletions
diff --git a/ufs/ufs.h b/ufs/ufs.h
index 68a5dece..ba778e1d 100644
--- a/ufs/ufs.h
+++ b/ufs/ufs.h
@@ -186,6 +186,21 @@ swab_long (long arg)
| ((arg & 0xff0000) >> 8)
| ((arg & 0xff000000) >> 24));
}
+
+/* Return *ENTRYP, after byteswapping it if necessary */
+#define read_disk_entry(entryp) \
+({ \
+ if (!swab_disk || sizeof (*entryp) == 1) \
+ *entryp; \
+ else if (sizeof (*entryp) == 2) \
+ swab_short (*entryp); \
+ else if (sizeof (*entry) == 4) \
+ swab_long (*entryp); \
+ else \
+ abort; \
+})
+
+