expose mkdir to in-kernel consumers
This commit is contained in:
parent
cdb510a7bb
commit
1a0b832e88
|
@ -1,4 +1,4 @@
|
||||||
/* $NetBSD: vfs_syscalls.c,v 1.395 2009/06/29 05:08:18 dholland Exp $ */
|
/* $NetBSD: vfs_syscalls.c,v 1.396 2009/07/02 12:53:47 pooka Exp $ */
|
||||||
|
|
||||||
/*-
|
/*-
|
||||||
* Copyright (c) 2008, 2009 The NetBSD Foundation, Inc.
|
* Copyright (c) 2008, 2009 The NetBSD Foundation, Inc.
|
||||||
|
@ -66,7 +66,7 @@
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#include <sys/cdefs.h>
|
#include <sys/cdefs.h>
|
||||||
__KERNEL_RCSID(0, "$NetBSD: vfs_syscalls.c,v 1.395 2009/06/29 05:08:18 dholland Exp $");
|
__KERNEL_RCSID(0, "$NetBSD: vfs_syscalls.c,v 1.396 2009/07/02 12:53:47 pooka Exp $");
|
||||||
|
|
||||||
#ifdef _KERNEL_OPT
|
#ifdef _KERNEL_OPT
|
||||||
#include "opt_fileassoc.h"
|
#include "opt_fileassoc.h"
|
||||||
|
@ -3444,14 +3444,21 @@ sys_mkdir(struct lwp *l, const struct sys_mkdir_args *uap, register_t *retval)
|
||||||
syscallarg(const char *) path;
|
syscallarg(const char *) path;
|
||||||
syscallarg(int) mode;
|
syscallarg(int) mode;
|
||||||
} */
|
} */
|
||||||
struct proc *p = l->l_proc;
|
|
||||||
|
return do_sys_mkdir(SCARG(uap, path), SCARG(uap, mode));
|
||||||
|
}
|
||||||
|
|
||||||
|
int
|
||||||
|
do_sys_mkdir(const char *path, mode_t mode)
|
||||||
|
{
|
||||||
|
struct proc *p = curlwp->l_proc;
|
||||||
struct vnode *vp;
|
struct vnode *vp;
|
||||||
struct vattr vattr;
|
struct vattr vattr;
|
||||||
int error;
|
int error;
|
||||||
struct nameidata nd;
|
struct nameidata nd;
|
||||||
|
|
||||||
NDINIT(&nd, CREATE, LOCKPARENT | CREATEDIR | TRYEMULROOT, UIO_USERSPACE,
|
NDINIT(&nd, CREATE, LOCKPARENT | CREATEDIR | TRYEMULROOT,
|
||||||
SCARG(uap, path));
|
UIO_USERSPACE, path);
|
||||||
if ((error = namei(&nd)) != 0)
|
if ((error = namei(&nd)) != 0)
|
||||||
return (error);
|
return (error);
|
||||||
vp = nd.ni_vp;
|
vp = nd.ni_vp;
|
||||||
|
@ -3467,8 +3474,7 @@ sys_mkdir(struct lwp *l, const struct sys_mkdir_args *uap, register_t *retval)
|
||||||
VATTR_NULL(&vattr);
|
VATTR_NULL(&vattr);
|
||||||
vattr.va_type = VDIR;
|
vattr.va_type = VDIR;
|
||||||
/* We will read cwdi->cwdi_cmask unlocked. */
|
/* We will read cwdi->cwdi_cmask unlocked. */
|
||||||
vattr.va_mode =
|
vattr.va_mode = (mode & ACCESSPERMS) &~ p->p_cwdi->cwdi_cmask;
|
||||||
(SCARG(uap, mode) & ACCESSPERMS) &~ p->p_cwdi->cwdi_cmask;
|
|
||||||
error = VOP_MKDIR(nd.ni_dvp, &nd.ni_vp, &nd.ni_cnd, &vattr);
|
error = VOP_MKDIR(nd.ni_dvp, &nd.ni_vp, &nd.ni_cnd, &vattr);
|
||||||
if (!error)
|
if (!error)
|
||||||
vput(nd.ni_vp);
|
vput(nd.ni_vp);
|
||||||
|
|
|
@ -1,8 +1,9 @@
|
||||||
/* $NetBSD: vfs_syscalls.h,v 1.9 2009/01/11 02:45:56 christos Exp $ */
|
/* $NetBSD: vfs_syscalls.h,v 1.10 2009/07/02 12:53:47 pooka Exp $ */
|
||||||
|
|
||||||
#ifndef _SYS_VFS_SYSCALLS_H_
|
#ifndef _SYS_VFS_SYSCALLS_H_
|
||||||
#define _SYS_VFS_SYSCALLS_H_
|
#define _SYS_VFS_SYSCALLS_H_
|
||||||
|
|
||||||
|
#include <sys/types.h>
|
||||||
#include <sys/fstypes.h>
|
#include <sys/fstypes.h>
|
||||||
|
|
||||||
struct stat;
|
struct stat;
|
||||||
|
@ -36,5 +37,6 @@ int dofhopen(struct lwp *, const void *, size_t, int, register_t *);
|
||||||
int do_sys_unlink(const char *, enum uio_seg);
|
int do_sys_unlink(const char *, enum uio_seg);
|
||||||
int do_sys_rename(const char *, const char *, enum uio_seg, int);
|
int do_sys_rename(const char *, const char *, enum uio_seg, int);
|
||||||
int do_sys_mknod(struct lwp *l, const char *, mode_t, dev_t, register_t *);
|
int do_sys_mknod(struct lwp *l, const char *, mode_t, dev_t, register_t *);
|
||||||
|
int do_sys_mkdir(const char *, mode_t);
|
||||||
|
|
||||||
#endif /* _SYS_VFS_SYSCALLS_H_ */
|
#endif /* _SYS_VFS_SYSCALLS_H_ */
|
||||||
|
|
Loading…
Reference in New Issue