diff options
author | Michael I. Bushnell <mib@gnu.org> | 1996-04-23 15:28:35 +0000 |
---|---|---|
committer | Michael I. Bushnell <mib@gnu.org> | 1996-04-23 15:28:35 +0000 |
commit | 932061675dc1b20e7947c6cb4e0bcbd8d5d06d30 (patch) | |
tree | b1f6b33192dcdcaad39646569d6c3419f61c3395 | |
parent | 08c30d78151d6e0166c82272c9e3293acdf08a6b (diff) |
(swab_disk): New variable.
(swab_short, swab_long): New functions.
-rw-r--r-- | ufs/ufs.h | 23 |
1 files changed, 23 insertions, 0 deletions
@@ -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 *, |