From 3003ecec8c44251f02d39d8233b2103a0cc7426b Mon Sep 17 00:00:00 2001 From: "Michael I. Bushnell" Date: Tue, 23 Apr 1996 15:28:35 +0000 Subject: (swab_disk): New variable. (swab_short, swab_long): New functions. --- ufs/ufs.h | 23 +++++++++++++++++++++++ 1 file changed, 23 insertions(+) (limited to 'ufs/ufs.h') 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 *, -- cgit v1.2.3