diff options
author | Christoph Hellwig <hch@lst.de> | 2008-10-16 01:02:05 -0400 |
---|---|---|
committer | Linus Torvalds <torvalds@linux-foundation.org> | 2008-10-16 14:21:33 -0400 |
commit | f7a5000f7a8924e9c5fad1801616601d6dc65a17 (patch) | |
tree | 82bd7f554378b26fe23707a3755359787b252574 /arch/x86/ia32 | |
parent | f7ad160b49c49dc9cd383b9184c6fa4a9b4f7ebb (diff) |
compat: move cp_compat_stat to common code
struct stat / compat_stat is the same on all architectures, so
cp_compat_stat should be, too.
Turns out it is, except that various architectures have slightly and some
high2lowuid/high2lowgid or the direct assignment instead of the
SET_UID/SET_GID that expands to the correct one anyway.
This patch replaces the arch-specific cp_compat_stat implementations with
a common one based on the x86-64 one.
Signed-off-by: Christoph Hellwig <hch@lst.de>
Acked-by: David S. Miller <davem@davemloft.net> [ sparc bits ]
Acked-by: Kyle McMartin <kyle@mcmartin.ca> [ parisc bits ]
Cc: <linux-arch@vger.kernel.org>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Diffstat (limited to 'arch/x86/ia32')
-rw-r--r-- | arch/x86/ia32/sys_ia32.c | 35 |
1 files changed, 0 insertions, 35 deletions
diff --git a/arch/x86/ia32/sys_ia32.c b/arch/x86/ia32/sys_ia32.c index beda4232ce69..4d3ad8d78a4d 100644 --- a/arch/x86/ia32/sys_ia32.c +++ b/arch/x86/ia32/sys_ia32.c | |||
@@ -49,41 +49,6 @@ | |||
49 | 49 | ||
50 | #define AA(__x) ((unsigned long)(__x)) | 50 | #define AA(__x) ((unsigned long)(__x)) |
51 | 51 | ||
52 | int cp_compat_stat(struct kstat *kbuf, struct compat_stat __user *ubuf) | ||
53 | { | ||
54 | compat_ino_t ino; | ||
55 | |||
56 | typeof(ubuf->st_uid) uid = 0; | ||
57 | typeof(ubuf->st_gid) gid = 0; | ||
58 | SET_UID(uid, kbuf->uid); | ||
59 | SET_GID(gid, kbuf->gid); | ||
60 | if (!old_valid_dev(kbuf->dev) || !old_valid_dev(kbuf->rdev)) | ||
61 | return -EOVERFLOW; | ||
62 | if (kbuf->size >= 0x7fffffff) | ||
63 | return -EOVERFLOW; | ||
64 | ino = kbuf->ino; | ||
65 | if (sizeof(ino) < sizeof(kbuf->ino) && ino != kbuf->ino) | ||
66 | return -EOVERFLOW; | ||
67 | if (!access_ok(VERIFY_WRITE, ubuf, sizeof(struct compat_stat)) || | ||
68 | __put_user(old_encode_dev(kbuf->dev), &ubuf->st_dev) || | ||
69 | __put_user(ino, &ubuf->st_ino) || | ||
70 | __put_user(kbuf->mode, &ubuf->st_mode) || | ||
71 | __put_user(kbuf->nlink, &ubuf->st_nlink) || | ||
72 | __put_user(uid, &ubuf->st_uid) || | ||
73 | __put_user(gid, &ubuf->st_gid) || | ||
74 | __put_user(old_encode_dev(kbuf->rdev), &ubuf->st_rdev) || | ||
75 | __put_user(kbuf->size, &ubuf->st_size) || | ||
76 | __put_user(kbuf->atime.tv_sec, &ubuf->st_atime) || | ||
77 | __put_user(kbuf->atime.tv_nsec, &ubuf->st_atime_nsec) || | ||
78 | __put_user(kbuf->mtime.tv_sec, &ubuf->st_mtime) || | ||
79 | __put_user(kbuf->mtime.tv_nsec, &ubuf->st_mtime_nsec) || | ||
80 | __put_user(kbuf->ctime.tv_sec, &ubuf->st_ctime) || | ||
81 | __put_user(kbuf->ctime.tv_nsec, &ubuf->st_ctime_nsec) || | ||
82 | __put_user(kbuf->blksize, &ubuf->st_blksize) || | ||
83 | __put_user(kbuf->blocks, &ubuf->st_blocks)) | ||
84 | return -EFAULT; | ||
85 | return 0; | ||
86 | } | ||
87 | 52 | ||
88 | asmlinkage long sys32_truncate64(char __user *filename, | 53 | asmlinkage long sys32_truncate64(char __user *filename, |
89 | unsigned long offset_low, | 54 | unsigned long offset_low, |