summaryrefslogtreecommitdiff
path: root/ufs/ufs.h
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
commit3003ecec8c44251f02d39d8233b2103a0cc7426b (patch)
tree19818dab8ca8cd844b92e4eaeb703947a34bdf45 /ufs/ufs.h
parent9b2babc70f9e77c4acc6d22d30c99913490f2d74 (diff)
(swab_disk): New variable.
(swab_short, swab_long): New functions.
Diffstat (limited to 'ufs/ufs.h')
-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 *,