From 935d2b1c7fbb68ebb1f955a60d7f5be1e967eb43 Mon Sep 17 00:00:00 2001 From: dsl Date: Sat, 10 Mar 2007 17:33:29 +0000 Subject: [PATCH] Use the support routines from kern_syscalls.c instead of rolling our own code. --- sys/compat/common/vfs_syscalls_12.c | 21 +++++---------------- sys/compat/common/vfs_syscalls_30.c | 21 +++++---------------- sys/compat/common/vfs_syscalls_43.c | 13 ++++--------- 3 files changed, 14 insertions(+), 41 deletions(-) diff --git a/sys/compat/common/vfs_syscalls_12.c b/sys/compat/common/vfs_syscalls_12.c index e9d57689dbf4..0f2fdbadf476 100644 --- a/sys/compat/common/vfs_syscalls_12.c +++ b/sys/compat/common/vfs_syscalls_12.c @@ -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 -__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 #include @@ -52,6 +52,7 @@ __KERNEL_RCSID(0, "$NetBSD: vfs_syscalls_12.c,v 1.20 2007/02/09 21:55:16 ad Exp #include #include #include +#include #include @@ -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); diff --git a/sys/compat/common/vfs_syscalls_30.c b/sys/compat/common/vfs_syscalls_30.c index 0010613faa89..3ca3c7c4d7c5 100644 --- a/sys/compat/common/vfs_syscalls_30.c +++ b/sys/compat/common/vfs_syscalls_30.c @@ -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 -__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 #include @@ -53,6 +53,7 @@ __KERNEL_RCSID(0, "$NetBSD: vfs_syscalls_30.c,v 1.20 2007/03/04 06:01:13 christo #include #include #include +#include #include @@ -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); diff --git a/sys/compat/common/vfs_syscalls_43.c b/sys/compat/common/vfs_syscalls_43.c index c2c42f107557..f7d76f6220a7 100644 --- a/sys/compat/common/vfs_syscalls_43.c +++ b/sys/compat/common/vfs_syscalls_43.c @@ -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 -__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 #include +#include #include #include @@ -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);