@@ -226,9 +226,9 @@ SYSCALL_DEFINE2(fstat, unsigned int, fd, struct __old_kernel_stat __user *, stat
# define INIT_STRUCT_STAT_PADDING(st) memset(&st, 0, sizeof(st))
#endif
-static int cp_new_stat(struct kstat *stat, struct stat __user *statbuf)
+static int cp_new_stat(struct kstat *stat, struct __kernel_stat __user *statbuf)
{
- struct stat tmp;
+ struct __kernel_stat tmp;
if (!valid_dev(stat->dev) || !valid_dev(stat->rdev))
return -EOVERFLOW;
@@ -264,7 +264,7 @@ static int cp_new_stat(struct kstat *stat, struct stat __user *statbuf)
}
SYSCALL_DEFINE2(newstat, const char __user *, filename,
- struct stat __user *, statbuf)
+ struct __kernel_stat __user *, statbuf)
{
struct kstat stat;
int error = vfs_stat(filename, &stat);
@@ -275,7 +275,7 @@ SYSCALL_DEFINE2(newstat, const char __user *, filename,
}
SYSCALL_DEFINE2(newlstat, const char __user *, filename,
- struct stat __user *, statbuf)
+ struct __kernel_stat __user *, statbuf)
{
struct kstat stat;
int error;
@@ -289,7 +289,7 @@ SYSCALL_DEFINE2(newlstat, const char __user *, filename,
#if !defined(__ARCH_WANT_STAT64) || defined(__ARCH_WANT_SYS_NEWFSTATAT)
SYSCALL_DEFINE4(newfstatat, int, dfd, const char __user *, filename,
- struct stat __user *, statbuf, int, flag)
+ struct __kernel_stat __user *, statbuf, int, flag)
{
struct kstat stat;
int error;
@@ -301,7 +301,7 @@ SYSCALL_DEFINE4(newfstatat, int, dfd, const char __user *, filename,
}
#endif
-SYSCALL_DEFINE2(newfstat, unsigned int, fd, struct stat __user *, statbuf)
+SYSCALL_DEFINE2(newfstat, unsigned int, fd, struct __kernel_stat __user *, statbuf)
{
struct kstat stat;
int error = vfs_fstat(fd, &stat);
@@ -1,6 +1,9 @@
#ifndef _LINUX_STAT_H
#define _LINUX_STAT_H
+#ifndef CONFIG_COMPAT_TIME
+#define __kernel_stat stat
+#endif
#include <asm/stat.h>
#include <uapi/linux/stat.h>
This moves over the sys_new{stat,lstat,fstat,fstatat} system calls to use the newly introduced __kernel_stat. On all 64-bit architectures, the layout is the same as 'struct stat', so nothing changes. On 32-bit architectures, we use a trick to '#define __kernel_stat stat' as long as CONFIG_COMPAT_TIME is not set, and hide the new definitions from the kernel as long as this is the case, so the behavior does not change until we change over the architectures individually to use compat_sys_stat() in place of sys_stat() so we can reuse the sys_stat() implementation for the new structure. Signed-off-by: Arnd Bergmann <arnd@arndb.de> --- fs/stat.c | 12 ++++++------ include/linux/stat.h | 3 +++ 2 files changed, 9 insertions(+), 6 deletions(-)