Module Name: src Committed By: njoly Date: Wed Jun 3 15:13:26 UTC 2009
Modified Files: src/sys/compat/linux32/common: linux32_stat.c Log Message: Cleanup (no functional changes). Kill some unneeded variables and return stattement. Rename linux32_from_stat() to better bsd_to_linux32_stat64(). Fix some types. To generate a diff of this commit: cvs rdiff -u -r1.14 -r1.15 src/sys/compat/linux32/common/linux32_stat.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.
Modified files: Index: src/sys/compat/linux32/common/linux32_stat.c diff -u src/sys/compat/linux32/common/linux32_stat.c:1.14 src/sys/compat/linux32/common/linux32_stat.c:1.15 --- src/sys/compat/linux32/common/linux32_stat.c:1.14 Wed Jun 3 14:17:18 2009 +++ src/sys/compat/linux32/common/linux32_stat.c Wed Jun 3 15:13:26 2009 @@ -1,4 +1,4 @@ -/* $NetBSD: linux32_stat.c,v 1.14 2009/06/03 14:17:18 njoly Exp $ */ +/* $NetBSD: linux32_stat.c,v 1.15 2009/06/03 15:13:26 njoly Exp $ */ /*- * Copyright (c) 2006 Emmanuel Dreyfus, all rights reserved. @@ -33,7 +33,7 @@ #include <sys/cdefs.h> -__KERNEL_RCSID(0, "$NetBSD: linux32_stat.c,v 1.14 2009/06/03 14:17:18 njoly Exp $"); +__KERNEL_RCSID(0, "$NetBSD: linux32_stat.c,v 1.15 2009/06/03 15:13:26 njoly Exp $"); #include <sys/types.h> #include <sys/param.h> @@ -74,11 +74,12 @@ #include <compat/linux32/common/linux32_socketcall.h> #include <compat/linux32/linux32_syscallargs.h> -static inline void linux32_from_stat(struct stat *, struct linux32_stat64 *); +static inline void bsd_to_linux32_stat64(struct stat *, struct linux32_stat64 *); #define linux_fakedev(x,y) (x) + static inline void -linux32_from_stat(struct stat *st, struct linux32_stat64 *st32) +bsd_to_linux32_stat64(struct stat *st, struct linux32_stat64 *st32) { memset(st32, 0, sizeof(*st32)); st32->lst_dev = linux_fakedev(st->st_dev, 0); @@ -105,8 +106,6 @@ #ifdef LINUX32_STAT64_HAS_BROKEN_ST_INO st32->__lst_ino = st->st_ino; #endif - - return; } int @@ -114,23 +113,18 @@ { /* { syscallarg(netbsd32_charp) path; - syscallarg(linux32_statp) sp; + syscallarg(linux32_stat64p) sp; } */ int error; struct stat st; struct linux32_stat64 st32; - struct linux32_stat64 *st32p; - const char *path = SCARG_P32(uap, path); - error = do_sys_stat(path, FOLLOW, &st); + error = do_sys_stat(SCARG_P32(uap, path), FOLLOW, &st); if (error != 0) return error; - linux32_from_stat(&st, &st32); - - st32p = SCARG_P32(uap, sp); - - return copyout(&st32, st32p, sizeof(*st32p)); + bsd_to_linux32_stat64(&st, &st32); + return copyout(&st32, SCARG_P32(uap, sp), sizeof(st32)); } int @@ -143,18 +137,13 @@ int error; struct stat st; struct linux32_stat64 st32; - struct linux32_stat64 *st32p; - const char *path = SCARG_P32(uap, path); - error = do_sys_stat(path, NOFOLLOW, &st); + error = do_sys_stat(SCARG_P32(uap, path), NOFOLLOW, &st); if (error != 0) return error; - linux32_from_stat(&st, &st32); - - st32p = SCARG_P32(uap, sp); - - return copyout(&st32, st32p, sizeof(*st32p)); + bsd_to_linux32_stat64(&st, &st32); + return copyout(&st32, SCARG_P32(uap, sp), sizeof(st32)); } int @@ -167,15 +156,11 @@ int error; struct stat st; struct linux32_stat64 st32; - struct linux32_stat64 *st32p; error = do_sys_fstat(SCARG(uap, fd), &st); if (error != 0) return error; - linux32_from_stat(&st, &st32); - - st32p = SCARG_P32(uap, sp); - - return copyout(&st32, st32p, sizeof(*st32p)); + bsd_to_linux32_stat64(&st, &st32); + return copyout(&st32, SCARG_P32(uap, sp), sizeof(st32)); }