patch-2.1.122 linux/fs/sysv/inode.c
Next file: linux/fs/sysv/truncate.c
Previous file: linux/fs/sysv/fsync.c
Back to the patch index
Back to the overall index
- Lines: 86
- Date:
Sun Sep 13 12:12:34 1998
- Orig file:
v2.1.121/linux/fs/sysv/inode.c
- Orig date:
Wed Apr 8 19:36:28 1998
diff -u --recursive --new-file v2.1.121/linux/fs/sysv/inode.c linux/fs/sysv/inode.c
@@ -30,7 +30,7 @@
#include <linux/string.h>
#include <linux/locks.h>
#include <linux/init.h>
-
+#include <asm/byteorder.h>
#include <asm/uaccess.h>
#if 0
@@ -532,7 +532,7 @@
void sysv_put_super(struct super_block *sb)
{
- /* we can assume sysv_write_super() has already been called, and
+ /* we can assume sysv_write_super() has already been called,
and that the superblock is locked */
brelse(sb->sv_bh1);
if (sb->sv_bh1 != sb->sv_bh2) brelse(sb->sv_bh2);
@@ -648,8 +648,8 @@
static struct buffer_head * inode_getblk(struct inode * inode, int nr, int create)
{
struct super_block *sb;
- unsigned long tmp;
- unsigned long *p;
+ u32 tmp;
+ u32 *p;
struct buffer_head * result;
sb = inode->i_sb;
@@ -684,7 +684,7 @@
struct buffer_head * bh, int nr, int create)
{
struct super_block *sb;
- unsigned long tmp, block;
+ u32 tmp, block;
sysv_zone_t *p;
struct buffer_head * result;
@@ -782,26 +782,43 @@
return NULL;
}
+#ifdef __BIG_ENDIAN
+
+static inline unsigned long read3byte (unsigned char * p)
+{
+ return (p[2] | (p[1]<<8) | (p[0]<<16));
+}
+
+static inline void write3byte (unsigned char *p , unsigned long val)
+{
+ p[2]=val&0xFF;
+ p[1]=(val>>8)&0xFF;
+ p[0]=(val>>16)&0xFF;
+}
+
+#else
-static inline unsigned long read3byte (char * p)
+static inline unsigned long read3byte (unsigned char * p)
{
return (unsigned long)(*(unsigned short *)p)
| (unsigned long)(*(unsigned char *)(p+2)) << 16;
}
-static inline void write3byte (char * p, unsigned long val)
+static inline void write3byte (unsigned char * p, unsigned long val)
{
*(unsigned short *)p = (unsigned short) val;
*(unsigned char *)(p+2) = val >> 16;
}
-static inline unsigned long coh_read3byte (char * p)
+#endif
+
+static inline unsigned long coh_read3byte (unsigned char * p)
{
return (unsigned long)(*(unsigned char *)p) << 16
| (unsigned long)(*(unsigned short *)(p+1));
}
-static inline void coh_write3byte (char * p, unsigned long val)
+static inline void coh_write3byte (unsigned char * p, unsigned long val)
{
*(unsigned char *)p = val >> 16;
*(unsigned short *)(p+1) = (unsigned short) val;
FUNET's LINUX-ADM group, linux-adm@nic.funet.fi
TCL-scripts by Sam Shen, slshen@lbl.gov