Use the support routines from kern_syscalls.c instead of rolling our own code.

This commit is contained in:
dsl 2007-03-10 17:33:29 +00:00
parent 38f7168c16
commit 935d2b1c7f
3 changed files with 14 additions and 41 deletions

View File

@ -1,4 +1,4 @@
/* $NetBSD: vfs_syscalls_12.c,v 1.20 2007/02/09 21:55:16 ad Exp $ */
/* $NetBSD: vfs_syscalls_12.c,v 1.21 2007/03/10 17:33:29 dsl Exp $ */
/*
* Copyright (c) 1989, 1993
@ -37,7 +37,7 @@
*/
#include <sys/cdefs.h>
__KERNEL_RCSID(0, "$NetBSD: vfs_syscalls_12.c,v 1.20 2007/02/09 21:55:16 ad Exp $");
__KERNEL_RCSID(0, "$NetBSD: vfs_syscalls_12.c,v 1.21 2007/03/10 17:33:29 dsl Exp $");
#include <sys/param.h>
#include <sys/systm.h>
@ -52,6 +52,7 @@ __KERNEL_RCSID(0, "$NetBSD: vfs_syscalls_12.c,v 1.20 2007/02/09 21:55:16 ad Exp
#include <sys/proc.h>
#include <sys/uio.h>
#include <sys/dirent.h>
#include <sys/vfs_syscalls.h>
#include <sys/syscallargs.h>
@ -139,14 +140,8 @@ compat_12_sys_stat(struct lwp *l, void *v, register_t *retval)
struct stat sb;
struct stat12 osb;
int error;
struct nameidata nd;
NDINIT(&nd, LOOKUP, FOLLOW | LOCKLEAF, UIO_USERSPACE,
SCARG(uap, path), l);
if ((error = namei(&nd)) != 0)
return (error);
error = vn_stat(nd.ni_vp, &sb, l);
vput(nd.ni_vp);
error = do_sys_stat(l, SCARG(uap, path), FOLLOW, &sb);
if (error)
return (error);
cvtstat(&sb, &osb);
@ -169,14 +164,8 @@ compat_12_sys_lstat(struct lwp *l, void *v, register_t *retval)
struct stat sb;
struct stat12 osb;
int error;
struct nameidata nd;
NDINIT(&nd, LOOKUP, NOFOLLOW | LOCKLEAF, UIO_USERSPACE,
SCARG(uap, path), l);
if ((error = namei(&nd)) != 0)
return (error);
error = vn_stat(nd.ni_vp, &sb, l);
vput(nd.ni_vp);
error = do_sys_stat(l, SCARG(uap, path), NOFOLLOW, &sb);
if (error)
return (error);
cvtstat(&sb, &osb);

View File

@ -1,4 +1,4 @@
/* $NetBSD: vfs_syscalls_30.c,v 1.20 2007/03/04 06:01:13 christos Exp $ */
/* $NetBSD: vfs_syscalls_30.c,v 1.21 2007/03/10 17:33:29 dsl Exp $ */
/*-
* Copyright (c) 2005 The NetBSD Foundation, Inc.
@ -36,7 +36,7 @@
* POSSIBILITY OF SUCH DAMAGE.
*/
#include <sys/cdefs.h>
__KERNEL_RCSID(0, "$NetBSD: vfs_syscalls_30.c,v 1.20 2007/03/04 06:01:13 christos Exp $");
__KERNEL_RCSID(0, "$NetBSD: vfs_syscalls_30.c,v 1.21 2007/03/10 17:33:29 dsl Exp $");
#include <sys/param.h>
#include <sys/systm.h>
@ -53,6 +53,7 @@ __KERNEL_RCSID(0, "$NetBSD: vfs_syscalls_30.c,v 1.20 2007/03/04 06:01:13 christo
#include <sys/dirent.h>
#include <sys/malloc.h>
#include <sys/kauth.h>
#include <sys/vfs_syscalls.h>
#include <sys/syscallargs.h>
@ -102,14 +103,8 @@ compat_30_sys___stat13(struct lwp *l, void *v, register_t *retval)
struct stat sb;
struct stat13 osb;
int error;
struct nameidata nd;
NDINIT(&nd, LOOKUP, FOLLOW | LOCKLEAF, UIO_USERSPACE,
SCARG(uap, path), l);
if ((error = namei(&nd)) != 0)
return error;
error = vn_stat(nd.ni_vp, &sb, l);
vput(nd.ni_vp);
error = do_sys_stat(l, SCARG(uap, path), FOLLOW, &sb);
if (error)
return error;
cvtstat(&osb, &sb);
@ -132,14 +127,8 @@ compat_30_sys___lstat13(struct lwp *l, void *v, register_t *retval)
struct stat sb;
struct stat13 osb;
int error;
struct nameidata nd;
NDINIT(&nd, LOOKUP, NOFOLLOW | LOCKLEAF, UIO_USERSPACE,
SCARG(uap, path), l);
if ((error = namei(&nd)) != 0)
return error;
error = vn_stat(nd.ni_vp, &sb, l);
vput(nd.ni_vp);
error = do_sys_stat(l, SCARG(uap, path), NOFOLLOW, &sb);
if (error)
return error;
cvtstat(&osb, &sb);

View File

@ -1,4 +1,4 @@
/* $NetBSD: vfs_syscalls_43.c,v 1.36 2007/03/04 06:01:13 christos Exp $ */
/* $NetBSD: vfs_syscalls_43.c,v 1.37 2007/03/10 17:33:29 dsl Exp $ */
/*
* Copyright (c) 1989, 1993
@ -37,7 +37,7 @@
*/
#include <sys/cdefs.h>
__KERNEL_RCSID(0, "$NetBSD: vfs_syscalls_43.c,v 1.36 2007/03/04 06:01:13 christos Exp $");
__KERNEL_RCSID(0, "$NetBSD: vfs_syscalls_43.c,v 1.37 2007/03/10 17:33:29 dsl Exp $");
#if defined(_KERNEL_OPT)
#include "fs_union.h"
@ -65,6 +65,7 @@ __KERNEL_RCSID(0, "$NetBSD: vfs_syscalls_43.c,v 1.36 2007/03/04 06:01:13 christo
#include <sys/mount.h>
#include <sys/syscallargs.h>
#include <sys/vfs_syscalls.h>
#include <compat/sys/stat.h>
#include <compat/sys/mount.h>
@ -114,14 +115,8 @@ compat_43_sys_stat(struct lwp *l, void *v, register_t *retval)
struct stat sb;
struct stat43 osb;
int error;
struct nameidata nd;
NDINIT(&nd, LOOKUP, FOLLOW | LOCKLEAF, UIO_USERSPACE,
SCARG(uap, path), l);
if ((error = namei(&nd)) != 0)
return (error);
error = vn_stat(nd.ni_vp, &sb, l);
vput(nd.ni_vp);
error = do_sys_stat(l, SCARG(uap, path), FOLLOW, &sb);
if (error)
return (error);
cvtstat(&sb, &osb);