From aa944aa3453e47706685bc562711a9e87375941e Mon Sep 17 00:00:00 2001 From: Ralf Baechle Date: Tue, 16 Dec 1997 06:06:25 +0000 Subject: Merge with Linux 2.1.72, part 2. The new signal code with exception of the code for the rt signals. The definitions in and are currently just stolen from the Alpha and will need to be overhauled. --- fs/ufs/ufs_swab.h | 59 +++++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 59 insertions(+) create mode 100644 fs/ufs/ufs_swab.h (limited to 'fs/ufs/ufs_swab.h') diff --git a/fs/ufs/ufs_swab.h b/fs/ufs/ufs_swab.h new file mode 100644 index 000000000..921fb3d79 --- /dev/null +++ b/fs/ufs/ufs_swab.h @@ -0,0 +1,59 @@ +/* + * linux/fs/ufs/ufs_swab.h + * + * Copyright (C) 1997 + * Francois-Rene Rideau + * + */ + +#ifndef _UFS_SWAB_H +#define _UFS_SWAB_H + + +/* + * Notes: + * (1) HERE WE ASSUME EITHER BIG OR LITTLE ENDIAN UFSes + * in case there are ufs implementations that have strange bytesexes, + * you'll need to modify code here as well as in ufs_super.c and ufs_fs.h + * to support them. + * (2) for a read/write ufs driver, we should distinguish + * between byteswapping for read or write accesses! + */ + +#include +#include + +/* + * These are only valid inside ufs routines, + * after bytesex has been initialized to sb->u.ufs_sb.s_flags&UFS_BYTESEX + */ +#define SWAB16(x) ufs_swab16(bytesex,x) +#define SWAB32(x) ufs_swab32(bytesex,x) +#define SWAB64(x) ufs_swab64(bytesex,x) + +extern __inline__ __const__ __u16 ufs_swab16(__u32 bytesex, __u16 x) { + if (bytesex == UFS_LITTLE_ENDIAN) { + return le16_to_cpu(x); + } else { + return be16_to_cpu(x); + } +} +extern __inline__ __const__ __u32 ufs_swab32(__u32 bytesex, __u32 x) { + if (bytesex == UFS_LITTLE_ENDIAN) { + return le32_to_cpu(x); + } else { + return be32_to_cpu(x); + } +} +extern __inline__ __const__ __u64 ufs_swab64(__u32 bytesex, __u64 x) { + if (bytesex == UFS_LITTLE_ENDIAN) { + return le64_to_cpu(x); + } else { + return be64_to_cpu(x); + } +} + +extern void ufs_superblock_le_to_cpus(struct ufs_superblock * usb); +extern void ufs_superblock_be_to_cpus(struct ufs_superblock * usb); + +#endif /* _UFS_SWAB_H */ -- cgit v1.2.3