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/parisc/kernel/sys_parisc32.c | |
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/parisc/kernel/sys_parisc32.c')
-rw-r--r-- | arch/parisc/kernel/sys_parisc32.c | 47 |
1 files changed, 0 insertions, 47 deletions
diff --git a/arch/parisc/kernel/sys_parisc32.c b/arch/parisc/kernel/sys_parisc32.c index 71efd6a28e2a..2c3af17e049c 100644 --- a/arch/parisc/kernel/sys_parisc32.c +++ b/arch/parisc/kernel/sys_parisc32.c | |||
@@ -237,53 +237,6 @@ int sys32_settimeofday(struct compat_timeval __user *tv, struct timezone __user | |||
237 | return do_sys_settimeofday(tv ? &kts : NULL, tz ? &ktz : NULL); | 237 | return do_sys_settimeofday(tv ? &kts : NULL, tz ? &ktz : NULL); |
238 | } | 238 | } |
239 | 239 | ||
240 | int cp_compat_stat(struct kstat *stat, struct compat_stat __user *statbuf) | ||
241 | { | ||
242 | compat_ino_t ino; | ||
243 | int err; | ||
244 | |||
245 | if (stat->size > MAX_NON_LFS || !new_valid_dev(stat->dev) || | ||
246 | !new_valid_dev(stat->rdev)) | ||
247 | return -EOVERFLOW; | ||
248 | |||
249 | ino = stat->ino; | ||
250 | if (sizeof(ino) < sizeof(stat->ino) && ino != stat->ino) | ||
251 | return -EOVERFLOW; | ||
252 | |||
253 | err = put_user(new_encode_dev(stat->dev), &statbuf->st_dev); | ||
254 | err |= put_user(ino, &statbuf->st_ino); | ||
255 | err |= put_user(stat->mode, &statbuf->st_mode); | ||
256 | err |= put_user(stat->nlink, &statbuf->st_nlink); | ||
257 | err |= put_user(0, &statbuf->st_reserved1); | ||
258 | err |= put_user(0, &statbuf->st_reserved2); | ||
259 | err |= put_user(new_encode_dev(stat->rdev), &statbuf->st_rdev); | ||
260 | err |= put_user(stat->size, &statbuf->st_size); | ||
261 | err |= put_user(stat->atime.tv_sec, &statbuf->st_atime); | ||
262 | err |= put_user(stat->atime.tv_nsec, &statbuf->st_atime_nsec); | ||
263 | err |= put_user(stat->mtime.tv_sec, &statbuf->st_mtime); | ||
264 | err |= put_user(stat->mtime.tv_nsec, &statbuf->st_mtime_nsec); | ||
265 | err |= put_user(stat->ctime.tv_sec, &statbuf->st_ctime); | ||
266 | err |= put_user(stat->ctime.tv_nsec, &statbuf->st_ctime_nsec); | ||
267 | err |= put_user(stat->blksize, &statbuf->st_blksize); | ||
268 | err |= put_user(stat->blocks, &statbuf->st_blocks); | ||
269 | err |= put_user(0, &statbuf->__unused1); | ||
270 | err |= put_user(0, &statbuf->__unused2); | ||
271 | err |= put_user(0, &statbuf->__unused3); | ||
272 | err |= put_user(0, &statbuf->__unused4); | ||
273 | err |= put_user(0, &statbuf->__unused5); | ||
274 | err |= put_user(0, &statbuf->st_fstype); /* not avail */ | ||
275 | err |= put_user(0, &statbuf->st_realdev); /* not avail */ | ||
276 | err |= put_user(0, &statbuf->st_basemode); /* not avail */ | ||
277 | err |= put_user(0, &statbuf->st_spareshort); | ||
278 | err |= put_user(stat->uid, &statbuf->st_uid); | ||
279 | err |= put_user(stat->gid, &statbuf->st_gid); | ||
280 | err |= put_user(0, &statbuf->st_spare4[0]); | ||
281 | err |= put_user(0, &statbuf->st_spare4[1]); | ||
282 | err |= put_user(0, &statbuf->st_spare4[2]); | ||
283 | |||
284 | return err; | ||
285 | } | ||
286 | |||
287 | /*** copied from mips64 ***/ | 240 | /*** copied from mips64 ***/ |
288 | /* | 241 | /* |
289 | * Ooo, nasty. We need here to frob 32-bit unsigned longs to | 242 | * Ooo, nasty. We need here to frob 32-bit unsigned longs to |