Commit bda0e956 authored by Stephen Rothwell's avatar Stephen Rothwell Committed by Linus Torvalds

[PATCH] consolidate sys32_new[lf]stat - architecture independent

This renames more types and moves them into asm/compat.h and also
consolidates sys32_new{stat,fstat,lstat}.
parent f9a4660b
...@@ -15,6 +15,8 @@ obj-y := open.o read_write.o file_table.o buffer.o \ ...@@ -15,6 +15,8 @@ obj-y := open.o read_write.o file_table.o buffer.o \
filesystems.o namespace.o seq_file.o xattr.o libfs.o \ filesystems.o namespace.o seq_file.o xattr.o libfs.o \
fs-writeback.o mpage.o direct-io.o aio.o eventpoll.o fs-writeback.o mpage.o direct-io.o aio.o eventpoll.o
obj-$(CONFIG_COMPAT) += compat.o
ifneq ($(CONFIG_NFSD),n) ifneq ($(CONFIG_NFSD),n)
ifneq ($(CONFIG_NFSD),) ifneq ($(CONFIG_NFSD),)
obj-y += nfsctl.o obj-y += nfsctl.o
......
/*
* linux/fs/compat.c
*
* Kernel compatibililty routines for e.g. 32 bit syscall support
* on 64 bit kernels.
*
* Copyright (C) 2002 Stephen Rothwell, IBM Corporation
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License version 2 as
* published by the Free Software Foundation.
*/
#include <linux/linkage.h>
#include <linux/compat.h>
#include <linux/errno.h>
#include <linux/time.h>
#include <linux/fs.h>
#include <asm/uaccess.h>
/*
* Not all architectures have sys_utime, so implement this in terms
* of sys_utimes.
*/
asmlinkage long compat_sys_utime(char *filename, struct compat_utimbuf *t)
{
struct timeval tv[2];
if (t) {
if (get_user(tv[0].tv_sec, &t->actime) ||
get_user(tv[1].tv_sec, &t->modtime))
return -EFAULT;
tv[0].tv_usec = 0;
tv[1].tv_usec = 0;
}
return do_utimes(filename, t ? tv : NULL);
}
asmlinkage long compat_sys_newstat(char * filename,
struct compat_stat *statbuf)
{
struct kstat stat;
int error = vfs_stat(filename, &stat);
if (!error)
error = cp_compat_stat(&stat, statbuf);
return error;
}
asmlinkage long compat_sys_newlstat(char * filename,
struct compat_stat *statbuf)
{
struct kstat stat;
int error = vfs_lstat(filename, &stat);
if (!error)
error = cp_compat_stat(&stat, statbuf);
return error;
}
asmlinkage long compat_sys_newfstat(unsigned int fd,
struct compat_stat * statbuf)
{
struct kstat stat;
int error = vfs_fstat(fd, &stat);
if (!error)
error = cp_compat_stat(&stat, statbuf);
return error;
}
...@@ -8,6 +8,7 @@ ...@@ -8,6 +8,7 @@
#ifdef CONFIG_COMPAT #ifdef CONFIG_COMPAT
#include <linux/stat.h>
#include <asm/compat.h> #include <asm/compat.h>
#define compat_jiffies_to_clock_t(x) ((x) / (HZ / COMPAT_USER_HZ)) #define compat_jiffies_to_clock_t(x) ((x) / (HZ / COMPAT_USER_HZ))
...@@ -29,5 +30,7 @@ struct compat_tms { ...@@ -29,5 +30,7 @@ struct compat_tms {
compat_clock_t tms_cstime; compat_clock_t tms_cstime;
}; };
extern int cp_compat_stat(struct kstat *, struct compat_stat *);
#endif /* CONFIG_COMPAT */ #endif /* CONFIG_COMPAT */
#endif /* _LINUX_COMPAT_H */ #endif /* _LINUX_COMPAT_H */
...@@ -83,25 +83,6 @@ asmlinkage long compat_sys_nanosleep(struct compat_timespec *rqtp, ...@@ -83,25 +83,6 @@ asmlinkage long compat_sys_nanosleep(struct compat_timespec *rqtp,
return -ERESTART_RESTARTBLOCK; return -ERESTART_RESTARTBLOCK;
} }
/*
* Not all architectures have sys_utime, so implement this in terms
* of sys_utimes.
*/
asmlinkage long compat_sys_utime(char *filename, struct compat_utimbuf *t)
{
struct timeval tv[2];
if (t) {
if (get_user(tv[0].tv_sec, &t->actime) ||
get_user(tv[1].tv_sec, &t->modtime))
return -EFAULT;
tv[0].tv_usec = 0;
tv[1].tv_usec = 0;
}
return do_utimes(filename, t ? tv : NULL);
}
static inline long get_compat_itimerval(struct itimerval *o, static inline long get_compat_itimerval(struct itimerval *o,
struct compat_itimerval *i) struct compat_itimerval *i)
{ {
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment