aboutsummaryrefslogtreecommitdiffstats
path: root/arch/sparc64/kernel/sys_sparc32.c
diff options
context:
space:
mode:
Diffstat (limited to 'arch/sparc64/kernel/sys_sparc32.c')
-rw-r--r--arch/sparc64/kernel/sys_sparc32.c68
1 files changed, 65 insertions, 3 deletions
diff --git a/arch/sparc64/kernel/sys_sparc32.c b/arch/sparc64/kernel/sys_sparc32.c
index 567c91c77b20..1d3aa588df8a 100644
--- a/arch/sparc64/kernel/sys_sparc32.c
+++ b/arch/sparc64/kernel/sys_sparc32.c
@@ -352,11 +352,11 @@ int cp_compat_stat(struct kstat *stat, struct compat_stat __user *statbuf)
352 err |= put_user(old_encode_dev(stat->rdev), &statbuf->st_rdev); 352 err |= put_user(old_encode_dev(stat->rdev), &statbuf->st_rdev);
353 err |= put_user(stat->size, &statbuf->st_size); 353 err |= put_user(stat->size, &statbuf->st_size);
354 err |= put_user(stat->atime.tv_sec, &statbuf->st_atime); 354 err |= put_user(stat->atime.tv_sec, &statbuf->st_atime);
355 err |= put_user(0, &statbuf->__unused1); 355 err |= put_user(stat->atime.tv_nsec, &statbuf->st_atime_nsec);
356 err |= put_user(stat->mtime.tv_sec, &statbuf->st_mtime); 356 err |= put_user(stat->mtime.tv_sec, &statbuf->st_mtime);
357 err |= put_user(0, &statbuf->__unused2); 357 err |= put_user(stat->mtime.tv_nsec, &statbuf->st_mtime_nsec);
358 err |= put_user(stat->ctime.tv_sec, &statbuf->st_ctime); 358 err |= put_user(stat->ctime.tv_sec, &statbuf->st_ctime);
359 err |= put_user(0, &statbuf->__unused3); 359 err |= put_user(stat->ctime.tv_nsec, &statbuf->st_ctime_nsec);
360 err |= put_user(stat->blksize, &statbuf->st_blksize); 360 err |= put_user(stat->blksize, &statbuf->st_blksize);
361 err |= put_user(stat->blocks, &statbuf->st_blocks); 361 err |= put_user(stat->blocks, &statbuf->st_blocks);
362 err |= put_user(0, &statbuf->__unused4[0]); 362 err |= put_user(0, &statbuf->__unused4[0]);
@@ -365,6 +365,68 @@ int cp_compat_stat(struct kstat *stat, struct compat_stat __user *statbuf)
365 return err; 365 return err;
366} 366}
367 367
368int cp_compat_stat64(struct kstat *stat, struct compat_stat64 __user *statbuf)
369{
370 int err;
371
372 err = put_user(huge_encode_dev(stat->dev), &statbuf->st_dev);
373 err |= put_user(stat->ino, &statbuf->st_ino);
374 err |= put_user(stat->mode, &statbuf->st_mode);
375 err |= put_user(stat->nlink, &statbuf->st_nlink);
376 err |= put_user(stat->uid, &statbuf->st_uid);
377 err |= put_user(stat->gid, &statbuf->st_gid);
378 err |= put_user(huge_encode_dev(stat->rdev), &statbuf->st_rdev);
379 err |= put_user(0, (unsigned long __user *) &statbuf->__pad3[0]);
380 err |= put_user(stat->size, &statbuf->st_size);
381 err |= put_user(stat->blksize, &statbuf->st_blksize);
382 err |= put_user(0, (unsigned int __user *) &statbuf->__pad4[0]);
383 err |= put_user(0, (unsigned int __user *) &statbuf->__pad4[4]);
384 err |= put_user(stat->blocks, &statbuf->st_blocks);
385 err |= put_user(stat->atime.tv_sec, &statbuf->st_atime);
386 err |= put_user(stat->atime.tv_nsec, &statbuf->st_atime_nsec);
387 err |= put_user(stat->mtime.tv_sec, &statbuf->st_mtime);
388 err |= put_user(stat->mtime.tv_nsec, &statbuf->st_mtime_nsec);
389 err |= put_user(stat->ctime.tv_sec, &statbuf->st_ctime);
390 err |= put_user(stat->ctime.tv_nsec, &statbuf->st_ctime_nsec);
391 err |= put_user(0, &statbuf->__unused4);
392 err |= put_user(0, &statbuf->__unused5);
393
394 return err;
395}
396
397asmlinkage long compat_sys_stat64(char __user * filename,
398 struct compat_stat64 __user *statbuf)
399{
400 struct kstat stat;
401 int error = vfs_stat(filename, &stat);
402
403 if (!error)
404 error = cp_compat_stat64(&stat, statbuf);
405 return error;
406}
407
408asmlinkage long compat_sys_lstat64(char __user * filename,
409 struct compat_stat64 __user *statbuf)
410{
411 struct kstat stat;
412 int error = vfs_lstat(filename, &stat);
413
414 if (!error)
415 error = cp_compat_stat64(&stat, statbuf);
416 return error;
417}
418
419asmlinkage long compat_sys_fstat64(unsigned int fd,
420 struct compat_stat64 __user * statbuf)
421{
422 struct kstat stat;
423 int error = vfs_fstat(fd, &stat);
424
425 if (!error)
426 error = cp_compat_stat64(&stat, statbuf);
427 return error;
428}
429
368asmlinkage long compat_sys_sysfs(int option, u32 arg1, u32 arg2) 430asmlinkage long compat_sys_sysfs(int option, u32 arg1, u32 arg2)
369{ 431{
370 return sys_sysfs(option, arg1, arg2); 432 return sys_sysfs(option, arg1, arg2);