diff options
Diffstat (limited to 'sys/miscfs')
-rw-r--r-- | sys/miscfs/umapfs/umap.h | 7 | ||||
-rw-r--r-- | sys/miscfs/umapfs/umap_subr.c | 32 | ||||
-rw-r--r-- | sys/miscfs/umapfs/umap_vfsops.c | 33 | ||||
-rw-r--r-- | sys/miscfs/umapfs/umap_vnops.c | 144 |
4 files changed, 125 insertions, 91 deletions
diff --git a/sys/miscfs/umapfs/umap.h b/sys/miscfs/umapfs/umap.h index 52408df2254..8ce54854379 100644 --- a/sys/miscfs/umapfs/umap.h +++ b/sys/miscfs/umapfs/umap.h @@ -1,4 +1,4 @@ -/* $NetBSD: umap.h,v 1.5 1995/04/15 01:57:35 cgd Exp $ */ +/* $OpenBSD: umap.h,v 1.2 1996/02/26 07:20:03 mickey Exp $ */ /* * Copyright (c) 1992, 1993 @@ -87,6 +87,9 @@ extern struct vnode *umap_checkvp __P((struct vnode *vp, char *fil, int lno)); #define UMAPVPTOLOWERVP(vp) (VTOUMAP(vp)->umap_lowervp) #endif -extern int (**umap_vnodeop_p)(); +extern int (**umap_vnodeop_p) __P((void *)); extern struct vfsops umap_vfsops; + +int umapfs_init __P((void)); + #endif /* _KERNEL */ diff --git a/sys/miscfs/umapfs/umap_subr.c b/sys/miscfs/umapfs/umap_subr.c index edbec49cff3..68020176834 100644 --- a/sys/miscfs/umapfs/umap_subr.c +++ b/sys/miscfs/umapfs/umap_subr.c @@ -1,4 +1,4 @@ -/* $NetBSD: umap_subr.c,v 1.6 1995/06/01 22:44:34 jtc Exp $ */ +/* $OpenBSD: umap_subr.c,v 1.2 1996/02/26 07:20:07 mickey Exp $ */ /* * Copyright (c) 1992, 1993 @@ -66,9 +66,15 @@ LIST_HEAD(umap_node_hashhead, umap_node) *umap_node_hashtbl; u_long umap_node_hash; +static u_long umap_findid __P((u_long, u_long [][2], int)); +static struct vnode *umap_node_find __P((struct mount *, struct vnode *)); +static int umap_node_alloc __P((struct mount *, struct vnode *, + struct vnode **)); + /* * Initialise cache headers */ +int umapfs_init() { @@ -76,6 +82,7 @@ umapfs_init() printf("umapfs_init\n"); /* printed during system boot */ #endif umap_node_hashtbl = hashinit(NUMAPNODECACHE, M_CACHE, &umap_node_hash); + return 0; } /* @@ -191,9 +198,9 @@ umap_node_alloc(mp, lowervp, vpp) struct umap_node *xp; struct vnode *vp, *nvp; int error; - extern int (**dead_vnodeop_p)(); + extern int (**dead_vnodeop_p) __P((void *)); - if (error = getnewvnode(VT_UMAP, mp, umap_vnodeop_p, &vp)) + if ((error = getnewvnode(VT_UMAP, mp, umap_vnodeop_p, &vp)) != 0) return (error); vp->v_type = lowervp->v_type; @@ -213,7 +220,7 @@ umap_node_alloc(mp, lowervp, vpp) * check to see if someone else has beaten us to it. * (We could have slept in MALLOC.) */ - if (nvp = umap_node_find(lowervp)) { + if ((nvp = umap_node_find(mp, lowervp)) != NULL) { *vpp = nvp; /* free the substructures we've allocated. */ @@ -292,7 +299,7 @@ umap_node_create(mp, targetvp, newvpp) { struct vnode *aliasvp; - if (aliasvp = umap_node_find(mp, targetvp)) { + if ((aliasvp = umap_node_find(mp, targetvp)) != NULL) { /* * Take another reference to the alias vnode */ @@ -312,7 +319,7 @@ umap_node_create(mp, targetvp, newvpp) /* * Make new vnode reference the umap_node. */ - if (error = umap_node_alloc(mp, targetvp, &aliasvp)) + if ((error = umap_node_alloc(mp, targetvp, &aliasvp)) != 0) return (error); /* @@ -392,12 +399,12 @@ umap_mapids(v_mount, credp) int i, unentries, gnentries; uid_t uid; gid_t gid; - u_long *usermap, *groupmap; + u_long (*usermap)[2], (*groupmap)[2]; unentries = MOUNTTOUMAPMOUNT(v_mount)->info_nentries; - usermap = &(MOUNTTOUMAPMOUNT(v_mount)->info_mapdata[0][0]); + usermap = MOUNTTOUMAPMOUNT(v_mount)->info_mapdata; gnentries = MOUNTTOUMAPMOUNT(v_mount)->info_gnentries; - groupmap = &(MOUNTTOUMAPMOUNT(v_mount)->info_gmapdata[0][0]); + groupmap = MOUNTTOUMAPMOUNT(v_mount)->info_gmapdata; /* Find uid entry in map */ @@ -424,14 +431,13 @@ umap_mapids(v_mount, credp) /* Now we must map each of the set of groups in the cr_groups structure. */ - i = 0; - while (credp->cr_groups[i] != 0) { + for ( i = 0 ; credp->cr_groups[i] != 0 ; i++ ) { gid = (gid_t) umap_findid(credp->cr_groups[i], groupmap, gnentries); if (gid != -1) - credp->cr_groups[i++] = gid; + credp->cr_groups[i] = gid; else - credp->cr_groups[i++] = NULLGROUP; + credp->cr_groups[i] = NULLGROUP; } } diff --git a/sys/miscfs/umapfs/umap_vfsops.c b/sys/miscfs/umapfs/umap_vfsops.c index 09bae9ce8ec..90b49a962a6 100644 --- a/sys/miscfs/umapfs/umap_vfsops.c +++ b/sys/miscfs/umapfs/umap_vfsops.c @@ -1,4 +1,4 @@ -/* $NetBSD: umap_vfsops.c,v 1.8 1995/06/18 14:47:44 cgd Exp $ */ +/* $OpenBSD: umap_vfsops.c,v 1.2 1996/02/26 07:20:09 mickey Exp $ */ /* * Copyright (c) 1992, 1993 @@ -54,6 +54,20 @@ #include <sys/malloc.h> #include <miscfs/umapfs/umap.h> +int umapfs_mount __P((struct mount *, char *, caddr_t, + struct nameidata *, struct proc *)); +int umapfs_start __P((struct mount *, int, struct proc *)); +int umapfs_unmount __P((struct mount *, int, struct proc *)); +int umapfs_root __P((struct mount *, struct vnode **)); +int umapfs_quotactl __P((struct mount *, int, uid_t, caddr_t, + struct proc *)); +int umapfs_statfs __P((struct mount *, struct statfs *, struct proc *)); +int umapfs_sync __P((struct mount *, int, struct ucred *, struct proc *)); +int umapfs_vget __P((struct mount *, ino_t, struct vnode **)); +int umapfs_fhtovp __P((struct mount *, struct fid *, struct mbuf *, + struct vnode **, int *, struct ucred **)); +int umapfs_vptofh __P((struct vnode *, struct fid *)); + /* * Mount umap layer */ @@ -70,7 +84,7 @@ umapfs_mount(mp, path, data, ndp, p) struct vnode *umapm_rootvp; struct umap_mount *amp; size_t size; - int error; + int error,i; #ifdef UMAPFS_DIAGNOSTIC printf("umapfs_mount(mp = %x)\n", mp); @@ -135,7 +149,7 @@ umapfs_mount(mp, path, data, ndp, p) if (error) return (error); -#ifdef UMAP_DIAGNOSTIC +#ifdef UMAPFS_DIAGNOSTIC printf("umap_mount:nentries %d\n",args.nentries); for (i = 0; i < args.nentries; i++) printf(" %d maps to %d\n", amp->info_mapdata[i][0], @@ -147,7 +161,7 @@ umapfs_mount(mp, path, data, ndp, p) if (error) return (error); -#ifdef UMAP_DIAGNOSTIC +#ifdef UMAPFS_DIAGNOSTIC printf("umap_mount:gnentries %d\n",args.gnentries); for (i = 0; i < args.gnentries; i++) printf(" group %d maps to %d\n", @@ -211,7 +225,6 @@ umapfs_start(mp, flags, p) { return (0); - /* return (VFS_START(MOUNTTOUMAPMOUNT(mp)->umapm_vfs, flags, p)); */ } /* @@ -249,7 +262,7 @@ umapfs_unmount(mp, mntflags, p) if (mntinvalbuf(mp, 1)) return (EBUSY); #endif - if (umapm_rootvp->v_usecount > 1) + if (umapm_rootvp->v_usecount > 1 && !(flags & FORCECLOSE)) return (EBUSY); if (error = vflush(mp, umapm_rootvp, flags)) return (error); @@ -306,7 +319,7 @@ umapfs_quotactl(mp, cmd, uid, arg, p) struct proc *p; { - return (VFS_QUOTACTL(MOUNTTOUMAPMOUNT(mp)->umapm_vfs, cmd, uid, arg, p)); + return (EOPNOTSUPP); } int @@ -371,7 +384,7 @@ umapfs_vget(mp, ino, vpp) struct vnode **vpp; { - return (VFS_VGET(MOUNTTOUMAPMOUNT(mp)->umapm_vfs, ino, vpp)); + return (EOPNOTSUPP); } int @@ -383,7 +396,6 @@ umapfs_fhtovp(mp, fidp, nam, vpp, exflagsp, credanonp) int *exflagsp; struct ucred**credanonp; { - return (EOPNOTSUPP); } @@ -392,12 +404,9 @@ umapfs_vptofh(vp, fhp) struct vnode *vp; struct fid *fhp; { - return (EOPNOTSUPP); } -int umapfs_init __P((void)); - struct vfsops umap_vfsops = { MOUNT_UMAP, umapfs_mount, diff --git a/sys/miscfs/umapfs/umap_vnops.c b/sys/miscfs/umapfs/umap_vnops.c index 87d9a0d37c9..c2787d12138 100644 --- a/sys/miscfs/umapfs/umap_vnops.c +++ b/sys/miscfs/umapfs/umap_vnops.c @@ -1,4 +1,4 @@ -/* $NetBSD: umap_vnops.c,v 1.4 1995/04/15 01:57:39 cgd Exp $ */ +/* $OpenBSD: umap_vnops.c,v 1.2 1996/02/26 07:20:12 mickey Exp $ */ /* * Copyright (c) 1992, 1993 @@ -56,20 +56,55 @@ int umap_bug_bypass = 0; /* for debugging: enables bypass printf'ing */ +int umap_bypass __P((void *)); +int umap_getattr __P((void *)); +int umap_inactive __P((void *)); +int umap_reclaim __P((void *)); +int umap_print __P((void *)); +int umap_rename __P((void *)); +int umap_strategy __P((void *)); +int umap_bwrite __P((void *)); + +/* + * Global vfs data structures + */ +/* + * XXX - strategy, bwrite are hand coded currently. They should + * go away with a merged buffer/block cache. + * + */ +int (**umap_vnodeop_p) __P((void *)); +struct vnodeopv_entry_desc umap_vnodeop_entries[] = { + { &vop_default_desc, umap_bypass }, + + { &vop_getattr_desc, umap_getattr }, + { &vop_inactive_desc, umap_inactive }, + { &vop_reclaim_desc, umap_reclaim }, + { &vop_print_desc, umap_print }, + { &vop_rename_desc, umap_rename }, + + { &vop_strategy_desc, umap_strategy }, + { &vop_bwrite_desc, umap_bwrite }, + + { (struct vnodeop_desc*) NULL, (int(*) __P((void *))) NULL } +}; +struct vnodeopv_desc umap_vnodeop_opv_desc = + { &umap_vnodeop_p, umap_vnodeop_entries }; + /* * This is the 10-Apr-92 bypass routine. * See null_vnops.c:null_bypass for more details. */ int -umap_bypass(ap) +umap_bypass(v) + void *v; +{ struct vop_generic_args /* { struct vnodeop_desc *a_desc; <other random data follows, presumably> - } */ *ap; -{ - extern int (**umap_vnodeop_p)(); /* not extern, really "forward" */ + } */ *ap = v; struct ucred **credpp = 0, *credp = 0; - struct ucred *savecredp, *savecompcredp = 0; + struct ucred *savecredp = 0, *savecompcredp = 0; struct ucred *compcredp = 0; struct vnode **this_vp_p; int error; @@ -130,10 +165,9 @@ umap_bypass(ap) * Fix the credentials. (That's the purpose of this layer.) */ - if (descp->vdesc_cred_offset != VDESC_NO_OFFSET) { - - credpp = VOPARG_OFFSETTO(struct ucred**, - descp->vdesc_cred_offset, ap); + if (descp->vdesc_cred_offset != VDESC_NO_OFFSET + && *(credpp = VOPARG_OFFSETTO(struct ucred**, + descp->vdesc_cred_offset, ap)) != NOCRED ) { /* Save old values */ @@ -159,10 +193,9 @@ umap_bypass(ap) * for speed. If there is one, it better get mapped, too. */ - if (descp->vdesc_componentname_offset != VDESC_NO_OFFSET) { - - compnamepp = VOPARG_OFFSETTO(struct componentname**, - descp->vdesc_componentname_offset, ap); + if (descp->vdesc_componentname_offset != VDESC_NO_OFFSET + && (*(compnamepp = VOPARG_OFFSETTO(struct componentname**, + descp->vdesc_componentname_offset, ap)))->cn_cred != NOCRED ) { savecompcredp = (*compnamepp)->cn_cred; if (savecompcredp != NOCRED) @@ -223,7 +256,8 @@ umap_bypass(ap) /* * Free duplicate cred structure and restore old one. */ - if (descp->vdesc_cred_offset != VDESC_NO_OFFSET) { + if (descp->vdesc_cred_offset != VDESC_NO_OFFSET + && *credpp != NOCRED) { if (umap_bug_bypass && credp && credp->cr_uid != 0) printf("umap_bypass: returning-user was %d\n", credp->cr_uid); @@ -237,7 +271,8 @@ umap_bypass(ap) } } - if (descp->vdesc_componentname_offset != VDESC_NO_OFFSET) { + if (descp->vdesc_componentname_offset != VDESC_NO_OFFSET + && (*compnamepp)->cn_cred != NOCRED ) { if (umap_bug_bypass && compcredp && compcredp->cr_uid != 0) printf("umap_bypass: returning-component-user was %d\n", compcredp->cr_uid); @@ -259,14 +294,15 @@ umap_bypass(ap) * We handle getattr to change the fsid. */ int -umap_getattr(ap) +umap_getattr(v) + void *v; +{ struct vop_getattr_args /* { struct vnode *a_vp; struct vattr *a_vap; struct ucred *a_cred; struct proc *a_p; - } */ *ap; -{ + } */ *ap = v; uid_t uid; gid_t gid; int error, tmpid, nentries, gnentries; @@ -331,11 +367,10 @@ umap_getattr(ap) return (0); } +/*ARGSUSED*/ int -umap_inactive(ap) - struct vop_inactive_args /* { - struct vnode *a_vp; - } */ *ap; +umap_inactive(v) + void *v; { /* * Do nothing (and _don't_ bypass). @@ -348,11 +383,12 @@ umap_inactive(ap) } int -umap_reclaim(ap) +umap_reclaim(v) + void *v; +{ struct vop_reclaim_args /* { struct vnode *a_vp; - } */ *ap; -{ + } */ *ap = v; struct vnode *vp = ap->a_vp; struct umap_node *xp = VTOUMAP(vp); struct vnode *lowervp = xp->umap_lowervp; @@ -367,11 +403,12 @@ umap_reclaim(ap) } int -umap_strategy(ap) +umap_strategy(v) + void *v; +{ struct vop_strategy_args /* { struct buf *a_bp; - } */ *ap; -{ + } */ *ap = v; struct buf *bp = ap->a_bp; int error; struct vnode *savedvp; @@ -387,11 +424,12 @@ umap_strategy(ap) } int -umap_bwrite(ap) +umap_bwrite(v) + void *v; +{ struct vop_bwrite_args /* { struct buf *a_bp; - } */ *ap; -{ + } */ *ap = v; struct buf *bp = ap->a_bp; int error; struct vnode *savedvp; @@ -408,18 +446,22 @@ umap_bwrite(ap) int -umap_print(ap) +umap_print(v) + void *v; +{ struct vop_print_args /* { struct vnode *a_vp; - } */ *ap; -{ + } */ *ap = v; struct vnode *vp = ap->a_vp; - printf("\ttag VT_UMAPFS, vp=%x, lowervp=%x\n", vp, UMAPVPTOLOWERVP(vp)); + printf("\ttag VT_UMAPFS, vp=%x, lowervp=%x\n", + (unsigned int) vp, (unsigned int) UMAPVPTOLOWERVP(vp)); return (0); } int -umap_rename(ap) +umap_rename(v) + void *v; +{ struct vop_rename_args /* { struct vnode *a_fdvp; struct vnode *a_fvp; @@ -427,8 +469,7 @@ umap_rename(ap) struct vnode *a_tdvp; struct vnode *a_tvp; struct componentname *a_tcnp; - } */ *ap; -{ + } */ *ap = v; int error; struct componentname *compnamep; struct ucred *compcredp, *savecompcredp; @@ -469,28 +510,3 @@ umap_rename(ap) return error; } -/* - * Global vfs data structures - */ -/* - * XXX - strategy, bwrite are hand coded currently. They should - * go away with a merged buffer/block cache. - * - */ -int (**umap_vnodeop_p)(); -struct vnodeopv_entry_desc umap_vnodeop_entries[] = { - { &vop_default_desc, umap_bypass }, - - { &vop_getattr_desc, umap_getattr }, - { &vop_inactive_desc, umap_inactive }, - { &vop_reclaim_desc, umap_reclaim }, - { &vop_print_desc, umap_print }, - { &vop_rename_desc, umap_rename }, - - { &vop_strategy_desc, umap_strategy }, - { &vop_bwrite_desc, umap_bwrite }, - - { (struct vnodeop_desc*) NULL, (int(*)()) NULL } -}; -struct vnodeopv_desc umap_vnodeop_opv_desc = - { &umap_vnodeop_p, umap_vnodeop_entries }; |