tree 6730c36a12833eaf05ddddd7b26fc4de1284ff5b
parent 0b2cad2f30d0353f2576b1a2207c0792ba713157
author David S. Miller <[EMAIL PROTECTED]> Tue, 19 Apr 2005 05:13:15 -0700
committer Linus Torvalds <[EMAIL PROTECTED]> Tue, 19 Apr 2005 05:13:15 -0700
[PATCH] sparc64: Fix stat
Like Alpha, sparc64's struct stat was defined before we had the
nanosecond et al. fields added. So like Alpha I have to cons up a
struct stat64 to get this stuff. I'll work on the glibc bits soon.
Also, we were forgetting to fill in the nanosecond fields in the sparc
compat stat64 syscalls.
Signed-off-by: David S. Miller <[EMAIL PROTECTED]>
Signed-off-by: Linus Torvalds <[EMAIL PROTECTED]>
sparc64/kernel/sys_sparc32.c | 68 +++++++++++++++++++++++++++++++++++++++++--
sparc64/kernel/systbls.S | 12 +++----
asm-sparc/unistd.h | 6 +--
asm-sparc64/compat.h | 40 +++++++++++++++++++++++--
asm-sparc64/stat.h | 47 ++++++++++-------------------
asm-sparc64/unistd.h | 6 +--
6 files changed, 130 insertions(+), 49 deletions(-)
Index: arch/sparc64/kernel/sys_sparc32.c
===================================================================
--- 0d7f73fcc961111ddca915cc8f267ebb088a04c2/arch/sparc64/kernel/sys_sparc32.c
(mode:100644 sha1:567c91c77b20eb471812a9eaa1fb3e284613579b)
+++ 6730c36a12833eaf05ddddd7b26fc4de1284ff5b/arch/sparc64/kernel/sys_sparc32.c
(mode:100644 sha1:1d3aa588df8a5a8466113947ae3d3102c021c1e1)
@@ -352,11 +352,11 @@
err |= put_user(old_encode_dev(stat->rdev), &statbuf->st_rdev);
err |= put_user(stat->size, &statbuf->st_size);
err |= put_user(stat->atime.tv_sec, &statbuf->st_atime);
- err |= put_user(0, &statbuf->__unused1);
+ err |= put_user(stat->atime.tv_nsec, &statbuf->st_atime_nsec);
err |= put_user(stat->mtime.tv_sec, &statbuf->st_mtime);
- err |= put_user(0, &statbuf->__unused2);
+ err |= put_user(stat->mtime.tv_nsec, &statbuf->st_mtime_nsec);
err |= put_user(stat->ctime.tv_sec, &statbuf->st_ctime);
- err |= put_user(0, &statbuf->__unused3);
+ err |= put_user(stat->ctime.tv_nsec, &statbuf->st_ctime_nsec);
err |= put_user(stat->blksize, &statbuf->st_blksize);
err |= put_user(stat->blocks, &statbuf->st_blocks);
err |= put_user(0, &statbuf->__unused4[0]);
@@ -365,6 +365,68 @@
return err;
}
+int cp_compat_stat64(struct kstat *stat, struct compat_stat64 __user *statbuf)
+{
+ int err;
+
+ err = put_user(huge_encode_dev(stat->dev), &statbuf->st_dev);
+ err |= put_user(stat->ino, &statbuf->st_ino);
+ err |= put_user(stat->mode, &statbuf->st_mode);
+ err |= put_user(stat->nlink, &statbuf->st_nlink);
+ err |= put_user(stat->uid, &statbuf->st_uid);
+ err |= put_user(stat->gid, &statbuf->st_gid);
+ err |= put_user(huge_encode_dev(stat->rdev), &statbuf->st_rdev);
+ err |= put_user(0, (unsigned long __user *) &statbuf->__pad3[0]);
+ err |= put_user(stat->size, &statbuf->st_size);
+ err |= put_user(stat->blksize, &statbuf->st_blksize);
+ err |= put_user(0, (unsigned int __user *) &statbuf->__pad4[0]);
+ err |= put_user(0, (unsigned int __user *) &statbuf->__pad4[4]);
+ err |= put_user(stat->blocks, &statbuf->st_blocks);
+ err |= put_user(stat->atime.tv_sec, &statbuf->st_atime);
+ err |= put_user(stat->atime.tv_nsec, &statbuf->st_atime_nsec);
+ err |= put_user(stat->mtime.tv_sec, &statbuf->st_mtime);
+ err |= put_user(stat->mtime.tv_nsec, &statbuf->st_mtime_nsec);
+ err |= put_user(stat->ctime.tv_sec, &statbuf->st_ctime);
+ err |= put_user(stat->ctime.tv_nsec, &statbuf->st_ctime_nsec);
+ err |= put_user(0, &statbuf->__unused4);
+ err |= put_user(0, &statbuf->__unused5);
+
+ return err;
+}
+
+asmlinkage long compat_sys_stat64(char __user * filename,
+ struct compat_stat64 __user *statbuf)
+{
+ struct kstat stat;
+ int error = vfs_stat(filename, &stat);
+
+ if (!error)
+ error = cp_compat_stat64(&stat, statbuf);
+ return error;
+}
+
+asmlinkage long compat_sys_lstat64(char __user * filename,
+ struct compat_stat64 __user *statbuf)
+{
+ struct kstat stat;
+ int error = vfs_lstat(filename, &stat);
+
+ if (!error)
+ error = cp_compat_stat64(&stat, statbuf);
+ return error;
+}
+
+asmlinkage long compat_sys_fstat64(unsigned int fd,
+ struct compat_stat64 __user * statbuf)
+{
+ struct kstat stat;
+ int error = vfs_fstat(fd, &stat);
+
+ if (!error)
+ error = cp_compat_stat64(&stat, statbuf);
+ return error;
+}
+
asmlinkage long compat_sys_sysfs(int option, u32 arg1, u32 arg2)
{
return sys_sysfs(option, arg1, arg2);
Index: arch/sparc64/kernel/systbls.S
===================================================================
--- 0d7f73fcc961111ddca915cc8f267ebb088a04c2/arch/sparc64/kernel/systbls.S
(mode:100644 sha1:a4ccb65aece8db71038e2a6a6c93b53779090724)
+++ 6730c36a12833eaf05ddddd7b26fc4de1284ff5b/arch/sparc64/kernel/systbls.S
(mode:100644 sha1:a5e36a4c89247fcf56658d2b3be140fc51ede6a9)
@@ -32,7 +32,7 @@
.word sys32_umount, sys32_setgid16, sys32_getgid16, sys32_signal,
sys32_geteuid16
/*50*/ .word sys32_getegid16, sys_acct, sys_nis_syscall, sys_getgid,
compat_sys_ioctl
.word sys32_reboot, sys32_mmap2, sys_symlink, sys32_readlink,
sys32_execve
-/*60*/ .word sys32_umask, sys_chroot, compat_sys_newfstat, sys_fstat64,
sys_getpagesize
+/*60*/ .word sys32_umask, sys_chroot, compat_sys_newfstat, compat_sys_fstat64,
sys_getpagesize
.word sys32_msync, sys_vfork, sys32_pread64, sys32_pwrite64, sys_geteuid
/*70*/ .word sys_getegid, sys_mmap, sys_setreuid, sys_munmap, sys_mprotect
.word sys_madvise, sys_vhangup, sys32_truncate64, sys_mincore,
sys32_getgroups16
@@ -46,8 +46,8 @@
.word sys32_getgroups, sys32_gettimeofday, sys32_getrusage,
sys_nis_syscall, sys_getcwd
/*120*/ .word compat_sys_readv, compat_sys_writev, sys32_settimeofday,
sys32_fchown16, sys_fchmod
.word sys_nis_syscall, sys32_setreuid16, sys32_setregid16, sys_rename,
sys_truncate
-/*130*/ .word sys_ftruncate, sys_flock, sys_lstat64, sys_nis_syscall,
sys_nis_syscall
- .word sys_nis_syscall, sys32_mkdir, sys_rmdir, sys32_utimes, sys_stat64
+/*130*/ .word sys_ftruncate, sys_flock, compat_sys_lstat64,
sys_nis_syscall, sys_nis_syscall
+ .word sys_nis_syscall, sys32_mkdir, sys_rmdir, sys32_utimes,
compat_sys_stat64
/*140*/ .word sys32_sendfile64, sys_nis_syscall, sys32_futex,
sys_gettid, compat_sys_getrlimit
.word compat_sys_setrlimit, sys_pivot_root, sys32_prctl,
sys_pciconfig_read, sys_pciconfig_write
/*150*/ .word sys_nis_syscall, sys_nis_syscall, sys_nis_syscall,
sys_poll, sys_getdents64
@@ -98,7 +98,7 @@
.word sys_umount, sys_setgid, sys_getgid, sys_signal, sys_geteuid
/*50*/ .word sys_getegid, sys_acct, sys_memory_ordering, sys_nis_syscall,
sys_ioctl
.word sys_reboot, sys_nis_syscall, sys_symlink, sys_readlink, sys_execve
-/*60*/ .word sys_umask, sys_chroot, sys_newfstat, sys_nis_syscall,
sys_getpagesize
+/*60*/ .word sys_umask, sys_chroot, sys_newfstat, sys_stat64, sys_getpagesize
.word sys_msync, sys_vfork, sys_pread64, sys_pwrite64, sys_nis_syscall
/*70*/ .word sys_nis_syscall, sys_mmap, sys_nis_syscall, sys64_munmap,
sys_mprotect
.word sys_madvise, sys_vhangup, sys_nis_syscall, sys_mincore,
sys_getgroups
@@ -112,8 +112,8 @@
.word sys_nis_syscall, sys_gettimeofday, sys_getrusage, sys_getsockopt,
sys_getcwd
/*120*/ .word sys_readv, sys_writev, sys_settimeofday, sys_fchown,
sys_fchmod
.word sys_recvfrom, sys_setreuid, sys_setregid, sys_rename, sys_truncate
-/*130*/ .word sys_ftruncate, sys_flock, sys_nis_syscall, sys_sendto,
sys_shutdown
- .word sys_socketpair, sys_mkdir, sys_rmdir, sys_utimes, sys_nis_syscall
+/*130*/ .word sys_ftruncate, sys_flock, sys_lstat64, sys_sendto,
sys_shutdown
+ .word sys_socketpair, sys_mkdir, sys_rmdir, sys_utimes, sys_stat64
/*140*/ .word sys_sendfile64, sys_getpeername, sys_futex, sys_gettid,
sys_getrlimit
.word sys_setrlimit, sys_pivot_root, sys_prctl, sys_pciconfig_read,
sys_pciconfig_write
/*150*/ .word sys_getsockname, sys_nis_syscall, sys_nis_syscall,
sys_poll, sys_getdents64
Index: include/asm-sparc/unistd.h
===================================================================
--- 0d7f73fcc961111ddca915cc8f267ebb088a04c2/include/asm-sparc/unistd.h
(mode:100644 sha1:d1f63caaa326febc1d1b5b1b6f9ed5903218a010)
+++ 6730c36a12833eaf05ddddd7b26fc4de1284ff5b/include/asm-sparc/unistd.h
(mode:100644 sha1:846708403900fcba014a83a84f90b79f41e063e0)
@@ -79,7 +79,7 @@
#define __NR_umask 60 /* Common
*/
#define __NR_chroot 61 /* Common
*/
#define __NR_fstat 62 /* Common
*/
-#define __NR_fstat64 63 /* Linux sparc32 Specific
*/
+#define __NR_fstat64 63 /* Linux Specific
*/
#define __NR_getpagesize 64 /* Common
*/
#define __NR_msync 65 /* Common in newer 1.3.x revs...
*/
#define __NR_vfork 66 /* Common
*/
@@ -148,14 +148,14 @@
#define __NR_truncate 129 /* Common
*/
#define __NR_ftruncate 130 /* Common
*/
#define __NR_flock 131 /* Common
*/
-#define __NR_lstat64 132 /* Linux sparc32 Specific
*/
+#define __NR_lstat64 132 /* Linux Specific
*/
#define __NR_sendto 133 /* Common
*/
#define __NR_shutdown 134 /* Common
*/
#define __NR_socketpair 135 /* Common
*/
#define __NR_mkdir 136 /* Common
*/
#define __NR_rmdir 137 /* Common
*/
#define __NR_utimes 138 /* SunOS Specific
*/
-#define __NR_stat64 139 /* Linux sparc32 Specific
*/
+#define __NR_stat64 139 /* Linux Specific
*/
#define __NR_sendfile64 140 /* adjtime under SunOS
*/
#define __NR_getpeername 141 /* Common
*/
#define __NR_futex 142 /* gethostid under SunOS
*/
Index: include/asm-sparc64/compat.h
===================================================================
--- 0d7f73fcc961111ddca915cc8f267ebb088a04c2/include/asm-sparc64/compat.h
(mode:100644 sha1:2950279dd7767b8d8032bdf9e4363bb6d5379985)
+++ 6730c36a12833eaf05ddddd7b26fc4de1284ff5b/include/asm-sparc64/compat.h
(mode:100644 sha1:22f58055b8abb5cd412f89412a023e392cc615a8)
@@ -51,16 +51,50 @@
compat_dev_t st_rdev;
compat_off_t st_size;
compat_time_t st_atime;
- u32 __unused1;
+ compat_ulong_t st_atime_nsec;
compat_time_t st_mtime;
- u32 __unused2;
+ compat_ulong_t st_mtime_nsec;
compat_time_t st_ctime;
- u32 __unused3;
+ compat_ulong_t st_ctime_nsec;
compat_off_t st_blksize;
compat_off_t st_blocks;
u32 __unused4[2];
};
+struct compat_stat64 {
+ unsigned long long st_dev;
+
+ unsigned long long st_ino;
+
+ unsigned int st_mode;
+ unsigned int st_nlink;
+
+ unsigned int st_uid;
+ unsigned int st_gid;
+
+ unsigned long long st_rdev;
+
+ unsigned char __pad3[8];
+
+ long long st_size;
+ unsigned int st_blksize;
+
+ unsigned char __pad4[8];
+ unsigned int st_blocks;
+
+ unsigned int st_atime;
+ unsigned int st_atime_nsec;
+
+ unsigned int st_mtime;
+ unsigned int st_mtime_nsec;
+
+ unsigned int st_ctime;
+ unsigned int st_ctime_nsec;
+
+ unsigned int __unused4;
+ unsigned int __unused5;
+};
+
struct compat_flock {
short l_type;
short l_whence;
Index: include/asm-sparc64/stat.h
===================================================================
--- 0d7f73fcc961111ddca915cc8f267ebb088a04c2/include/asm-sparc64/stat.h
(mode:100644 sha1:48e06618a5a440112d768f2f054962c6bd172ba1)
+++ 6730c36a12833eaf05ddddd7b26fc4de1284ff5b/include/asm-sparc64/stat.h
(mode:100644 sha1:128c27e57f0b1d3782fd14a0fe38833a70e58b3f)
@@ -21,43 +21,28 @@
unsigned long __unused4[2];
};
-#ifdef __KERNEL__
-/* This is sparc32 stat64 structure. */
-
struct stat64 {
- unsigned long long st_dev;
-
- unsigned long long st_ino;
+ unsigned long st_dev;
+ unsigned long st_ino;
+ unsigned long st_nlink;
unsigned int st_mode;
- unsigned int st_nlink;
-
unsigned int st_uid;
unsigned int st_gid;
+ unsigned int __pad0;
- unsigned long long st_rdev;
-
- unsigned char __pad3[8];
-
- long long st_size;
- unsigned int st_blksize;
-
- unsigned char __pad4[8];
- unsigned int st_blocks;
-
- unsigned int st_atime;
- unsigned int st_atime_nsec;
-
- unsigned int st_mtime;
- unsigned int st_mtime_nsec;
-
- unsigned int st_ctime;
- unsigned int st_ctime_nsec;
-
- unsigned int __unused4;
- unsigned int __unused5;
+ unsigned long st_rdev;
+ long st_size;
+ long st_blksize;
+ long st_blocks;
+
+ unsigned long st_atime;
+ unsigned long st_atime_nsec;
+ unsigned long st_mtime;
+ unsigned long st_mtime_nsec;
+ unsigned long st_ctime;
+ unsigned long st_ctime_nsec;
+ long __unused[3];
};
#endif
-
-#endif
Index: include/asm-sparc64/unistd.h
===================================================================
--- 0d7f73fcc961111ddca915cc8f267ebb088a04c2/include/asm-sparc64/unistd.h
(mode:100644 sha1:3c00065eea80a512f5866c507f825f153c10e7ff)
+++ 6730c36a12833eaf05ddddd7b26fc4de1284ff5b/include/asm-sparc64/unistd.h
(mode:100644 sha1:5b8dcf5786a589f682b249f5fae43ee2086fd0d5)
@@ -79,7 +79,7 @@
#define __NR_umask 60 /* Common
*/
#define __NR_chroot 61 /* Common
*/
#define __NR_fstat 62 /* Common
*/
-/* #define __NR_fstat64 63 Linux sparc32 Specific
*/
+#define __NR_fstat64 63 /* Linux Specific
*/
#define __NR_getpagesize 64 /* Common
*/
#define __NR_msync 65 /* Common in newer 1.3.x revs...
*/
#define __NR_vfork 66 /* Common
*/
@@ -148,14 +148,14 @@
#define __NR_truncate 129 /* Common
*/
#define __NR_ftruncate 130 /* Common
*/
#define __NR_flock 131 /* Common
*/
-/* #define __NR_lstat64 132 Linux sparc32 Specific
*/
+#define __NR_lstat64 132 /* Linux Specific
*/
#define __NR_sendto 133 /* Common
*/
#define __NR_shutdown 134 /* Common
*/
#define __NR_socketpair 135 /* Common
*/
#define __NR_mkdir 136 /* Common
*/
#define __NR_rmdir 137 /* Common
*/
#define __NR_utimes 138 /* SunOS Specific
*/
-/* #define __NR_stat64 139 Linux sparc32 Specific
*/
+#define __NR_stat64 139 /* Linux Specific
*/
#define __NR_sendfile64 140 /* adjtime under SunOS
*/
#define __NR_getpeername 141 /* Common
*/
#define __NR_futex 142 /* gethostid under SunOS
*/
-
To unsubscribe from this list: send the line "unsubscribe bk-commits-head" in
the body of a message to [EMAIL PROTECTED]
More majordomo info at http://vger.kernel.org/majordomo-info.html