summaryrefslogtreecommitdiff
path: root/ufs/ufs.h
diff options
context:
space:
mode:
authorMichael I. Bushnell <mib@gnu.org>1996-04-23 16:02:54 +0000
committerMichael I. Bushnell <mib@gnu.org>1996-04-23 16:02:54 +0000
commit74b0f23a3aca3c0dedd09a3143afc1141f37d1fd (patch)
treeb1e97eb62c23889c8d1f15f8affcd5417019484b /ufs/ufs.h
parent976f3e6b59ac2071647c86d884e808af10dd48d4 (diff)
(read_disk_entry): New macro.
Diffstat (limited to 'ufs/ufs.h')
-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; \
+})
+
+