summaryrefslogtreecommitdiff
path: root/ufs
diff options
context:
space:
mode:
authorMichael I. Bushnell <mib@gnu.org>1996-04-23 15:28:35 +0000
committerMichael I. Bushnell <mib@gnu.org>1996-04-23 15:28:35 +0000
commit932061675dc1b20e7947c6cb4e0bcbd8d5d06d30 (patch)
treeb1f6b33192dcdcaad39646569d6c3419f61c3395 /ufs
parent08c30d78151d6e0166c82272c9e3293acdf08a6b (diff)
(swab_disk): New variable.
(swab_short, swab_long): New functions.
Diffstat (limited to 'ufs')
-rw-r--r--ufs/ufs.h23
1 files changed, 23 insertions, 0 deletions
diff --git a/ufs/ufs.h b/ufs/ufs.h
index ca186434..68a5dece 100644
--- a/ufs/ufs.h
+++ b/ufs/ufs.h
@@ -112,6 +112,9 @@ enum compat_mode
of the dinode. */
int direct_symlink_extension;
+/* If this is set, then the disk is byteswapped from native order. */
+int swab_disk;
+
/* Handy macros */
#define DEV_BSIZE 512
@@ -165,6 +168,26 @@ sync_dinode (int inum, int wait)
{
sync_disk_blocks (ino_to_fsba (sblock, inum), sblock->fs_fsize, wait);
}
+
+
+/* Functions for byte swapping */
+extern inline short
+swab_short (short arg)
+{
+ return (((arg & 0xff) << 8)
+ | ((arg & 0xff00) >> 8));
+}
+
+extern inline long
+swab_long (long arg)
+{
+ return (((arg & 0xff) << 24)
+ | ((arg & 0xff00) << 8)
+ | ((arg & 0xff0000) >> 8)
+ | ((arg & 0xff000000) >> 24));
+}
+
+
/* From alloc.c: */
error_t ffs_alloc (struct node *, daddr_t, daddr_t, int, daddr_t *,