[parisc-linux-cvs] LFS patch
Matthew Wilcox
matthew@wil.cx
Tue, 10 Apr 2001 21:08:13 +0100
This patch adds support for the LFS syscalls. Now with 100% fewer
swearwords than the previous patch :-)
Index: arch/parisc/kernel/sys_parisc32.c
===================================================================
RCS file: /home/cvs/parisc/linux/arch/parisc/kernel/sys_parisc32.c,v
retrieving revision 1.3
diff -u -p -r1.3 sys_parisc32.c
--- sys_parisc32.c 2001/03/25 23:29:35 1.3
+++ sys_parisc32.c 2001/04/10 19:47:23
@@ -1,8 +1,9 @@
/*
* sys_parisc32.c: Conversion between 32bit and 64bit native syscalls.
*
- * Copyright (C) 2000 Hewlett Packard Company
+ * Copyright (C) 2000-2001 Hewlett Packard Company
* Copyright (C) 2000 John Marvin
+ * Copyright (C) 2001 Matthew Wilcox
*
* These routines maintain argument size conversion between 32bit and 64bit
* environment. Based heavily on sys_ia32.c and sys_sparc32.c.
@@ -2695,4 +2696,34 @@ asmlinkage long sys32_shmctl(int shmid,
}
return err;
+}
+
+/* LFS */
+
+asmlinkage long sys32_truncate64(const char * path, unsigned int high, unsigned int low)
+{
+ return sys_truncate(path, (loff_t)high << 32 | low);
+}
+
+asmlinkage long sys32_ftruncate64(unsigned int fd, unsigned int high, unsigned int low)
+{
+ return sys_ftruncate(fd, (loff_t)high << 32 | low);
+}
+
+asmlinkage long sys32_fcntl64(unsigned int fd, unsigned int cmd, unsigned long arg)
+{
+ switch (cmd) {
+ case F_GETLK64:
+ cmd = F_GETLK;
+ break;
+ case F_SETLK64:
+ cmd = F_SETLK;
+ break;
+ case F_SETLKW64:
+ cmd = F_SETLKW;
+ break;
+ default:
+ break;
+ }
+ sys_fcntl(fd, cmd, arg);
}
Index: arch/parisc/kernel/syscall.S
===================================================================
RCS file: /home/cvs/parisc/linux/arch/parisc/kernel/syscall.S,v
retrieving revision 1.59
diff -u -p -r1.59 syscall.S
--- syscall.S 2001/03/05 03:20:40 1.59
+++ syscall.S 2001/04/10 19:47:23
@@ -430,7 +430,7 @@ sys_call_table:
ENTRY_SAME(recv)
ENTRY_DIFF(statfs)
ENTRY_DIFF(fstatfs) /* 100 */
- ENTRY_SAME(ni_syscall)
+ ENTRY_SAME(stat64)
/* don't think hppa glibc even provides an entry pt for this
* so disable for now */
ENTRY_UHOH(socketcall)
@@ -445,7 +445,7 @@ sys_call_table:
ENTRY_SAME(pwrite)
ENTRY_SAME(getcwd) /* 110 */
ENTRY_SAME(vhangup)
- ENTRY_SAME(ni_syscall)
+ ENTRY_SAME(fstat64)
ENTRY_SAME(vfork_wrapper)
/* struct rusage contains longs... */
ENTRY_DIFF(wait4)
@@ -552,10 +552,14 @@ sys_call_table:
ENTRY_SAME(shmat_wrapper)
ENTRY_SAME(shmdt)
ENTRY_SAME(shmget)
- /***************/
ENTRY_DIFF(shmctl) /* 195 */
ENTRY_SAME(ni_syscall) /* streams1 */
ENTRY_SAME(ni_syscall) /* streams2 */
+ ENTRY_SAME(lstat64)
+ ENTRY_DIFF(truncate64)
+ ENTRY_DIFF(ftruncate64) /* 200 */
+ ENTRY_SAME(getdents64)
+ ENTRY_DIFF(fcntl64)
.end
Index: fs/open.c
===================================================================
RCS file: /home/cvs/parisc/linux/fs/open.c,v
retrieving revision 1.6
diff -u -p -r1.6 open.c
--- open.c 2000/11/10 21:43:50 1.6
+++ open.c 2001/04/10 19:47:30
@@ -184,17 +184,29 @@ asmlinkage long sys_ftruncate(unsigned i
return do_sys_ftruncate(fd, length);
}
-/* LFS versions of truncate are only needed on 32 bit machines */
+/* LFS versions of truncate are only needed on 32 bit machines.
+ * Unfortunately, they were declared with an `loff_t' in their arguments,
+ * despite syscalls only taking word-size parameters. The calling
+ * conventions allowed this mistake to work by coincidence on some
+ * machines. Hence the ugly LOFF_T macro below. The only excuse is
+ * that we can't think of a better way of solving this misbegottenry.
+ */
#if BITS_PER_LONG == 32
-asmlinkage long sys_truncate64(const char * path, loff_t length)
+#ifdef __BIG_ENDIAN
+#define LOFF_T(high, low) unsigned int high, unsigned int low
+#else
+#define LOFF_T(high, low) unsigned int low, unsigned int high
+#endif
+asmlinkage long sys_truncate64(const char * path, LOFF_T(high, low))
{
- return do_sys_truncate(path, length);
+ return do_sys_truncate(path, (loff_t)high << 32 | low);
}
-asmlinkage long sys_ftruncate64(unsigned int fd, loff_t length)
+asmlinkage long sys_ftruncate64(unsigned int fd, LOFF_T(high, low))
{
- return do_sys_ftruncate(fd, length);
+ return do_sys_ftruncate(fd, (loff_t)high << 32 | low);
}
+#undef LOFF_T
#endif
#if !(defined(__alpha__) || defined(__ia64__))
Index: include/asm-parisc/unistd.h
===================================================================
RCS file: /home/cvs/parisc/linux/include/asm-parisc/unistd.h,v
retrieving revision 1.20
diff -u -p -r1.20 unistd.h
--- unistd.h 2001/03/07 18:12:47 1.20
+++ unistd.h 2001/04/10 19:47:33
@@ -591,8 +591,8 @@
#define __NR_recv (__NR_Linux + 98)
#define __NR_statfs (__NR_Linux + 99)
#define __NR_fstatfs (__NR_Linux + 100)
-/* #define __NR_ioperm (__NR_Linux + 101) */
-#define __NR_socketcall (__NR_Linux + 102)
+#define __NR_stat64 (__NR_Linux + 101)
+/* #define __NR_socketcall (__NR_Linux + 102) */
#define __NR_syslog (__NR_Linux + 103)
#define __NR_setitimer (__NR_Linux + 104)
#define __NR_getitimer (__NR_Linux + 105)
@@ -602,7 +602,7 @@
#define __NR_pwrite (__NR_Linux + 109)
#define __NR_getcwd (__NR_Linux + 110)
#define __NR_vhangup (__NR_Linux + 111)
-/* #define __NR_idle (__NR_Linux + 112) */
+#define __NR_fstat64 (__NR_Linux + 112)
#define __NR_vfork (__NR_Linux + 113)
#define __NR_wait4 (__NR_Linux + 114)
#define __NR_swapoff (__NR_Linux + 115)
@@ -690,7 +690,13 @@
#define __NR_getpmsg (__NR_Linux + 196) /* some people actually want streams */
#define __NR_putpmsg (__NR_Linux + 197) /* some people actually want streams */
-#define __NR_Linux_syscalls 197
+#define __NR_lstat64 (__NR_Linux + 198)
+#define __NR_truncate64 (__NR_Linux + 199)
+#define __NR_ftruncate64 (__NR_Linux + 200)
+#define __NR_getdents64 (__NR_Linux + 201)
+#define __NR_fcntl64 (__NR_Linux + 202)
+
+#define __NR_Linux_syscalls 202
#define HPUX_GATEWAY_ADDR 0xC0000004
#define LINUX_GATEWAY_ADDR 0x100
--
Revolutions do not require corporate support.