diff options
author | Michael Shalayeff <mickey@cvs.openbsd.org> | 1997-01-02 12:20:44 +0000 |
---|---|---|
committer | Michael Shalayeff <mickey@cvs.openbsd.org> | 1997-01-02 12:20:44 +0000 |
commit | 134b6f71c5753849936741021d4f62f7e3f4c93e (patch) | |
tree | 54d90227e9dd9d19ffd2d6a07c80e07ef239008a /sys/kern | |
parent | 13cf37ba87ea1676f902dcedac95e8b9fa901cb6 (diff) |
pulled out the duplicated, conditional code from both kern/vfs_syscalls.c
and compat/common/vfs_syscalls_43.c and placed a single copy of that code
into miscfs/union/union_subr.c (seemed like a good place to put it, since
it's union-fs related).
as a side effect you can build unionfs in lkm.
(netbsd pr#2950, Paul Goyette <paul@pgoyette.bdt.com>)
Diffstat (limited to 'sys/kern')
-rw-r--r-- | sys/kern/vfs_syscalls.c | 63 |
1 files changed, 18 insertions, 45 deletions
diff --git a/sys/kern/vfs_syscalls.c b/sys/kern/vfs_syscalls.c index 8598b025358..e377f948272 100644 --- a/sys/kern/vfs_syscalls.c +++ b/sys/kern/vfs_syscalls.c @@ -1,4 +1,4 @@ -/* $OpenBSD: vfs_syscalls.c,v 1.17 1996/10/27 08:02:32 tholo Exp $ */ +/* $OpenBSD: vfs_syscalls.c,v 1.18 1997/01/02 12:20:40 mickey Exp $ */ /* $NetBSD: vfs_syscalls.c,v 1.71 1996/04/23 10:29:02 mycroft Exp $ */ /* @@ -69,6 +69,17 @@ void checkdirs __P((struct vnode *)); int dounmount __P((struct mount *, int, struct proc *)); /* + * Redirection info so we don't have to include the union fs routines in + * the kernel directly. This way, we can build unionfs as an LKM. The + * pointer gets filled in later, when we modload the LKM, or when the + * compiled-in unionfs code gets initialized. For now, we just set + * it to a stub routine. + */ + +int (*union_check_p) __P((struct proc *, struct vnode **, + struct file *, struct uio, int *)) = NULL; + +/* * Virtual File System System Calls */ @@ -1992,7 +2003,7 @@ sys_getdirentries(p, v, retval) syscallarg(u_int) count; syscallarg(long *) basep; } */ *uap = v; - register struct vnode *vp; + struct vnode *vp; struct file *fp; struct uio auio; struct iovec aiov; @@ -2022,50 +2033,12 @@ unionread: VOP_UNLOCK(vp); if (error) return (error); - -#ifdef UNION -{ - extern int (**union_vnodeop_p) __P((void *)); - extern struct vnode *union_dircache __P((struct vnode *)); - if ((SCARG(uap, count) == auio.uio_resid) && - (vp->v_op == union_vnodeop_p)) { - struct vnode *lvp; - - lvp = union_dircache(vp); - if (lvp != NULLVP) { - struct vattr va; - - /* - * If the directory is opaque, - * then don't show lower entries - */ - error = VOP_GETATTR(vp, &va, fp->f_cred, p); - if (va.va_flags & OPAQUE) { - vput(lvp); - lvp = NULL; - } - } - - if (lvp != NULLVP) { - error = VOP_OPEN(lvp, FREAD, fp->f_cred, p); - VOP_UNLOCK(lvp); - - if (error) { - vrele(lvp); - return (error); - } - fp->f_data = (caddr_t) lvp; - fp->f_offset = 0; - error = vn_close(vp, FREAD, fp->f_cred, p); - if (error) - return (error); - vp = lvp; - goto unionread; - } - } -} -#endif /* UNION */ + union_check_p && + (union_check_p(p, &vp, fp, auio, &error) != 0)) + goto unionread; + if (error) + return (error); if ((SCARG(uap, count) == auio.uio_resid) && (vp->v_flag & VROOT) && |