From patchwork Wed May 6 16:30:17 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Arnd Bergmann X-Patchwork-Id: 6579 Received: (qmail 70720 invoked by alias); 6 May 2015 16:30:45 -0000 Mailing-List: contact libc-alpha-help@sourceware.org; run by ezmlm Precedence: bulk List-Id: List-Unsubscribe: List-Subscribe: List-Archive: List-Post: List-Help: , Sender: libc-alpha-owner@sourceware.org Delivered-To: mailing list libc-alpha@sourceware.org Received: (qmail 70657 invoked by uid 89); 6 May 2015 16:30:45 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-1.2 required=5.0 tests=AWL, BAYES_00, KAM_LAZY_DOMAIN_SECURITY, RCVD_IN_DNSWL_NONE autolearn=no version=3.3.2 X-HELO: mout.kundenserver.de From: Arnd Bergmann To: y2038@lists.linaro.org Cc: baolin.wang@linaro.org, tglx@linutronix.de, albert.aribaud@3adev.fr, john.stultz@linaro.org, bamvor.zhangjian@linaro.org, ruchandani.tina@gmail.com, linux-api@vger.kernel.org, linux-kernel@vger.kernel.org, libc-alpha@sourceware.org, Arnd Bergmann Subject: [PATCH 10/19] y2038: use __kernel_stat for sys_newstat syscalls Date: Wed, 6 May 2015 18:30:17 +0200 Message-Id: <1430929826-318934-11-git-send-email-arnd@arndb.de> In-Reply-To: <1430929826-318934-1-git-send-email-arnd@arndb.de> References: <1430929826-318934-1-git-send-email-arnd@arndb.de> X-UI-Out-Filterresults: notjunk:1; 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 --- fs/stat.c | 12 ++++++------ include/linux/stat.h | 3 +++ 2 files changed, 9 insertions(+), 6 deletions(-) diff --git a/fs/stat.c b/fs/stat.c index cccc1aab9a8b..12efbdd258fc 100644 --- a/fs/stat.c +++ b/fs/stat.c @@ -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); diff --git a/include/linux/stat.h b/include/linux/stat.h index 075cb0c7eb2a..9efc32774e98 100644 --- a/include/linux/stat.h +++ b/include/linux/stat.h @@ -1,6 +1,9 @@ #ifndef _LINUX_STAT_H #define _LINUX_STAT_H +#ifndef CONFIG_COMPAT_TIME +#define __kernel_stat stat +#endif #include #include