Modify vfsops to seperate vfs_fhtovp() into two routines. vfs_fhtovp() now

only handles the file handle to vnode conversion, and a new call,
vfs_checkexp(), performs the export verification.
This commit is contained in:
wrstuden 1999-02-26 23:44:43 +00:00
parent 0078fc50dc
commit 862a56e88b
28 changed files with 331 additions and 211 deletions

View File

@ -1,4 +1,4 @@
/* $NetBSD: advfsops.c,v 1.34 1999/02/11 09:49:46 bouyer Exp $ */
/* $NetBSD: advfsops.c,v 1.35 1999/02/26 23:44:43 wrstuden Exp $ */
/*
* Copyright (c) 1994 Christian E. Hopps
@ -62,8 +62,9 @@ int adosfs_quotactl __P((struct mount *, int, uid_t, caddr_t, struct proc *));
int adosfs_statfs __P((struct mount *, struct statfs *, struct proc *));
int adosfs_sync __P((struct mount *, int, struct ucred *, struct proc *));
int adosfs_vget __P((struct mount *, ino_t, struct vnode **));
int adosfs_fhtovp __P((struct mount *, struct fid *, struct mbuf *,
struct vnode **, int *, struct ucred **));
int adosfs_fhtovp __P((struct mount *, struct fid *, struct vnode **));
int adosfs_checkexp __P((struct mount *, struct mbuf *, int *,
struct ucred **));
int adosfs_vptofh __P((struct vnode *, struct fid *));
int adosfs_mountfs __P((struct vnode *, struct mount *, struct proc *));
@ -675,20 +676,15 @@ struct ifid {
};
int
adosfs_fhtovp(mp, fhp, nam, vpp, exflagsp, credanonp)
adosfs_fhtovp(mp, fhp, vpp)
struct mount *mp;
struct fid *fhp;
struct mbuf *nam;
struct vnode **vpp;
int *exflagsp;
struct ucred **credanonp;
{
struct ifid *ifhp = (struct ifid *)fhp;
struct adosfsmount *amp = VFSTOADOSFS(mp);
#if 0
struct anode *ap;
#endif
struct netcred *np;
struct vnode *nvp;
int error;
@ -696,13 +692,6 @@ adosfs_fhtovp(mp, fhp, nam, vpp, exflagsp, credanonp)
printf("adfhtovp(%x, %x, %x)\n", mp, fhp, vpp);
#endif
/*
* Get the export permission structure for this <mp, client> tuple.
*/
np = vfs_export_lookup(mp, &amp->export, nam);
if (np == NULL)
return (EACCES);
if ((error = VFS_VGET(mp, ifhp->ifid_ino, &nvp)) != 0) {
*vpp = NULLVP;
return (error);
@ -716,6 +705,33 @@ adosfs_fhtovp(mp, fhp, nam, vpp, exflagsp, credanonp)
}
#endif
*vpp = nvp;
return(0);
}
int
adosfs_checkexp(mp, nam, exflagsp, credanonp)
struct mount *mp;
struct mbuf *nam;
int *exflagsp;
struct ucred **credanonp;
{
struct adosfsmount *amp = VFSTOADOSFS(mp);
#if 0
struct anode *ap;
#endif
struct netcred *np;
#ifdef ADOSFS_DIAGNOSTIC
printf("adcheckexp(%x, %x, %x)\n", mp, nam, exflagsp);
#endif
/*
* Get the export permission structure for this <mp, client> tuple.
*/
np = vfs_export_lookup(mp, &amp->export, nam);
if (np == NULL)
return (EACCES);
*exflagsp = np->netc_exflags;
*credanonp = &np->netc_anon;
return(0);
@ -814,5 +830,6 @@ struct vfsops adosfs_vfsops = {
adosfs_init,
adosfs_sysctl,
NULL, /* vfs_mountroot */
adosfs_checkexp,
adosfs_vnodeopv_descs,
};

View File

@ -1,4 +1,4 @@
/* $NetBSD: coda_vfsops.c,v 1.6 1998/12/10 02:22:52 rvb Exp $ */
/* $NetBSD: coda_vfsops.c,v 1.7 1999/02/26 23:44:44 wrstuden Exp $ */
/*
*
@ -47,6 +47,11 @@
/*
* HISTORY
* $Log: coda_vfsops.c,v $
* Revision 1.7 1999/02/26 23:44:44 wrstuden
* Modify vfsops to seperate vfs_fhtovp() into two routines. vfs_fhtovp() now
* only handles the file handle to vnode conversion, and a new call,
* vfs_checkexp(), performs the export verification.
*
* Revision 1.6 1998/12/10 02:22:52 rvb
* Commit a couple of old fixes
*
@ -254,13 +259,14 @@ struct vfsops coda_vfsops = {
coda_nb_statfs,
coda_sync,
coda_vget,
(int (*) (struct mount *, struct fid *, struct mbuf *, struct vnode **,
int *, struct ucred **))
(int (*) (struct mount *, struct fid *, struct vnode ** ))
eopnotsupp,
(int (*) (struct vnode *, struct fid *)) eopnotsupp,
coda_init,
coda_sysctl,
(int (*)(void)) eopnotsupp,
(int (*)(struct mount *, struct mbuf *, int *, struct ucred **))
eopnotsupp,
coda_vnodeopv_descs,
0
};

View File

@ -1,4 +1,4 @@
/* $NetBSD: filecore_extern.h,v 1.4 1998/09/02 18:02:54 mark Exp $ */
/* $NetBSD: filecore_extern.h,v 1.5 1999/02/26 23:44:44 wrstuden Exp $ */
/*-
* Copyright (c) 1998 Andrew McMurry
@ -81,8 +81,9 @@ int filecore_quotactl __P((struct mount *, int, uid_t, caddr_t, struct proc *));
int filecore_statfs __P((struct mount *, struct statfs *, struct proc *));
int filecore_sync __P((struct mount *, int, struct ucred *, struct proc *));
int filecore_vget __P((struct mount *, ino_t, struct vnode **));
int filecore_fhtovp __P((struct mount *, struct fid *, struct mbuf *,
struct vnode **, int *, struct ucred **));
int filecore_fhtovp __P((struct mount *, struct fid *, struct vnode **));
int filecore_checkexp __P((struct mount *, struct mbuf *, int *,
struct ucred **));
int filecore_vptofh __P((struct vnode *, struct fid *));
void filecore_init __P((void));
int filecore_sysctl __P((int *, u_int, void *, size_t *, void *, size_t,

View File

@ -1,4 +1,4 @@
/* $NetBSD: filecore_vfsops.c,v 1.5 1998/12/18 14:24:43 drochner Exp $ */
/* $NetBSD: filecore_vfsops.c,v 1.6 1999/02/26 23:44:44 wrstuden Exp $ */
/*-
* Copyright (c) 1998 Andrew McMurry
@ -81,6 +81,7 @@ struct vfsops filecore_vfsops = {
filecore_init,
filecore_sysctl,
NULL, /* filecore_mountroot */
filecore_checkexp,
filecore_vnodeopv_descs,
};
@ -492,28 +493,16 @@ struct ifid {
/* ARGSUSED */
int
filecore_fhtovp(mp, fhp, nam, vpp, exflagsp, credanonp)
filecore_fhtovp(mp, fhp, vpp)
struct mount *mp;
struct fid *fhp;
struct mbuf *nam;
struct vnode **vpp;
int *exflagsp;
struct ucred **credanonp;
{
struct ifid *ifhp = (struct ifid *)fhp;
struct netcred *np;
struct filecore_mnt *fcmp = VFSTOFILECORE(mp);
struct vnode *nvp;
struct filecore_node *ip;
int error;
/*
* Get the export permission structure for this <mp, client> tuple.
*/
np = vfs_export_lookup(mp, &fcmp->fc_export, nam);
if (np == NULL)
return (EACCES);
if ((error = VFS_VGET(mp, ifhp->ifid_ino, &nvp)) != 0) {
*vpp = NULLVP;
return (error);
@ -523,7 +512,29 @@ filecore_fhtovp(mp, fhp, nam, vpp, exflagsp, credanonp)
vput(nvp);
*vpp = NULLVP;
return (ESTALE);
} *vpp = nvp;
}
*vpp = nvp;
return (0);
}
/* ARGSUSED */
int
filecore_checkexp(mp, nam, exflagsp, credanonp)
struct mount *mp;
struct mbuf *nam;
int *exflagsp;
struct ucred **credanonp;
{
struct filecore_mnt *fcmp = VFSTOFILECORE(mp);
struct netcred *np;
/*
* Get the export permission structure for this <mp, client> tuple.
*/
np = vfs_export_lookup(mp, &fcmp->fc_export, nam);
if (np == NULL)
return (EACCES);
*exflagsp = np->netc_exflags;
*credanonp = &np->netc_anon;
return (0);

View File

@ -1,4 +1,4 @@
/* $NetBSD: cd9660_extern.h,v 1.5 1998/09/01 03:40:19 thorpej Exp $ */
/* $NetBSD: cd9660_extern.h,v 1.6 1999/02/26 23:44:44 wrstuden Exp $ */
/*-
* Copyright (c) 1994
@ -92,8 +92,9 @@ int cd9660_quotactl __P((struct mount *, int, uid_t, caddr_t, struct proc *));
int cd9660_statfs __P((struct mount *, struct statfs *, struct proc *));
int cd9660_sync __P((struct mount *, int, struct ucred *, struct proc *));
int cd9660_vget __P((struct mount *, ino_t, struct vnode **));
int cd9660_fhtovp __P((struct mount *, struct fid *, struct mbuf *,
struct vnode **, int *, struct ucred **));
int cd9660_fhtovp __P((struct mount *, struct fid *, struct vnode **));
int cd9660_check_export __P((struct mount *, struct mbuf *, int *,
struct ucred **));
int cd9660_vptofh __P((struct vnode *, struct fid *));
void cd9660_init __P((void));
int cd9660_sysctl __P((int *, u_int, void *, size_t *, void *, size_t,

View File

@ -1,4 +1,4 @@
/* $NetBSD: cd9660_vfsops.c,v 1.35 1999/01/04 15:32:09 is Exp $ */
/* $NetBSD: cd9660_vfsops.c,v 1.36 1999/02/26 23:44:45 wrstuden Exp $ */
/*-
* Copyright (c) 1994
@ -95,6 +95,7 @@ struct vfsops cd9660_vfsops = {
cd9660_init,
cd9660_sysctl,
cd9660_mountroot,
cd9660_check_export,
cd9660_vnodeopv_descs,
};
@ -561,18 +562,13 @@ struct ifid {
/* ARGSUSED */
int
cd9660_fhtovp(mp, fhp, nam, vpp, exflagsp, credanonp)
cd9660_fhtovp(mp, fhp, vpp)
register struct mount *mp;
struct fid *fhp;
struct mbuf *nam;
struct vnode **vpp;
int *exflagsp;
struct ucred **credanonp;
{
struct ifid *ifhp = (struct ifid *)fhp;
register struct iso_node *ip;
register struct netcred *np;
register struct iso_mnt *imp = VFSTOISOFS(mp);
struct vnode *nvp;
int error;
@ -581,13 +577,6 @@ cd9660_fhtovp(mp, fhp, nam, vpp, exflagsp, credanonp)
ifhp->ifid_ino, ifhp->ifid_start);
#endif
/*
* Get the export permission structure for this <mp, client> tuple.
*/
np = vfs_export_lookup(mp, &imp->im_export, nam);
if (np == NULL)
return (EACCES);
if ((error = VFS_VGET(mp, ifhp->ifid_ino, &nvp)) != 0) {
*vpp = NULLVP;
return (error);
@ -599,6 +588,32 @@ cd9660_fhtovp(mp, fhp, nam, vpp, exflagsp, credanonp)
return (ESTALE);
}
*vpp = nvp;
return (0);
}
/* ARGSUSED */
int
cd9660_check_export(mp, nam, exflagsp, credanonp)
register struct mount *mp;
struct mbuf *nam;
int *exflagsp;
struct ucred **credanonp;
{
register struct netcred *np;
register struct iso_mnt *imp = VFSTOISOFS(mp);
#ifdef ISOFS_DBG
printf("check_export: ino %d, start %ld\n",
ifhp->ifid_ino, ifhp->ifid_start);
#endif
/*
* Get the export permission structure for this <mp, client> tuple.
*/
np = vfs_export_lookup(mp, &imp->im_export, nam);
if (np == NULL)
return (EACCES);
*exflagsp = np->netc_exflags;
*credanonp = &np->netc_anon;
return (0);

View File

@ -1,4 +1,4 @@
/* $NetBSD: fdesc_vfsops.c,v 1.26 1998/08/09 20:51:08 perry Exp $ */
/* $NetBSD: fdesc_vfsops.c,v 1.27 1999/02/26 23:44:45 wrstuden Exp $ */
/*
* Copyright (c) 1992, 1993, 1995
@ -71,8 +71,9 @@ int fdesc_quotactl __P((struct mount *, int, uid_t, caddr_t,
int fdesc_statfs __P((struct mount *, struct statfs *, struct proc *));
int fdesc_sync __P((struct mount *, int, struct ucred *, struct proc *));
int fdesc_vget __P((struct mount *, ino_t, struct vnode **));
int fdesc_fhtovp __P((struct mount *, struct fid *, struct mbuf *,
struct vnode **, int *, struct ucred **));
int fdesc_fhtovp __P((struct mount *, struct fid *, struct vnode **));
int fdesc_checkexp __P((struct mount *, struct mbuf *, int *,
struct ucred **));
int fdesc_vptofh __P((struct vnode *, struct fid *));
int fdesc_sysctl __P((int *, u_int, void *, size_t *, void *, size_t,
struct proc *));
@ -280,11 +281,20 @@ fdesc_vget(mp, ino, vpp)
/*ARGSUSED*/
int
fdesc_fhtovp(mp, fhp, nam, vpp, exflagsp, credanonp)
fdesc_fhtovp(mp, fhp, vpp)
struct mount *mp;
struct fid *fhp;
struct mbuf *nam;
struct vnode **vpp;
{
return (EOPNOTSUPP);
}
/*ARGSUSED*/
int
fdesc_checkexp(mp, nam, exflagsp, credanonp)
struct mount *mp;
struct mbuf *nam;
int *exflagsp;
struct ucred **credanonp;
{
@ -336,5 +346,6 @@ struct vfsops fdesc_vfsops = {
fdesc_init,
fdesc_sysctl,
NULL, /* vfs_mountroot */
fdesc_checkexp,
fdesc_vnodeopv_descs,
};

View File

@ -1,4 +1,4 @@
/* $NetBSD: kernfs_vfsops.c,v 1.34 1998/08/09 20:51:08 perry Exp $ */
/* $NetBSD: kernfs_vfsops.c,v 1.35 1999/02/26 23:44:45 wrstuden Exp $ */
/*
* Copyright (c) 1992, 1993, 1995
@ -73,8 +73,9 @@ int kernfs_quotactl __P((struct mount *, int, uid_t, caddr_t,
struct proc *));
int kernfs_sync __P((struct mount *, int, struct ucred *, struct proc *));
int kernfs_vget __P((struct mount *, ino_t, struct vnode **));
int kernfs_fhtovp __P((struct mount *, struct fid *, struct mbuf *,
struct vnode **, int *, struct ucred **));
int kernfs_fhtovp __P((struct mount *, struct fid *, struct vnode **));
int kernfs_checkexp __P((struct mount *, struct mbuf *, int *,
struct ucred **));
int kernfs_vptofh __P((struct vnode *, struct fid *));
int kernfs_sysctl __P((int *, u_int, void *, size_t *, void *, size_t,
struct proc *));
@ -310,11 +311,20 @@ kernfs_vget(mp, ino, vpp)
/*ARGSUSED*/
int
kernfs_fhtovp(mp, fhp, mb, vpp, what, anon)
kernfs_fhtovp(mp, fhp, vpp)
struct mount *mp;
struct fid *fhp;
struct mbuf *mb;
struct vnode **vpp;
{
return (EOPNOTSUPP);
}
/*ARGSUSED*/
int
kernfs_checkexp(mp, mb, what, anon)
struct mount *mp;
struct mbuf *mb;
int *what;
struct ucred **anon;
{
@ -367,5 +377,6 @@ struct vfsops kernfs_vfsops = {
kernfs_init,
kernfs_sysctl,
NULL, /* vfs_mountroot */
kernfs_checkexp,
kernfs_vnodeopv_descs,
};

View File

@ -1,4 +1,4 @@
/* $NetBSD: null_vfsops.c,v 1.22 1999/01/15 22:04:44 wrstuden Exp $ */
/* $NetBSD: null_vfsops.c,v 1.23 1999/02/26 23:44:45 wrstuden Exp $ */
/*
* Copyright (c) 1992, 1993, 1995
@ -66,8 +66,9 @@ int nullfs_quotactl __P((struct mount *, int, uid_t, caddr_t,
int nullfs_statfs __P((struct mount *, struct statfs *, struct proc *));
int nullfs_sync __P((struct mount *, int, struct ucred *, struct proc *));
int nullfs_vget __P((struct mount *, ino_t, struct vnode **));
int nullfs_fhtovp __P((struct mount *, struct fid *, struct mbuf *,
struct vnode **, int *, struct ucred **));
int nullfs_fhtovp __P((struct mount *, struct fid *, struct vnode **));
int nullfs_checkexp __P((struct mount *, struct mbuf *, int *,
struct ucred **));
int nullfs_vptofh __P((struct vnode *, struct fid *));
int nullfs_sysctl __P((int *, u_int, void *, size_t *, void *, size_t,
struct proc *));
@ -344,11 +345,19 @@ nullfs_vget(mp, ino, vpp)
}
int
nullfs_fhtovp(mp, fidp, nam, vpp, exflagsp, credanonp)
nullfs_fhtovp(mp, fidp, vpp)
struct mount *mp;
struct fid *fidp;
struct mbuf *nam;
struct vnode **vpp;
{
return (EOPNOTSUPP);
}
int
nullfs_checkexp(mp, nam, exflagsp, credanonp)
struct mount *mp;
struct mbuf *nam;
int *exflagsp;
struct ucred**credanonp;
{
@ -400,5 +409,6 @@ struct vfsops nullfs_vfsops = {
nullfs_init,
nullfs_sysctl,
NULL, /* vfs_mountroot */
nullfs_checkexp,
nullfs_vnodeopv_descs,
};

View File

@ -1,4 +1,4 @@
/* $NetBSD: portal_vfsops.c,v 1.20 1998/08/09 20:51:09 perry Exp $ */
/* $NetBSD: portal_vfsops.c,v 1.21 1999/02/26 23:44:45 wrstuden Exp $ */
/*
* Copyright (c) 1992, 1993, 1995
@ -77,8 +77,9 @@ int portal_quotactl __P((struct mount *, int, uid_t, caddr_t,
int portal_statfs __P((struct mount *, struct statfs *, struct proc *));
int portal_sync __P((struct mount *, int, struct ucred *, struct proc *));
int portal_vget __P((struct mount *, ino_t, struct vnode **));
int portal_fhtovp __P((struct mount *, struct fid *, struct mbuf *,
struct vnode **, int *, struct ucred **));
int portal_fhtovp __P((struct mount *, struct fid *, struct vnode **));
int portal_checkexp __P((struct mount *, struct mbuf *, int *,
struct ucred **));
int portal_vptofh __P((struct vnode *, struct fid *));
int portal_sysctl __P((int *, u_int, void *, size_t *, void *, size_t,
struct proc *));
@ -295,11 +296,19 @@ portal_vget(mp, ino, vpp)
}
int
portal_fhtovp(mp, fhp, mb, vpp, what, anon)
portal_fhtovp(mp, fhp, vpp)
struct mount *mp;
struct fid *fhp;
struct mbuf *mb;
struct vnode **vpp;
{
return (EOPNOTSUPP);
}
int
portal_checkexp(mp, mb, what, anon)
struct mount *mp;
struct mbuf *mb;
int *what;
struct ucred **anon;
{
@ -351,5 +360,6 @@ struct vfsops portal_vfsops = {
portal_init,
portal_sysctl,
NULL, /* vfs_mountroot */
portal_checkexp,
portal_vnodeopv_descs,
};

View File

@ -1,4 +1,4 @@
/* $NetBSD: procfs_vfsops.c,v 1.30 1998/08/09 20:51:10 perry Exp $ */
/* $NetBSD: procfs_vfsops.c,v 1.31 1999/02/26 23:44:46 wrstuden Exp $ */
/*
* Copyright (c) 1993 Jan-Simon Pendry
@ -70,8 +70,9 @@ int procfs_quotactl __P((struct mount *, int, uid_t, caddr_t,
int procfs_statfs __P((struct mount *, struct statfs *, struct proc *));
int procfs_sync __P((struct mount *, int, struct ucred *, struct proc *));
int procfs_vget __P((struct mount *, ino_t, struct vnode **));
int procfs_fhtovp __P((struct mount *, struct fid *, struct mbuf *,
struct vnode **, int *, struct ucred **));
int procfs_fhtovp __P((struct mount *, struct fid *, struct vnode **));
int procfs_checkexp __P((struct mount *, struct mbuf *, int *,
struct ucred **));
int procfs_vptofh __P((struct vnode *, struct fid *));
int procfs_sysctl __P((int *, u_int, void *, size_t *, void *, size_t,
struct proc *));
@ -220,11 +221,20 @@ procfs_vget(mp, ino, vpp)
/*ARGSUSED*/
int
procfs_fhtovp(mp, fhp, mb, vpp, what, anon)
procfs_fhtovp(mp, fhp, vpp)
struct mount *mp;
struct fid *fhp;
struct mbuf *mb;
struct vnode **vpp;
{
return (EINVAL);
}
/*ARGSUSED*/
int
procfs_checkexp(mp, mb, what, anon)
struct mount *mp;
struct mbuf *mb;
int *what;
struct ucred **anon;
{
@ -282,5 +292,6 @@ struct vfsops procfs_vfsops = {
procfs_init,
procfs_sysctl,
NULL, /* vfs_mountroot */
procfs_checkexp,
procfs_vnodeopv_descs,
};

View File

@ -1,4 +1,4 @@
/* $NetBSD: umap_vfsops.c,v 1.19 1998/08/09 20:51:10 perry Exp $ */
/* $NetBSD: umap_vfsops.c,v 1.20 1999/02/26 23:44:46 wrstuden Exp $ */
/*
* Copyright (c) 1992, 1993
@ -65,8 +65,9 @@ int umapfs_quotactl __P((struct mount *, int, uid_t, caddr_t,
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_fhtovp __P((struct mount *, struct fid *, struct vnode **));
int umapfs_checkexp __P((struct mount *, struct mbuf *, int *,
struct ucred **));
int umapfs_vptofh __P((struct vnode *, struct fid *));
int umapfs_sysctl __P((int *, u_int, void *, size_t *, void *, size_t,
struct proc *));
@ -386,11 +387,19 @@ umapfs_vget(mp, ino, vpp)
}
int
umapfs_fhtovp(mp, fidp, nam, vpp, exflagsp, credanonp)
umapfs_fhtovp(mp, fidp, vpp)
struct mount *mp;
struct fid *fidp;
struct mbuf *nam;
struct vnode **vpp;
{
return (EOPNOTSUPP);
}
int
umapfs_checkexp(mp, nam, exflagsp, credanonp)
struct mount *mp;
struct mbuf *nam;
int *exflagsp;
struct ucred**credanonp;
{
@ -442,5 +451,6 @@ struct vfsops umapfs_vfsops = {
umapfs_init,
umapfs_sysctl,
NULL, /* vfs_mountroot */
umapfs_checkexp,
umapfs_vnodeopv_descs,
};

View File

@ -1,4 +1,4 @@
/* $NetBSD: union_vfsops.c,v 1.20 1998/08/09 20:51:11 perry Exp $ */
/* $NetBSD: union_vfsops.c,v 1.21 1999/02/26 23:44:46 wrstuden Exp $ */
/*
* Copyright (c) 1994 The Regents of the University of California.
@ -67,8 +67,9 @@ int union_quotactl __P((struct mount *, int, uid_t, caddr_t, struct proc *));
int union_statfs __P((struct mount *, struct statfs *, struct proc *));
int union_sync __P((struct mount *, int, struct ucred *, struct proc *));
int union_vget __P((struct mount *, ino_t, struct vnode **));
int union_fhtovp __P((struct mount *, struct fid *, struct mbuf *,
struct vnode **, int *, struct ucred **));
int union_fhtovp __P((struct mount *, struct fid *, struct vnode **));
int union_checkexp __P((struct mount *, struct mbuf *, int *,
struct ucred **));
int union_vptofh __P((struct vnode *, struct fid *));
int union_sysctl __P((int *, u_int, void *, size_t *, void *, size_t,
struct proc *));
@ -511,11 +512,20 @@ union_vget(mp, ino, vpp)
/*ARGSUSED*/
int
union_fhtovp(mp, fidp, nam, vpp, exflagsp, credanonp)
union_fhtovp(mp, fidp, vpp)
struct mount *mp;
struct fid *fidp;
struct mbuf *nam;
struct vnode **vpp;
{
return (EOPNOTSUPP);
}
/*ARGSUSED*/
int
union_checkexp(mp, nam, exflagsp, credanonp)
struct mount *mp;
struct mbuf *nam;
int *exflagsp;
struct ucred **credanonp;
{
@ -568,5 +578,6 @@ struct vfsops union_vfsops = {
union_init,
union_sysctl,
NULL, /* vfs_mountroot */
union_checkexp,
union_vnodeopv_descs,
};

View File

@ -1,4 +1,4 @@
/* $NetBSD: msdosfs_vfsops.c,v 1.59 1998/08/18 06:31:04 thorpej Exp $ */
/* $NetBSD: msdosfs_vfsops.c,v 1.60 1999/02/26 23:44:46 wrstuden Exp $ */
/*-
* Copyright (C) 1994, 1995, 1997 Wolfgang Solfrank.
@ -86,8 +86,9 @@ int msdosfs_quotactl __P((struct mount *, int, uid_t, caddr_t, struct proc *));
int msdosfs_statfs __P((struct mount *, struct statfs *, struct proc *));
int msdosfs_sync __P((struct mount *, int, struct ucred *, struct proc *));
int msdosfs_vget __P((struct mount *, ino_t, struct vnode **));
int msdosfs_fhtovp __P((struct mount *, struct fid *, struct mbuf *,
struct vnode **, int *, struct ucred **));
int msdosfs_fhtovp __P((struct mount *, struct fid *, struct vnode **));
int msdosfs_checkexp __P((struct mount *, struct mbuf *, int *,
struct ucred **));
int msdosfs_vptofh __P((struct vnode *, struct fid *));
int msdosfs_sysctl __P((int *, u_int, void *, size_t *, void *, size_t,
struct proc *));
@ -121,6 +122,7 @@ struct vfsops msdosfs_vfsops = {
msdosfs_init,
msdosfs_sysctl,
msdosfs_mountroot,
msdosfs_checkexp,
msdosfs_vnodeopv_descs,
};
@ -913,29 +915,38 @@ loop:
}
int
msdosfs_fhtovp(mp, fhp, nam, vpp, exflagsp, credanonp)
msdosfs_fhtovp(mp, fhp, vpp)
struct mount *mp;
struct fid *fhp;
struct mbuf *nam;
struct vnode **vpp;
int *exflagsp;
struct ucred **credanonp;
{
struct msdosfsmount *pmp = VFSTOMSDOSFS(mp);
struct defid *defhp = (struct defid *) fhp;
struct denode *dep;
struct netcred *np;
int error;
np = vfs_export_lookup(mp, &pmp->pm_export, nam);
if (np == NULL)
return (EACCES);
error = deget(pmp, defhp->defid_dirclust, defhp->defid_dirofs, &dep);
if (error) {
*vpp = NULLVP;
return (error);
}
*vpp = DETOV(dep);
return (0);
}
int
msdosfs_checkexp(mp, nam, exflagsp, credanonp)
struct mount *mp;
struct mbuf *nam;
int *exflagsp;
struct ucred **credanonp;
{
struct msdosfsmount *pmp = VFSTOMSDOSFS(mp);
struct netcred *np;
np = vfs_export_lookup(mp, &pmp->pm_export, nam);
if (np == NULL)
return (EACCES);
*exflagsp = np->netc_exflags;
*credanonp = &np->netc_anon;
return (0);

View File

@ -1,4 +1,4 @@
/* $NetBSD: msdosfsmount.h,v 1.18 1998/03/01 02:25:12 fvdl Exp $ */
/* $NetBSD: msdosfsmount.h,v 1.19 1999/02/26 23:44:47 wrstuden Exp $ */
/*-
* Copyright (C) 1994, 1995, 1997 Wolfgang Solfrank.
@ -214,7 +214,8 @@ int msdosfs_root __P((struct mount *, struct vnode **));
int msdosfs_quotactl __P((struct mount *, int, uid_t, caddr_t, struct proc *));
int msdosfs_statfs __P((struct mount *, struct statfs *, struct proc *));
int msdosfs_sync __P((struct mount *, int, struct ucred *, struct proc *));
int msdosfs_fhtovp __P((struct mount *, struct fid *, struct mbuf *, struct vnode **, int *, struct ucred **));
int msdosfs_fhtovp __P((struct mount *, struct fid *, struct vnode **));
int msdosfs_checkexp __P((struct mount *, struct mbuf *, int *, struct ucred **));
int msdosfs_vptofh __P((struct vnode *, struct fid *));
void msdosfs_init __P((void));

View File

@ -1,4 +1,4 @@
/* $NetBSD: nfs_subs.c,v 1.63 1998/08/09 21:19:52 perry Exp $ */
/* $NetBSD: nfs_subs.c,v 1.64 1999/02/26 23:44:47 wrstuden Exp $ */
/*
* Copyright (c) 1989, 1993
@ -2217,7 +2217,10 @@ nfsrv_fhtovp(fhp, lockflag, vpp, cred, slp, nam, rdonlyp, kerbflag, pubflag)
mp = vfs_getvfs(&fhp->fh_fsid);
if (!mp)
return (ESTALE);
error = VFS_FHTOVP(mp, &fhp->fh_fid, nam, vpp, &exflags, &credanon);
error = VFS_CHKEXP(mp, nam, &exflags, &credanon);
if (error)
return (error);
error = VFS_FHTOVP(mp, &fhp->fh_fid, vpp);
if (error)
return (error);

View File

@ -1,4 +1,4 @@
/* $NetBSD: nfs_vfsops.c,v 1.80 1999/02/21 15:11:09 drochner Exp $ */
/* $NetBSD: nfs_vfsops.c,v 1.81 1999/02/26 23:44:47 wrstuden Exp $ */
/*
* Copyright (c) 1989, 1993, 1995
@ -109,6 +109,7 @@ struct vfsops nfs_vfsops = {
nfs_vfs_init,
nfs_sysctl,
nfs_mountroot,
nfs_checkexp,
nfs_vnodeopv_descs,
};
@ -928,11 +929,20 @@ nfs_sysctl(name, namelen, oldp, oldlenp, newp, newlen, p)
*/
/* ARGSUSED */
int
nfs_fhtovp(mp, fhp, nam, vpp, exflagsp, credanonp)
nfs_fhtovp(mp, fhp, vpp)
register struct mount *mp;
struct fid *fhp;
struct mbuf *nam;
struct vnode **vpp;
{
return (EINVAL);
}
/* ARGSUSED */
int
nfs_checkexp(mp, nam, exflagsp, credanonp)
register struct mount *mp;
struct mbuf *nam;
int *exflagsp;
struct ucred **credanonp;
{

View File

@ -1,4 +1,4 @@
/* $NetBSD: nfsmount.h,v 1.16 1998/03/01 02:24:29 fvdl Exp $ */
/* $NetBSD: nfsmount.h,v 1.17 1999/02/26 23:44:48 wrstuden Exp $ */
/*
* Copyright (c) 1989, 1993
@ -184,8 +184,9 @@ int nfs_statfs __P((struct mount *mp, struct statfs *sbp, struct proc *p));
int nfs_sync __P((struct mount *mp, int waitfor, struct ucred *cred,
struct proc *p));
int nfs_vget __P((struct mount *, ino_t, struct vnode **));
int nfs_fhtovp __P((struct mount *mp, struct fid *fhp, struct mbuf *nam,
struct vnode **vpp, int *exflagsp, struct ucred **credanonp));
int nfs_fhtovp __P((struct mount *mp, struct fid *fhp, struct vnode **vpp));
int nfs_checkexp __P((struct mount *mp, struct mbuf *nam, int *exflagsp,
struct ucred **credanonp));
int nfs_vptofh __P((struct vnode *vp, struct fid *fhp));
int nfs_fsinfo __P((struct nfsmount *, struct vnode *, struct ucred *,
struct proc *));

View File

@ -1,4 +1,4 @@
/* $NetBSD: mount.h,v 1.71 1998/12/01 23:16:23 kenh Exp $ */
/* $NetBSD: mount.h,v 1.72 1999/02/26 23:44:48 wrstuden Exp $ */
/*
* Copyright (c) 1989, 1991, 1993
@ -291,13 +291,14 @@ struct vfsops {
int (*vfs_vget) __P((struct mount *mp, ino_t ino,
struct vnode **vpp));
int (*vfs_fhtovp) __P((struct mount *mp, struct fid *fhp,
struct mbuf *nam, struct vnode **vpp,
int *exflagsp, struct ucred **credanonp));
struct vnode **vpp));
int (*vfs_vptofh) __P((struct vnode *vp, struct fid *fhp));
void (*vfs_init) __P((void));
int (*vfs_sysctl) __P((int *, u_int, void *, size_t *, void *,
size_t, struct proc *));
int (*vfs_mountroot) __P((void));
int (*vfs_checkexp) __P((struct mount *mp, struct mbuf *nam,
int *extflagsp, struct ucred **credanonp));
struct vnodeopv_desc **vfs_opv_descs;
int vfs_refcount;
LIST_ENTRY(vfsops) vfs_list;
@ -312,8 +313,9 @@ struct vfsops {
#define VFS_STATFS(MP, SBP, P) (*(MP)->mnt_op->vfs_statfs)(MP, SBP, P)
#define VFS_SYNC(MP, WAIT, C, P) (*(MP)->mnt_op->vfs_sync)(MP, WAIT, C, P)
#define VFS_VGET(MP, INO, VPP) (*(MP)->mnt_op->vfs_vget)(MP, INO, VPP)
#define VFS_FHTOVP(MP, FIDP, NAM, VPP, EXFLG, CRED) \
(*(MP)->mnt_op->vfs_fhtovp)(MP, FIDP, NAM, VPP, EXFLG, CRED)
#define VFS_FHTOVP(MP, FIDP, VPP) (*(MP)->mnt_op->vfs_fhtovp)(MP, FIDP, VPP)
#define VFS_CHKEXP(MP, NAM, EXFLG, CRED) \
(*(MP)->mnt_op->vfs_checkexp)(MP, NAM, EXFLG, CRED)
#define VFS_VPTOFH(VP, FIDP) (*(VP)->v_mount->mnt_op->vfs_vptofh)(VP, FIDP)
#endif /* _KERNEL */

View File

@ -1,4 +1,4 @@
/* $NetBSD: ext2fs_extern.h,v 1.6 1998/09/01 03:20:46 thorpej Exp $ */
/* $NetBSD: ext2fs_extern.h,v 1.7 1999/02/26 23:44:48 wrstuden Exp $ */
/*-
* Copyright (c) 1997 Manuel Bouyer.
@ -110,8 +110,7 @@ int ext2fs_flushfiles __P((struct mount *, int, struct proc *));
int ext2fs_statfs __P((struct mount *, struct statfs *, struct proc *));
int ext2fs_sync __P((struct mount *, int, struct ucred *, struct proc *));
int ext2fs_vget __P((struct mount *, ino_t, struct vnode **));
int ext2fs_fhtovp __P((struct mount *, struct fid *, struct mbuf *,
struct vnode **, int *, struct ucred **));
int ext2fs_fhtovp __P((struct mount *, struct fid *, struct vnode **));
int ext2fs_vptofh __P((struct vnode *, struct fid *));
int ext2fs_sysctl __P((int *, u_int, void *, size_t *, void *, size_t,
struct proc *));

View File

@ -1,4 +1,4 @@
/* $NetBSD: ext2fs_vfsops.c,v 1.23 1999/02/10 13:14:09 bouyer Exp $ */
/* $NetBSD: ext2fs_vfsops.c,v 1.24 1999/02/26 23:44:49 wrstuden Exp $ */
/*
* Copyright (c) 1997 Manuel Bouyer.
@ -74,8 +74,6 @@
extern struct lock ufs_hashlock;
int ext2fs_sbupdate __P((struct ufsmount *, int));
int ext2fs_check_export __P((struct mount *, struct ufid *, struct mbuf *,
struct vnode **, int *, struct ucred **));
extern struct vnodeopv_desc ext2fs_vnodeop_opv_desc;
extern struct vnodeopv_desc ext2fs_specop_opv_desc;
@ -103,6 +101,7 @@ struct vfsops ext2fs_vfsops = {
ext2fs_init,
ext2fs_sysctl,
ext2fs_mountroot,
ufs_check_export,
ext2fs_vnodeopv_descs,
};
@ -123,52 +122,6 @@ ext2fs_init()
M_EXT2FSNODE);
}
/*
* This is the generic part of fhtovp called after the underlying
* filesystem has validated the file handle.
*
* Verify that a host should have access to a filesystem, and if so
* return a vnode for the presented file handle.
*/
int
ext2fs_check_export(mp, ufhp, nam, vpp, exflagsp, credanonp)
register struct mount *mp;
struct ufid *ufhp;
struct mbuf *nam;
struct vnode **vpp;
int *exflagsp;
struct ucred **credanonp;
{
register struct inode *ip;
register struct netcred *np;
register struct ufsmount *ump = VFSTOUFS(mp);
struct vnode *nvp;
int error;
/*
* Get the export permission structure for this <mp, client> tuple.
*/
np = vfs_export_lookup(mp, &ump->um_export, nam);
if (np == NULL)
return (EACCES);
if ((error = VFS_VGET(mp, ufhp->ufid_ino, &nvp)) != 0) {
*vpp = NULLVP;
return (error);
}
ip = VTOI(nvp);
if (ip->i_e2fs_mode == 0 || ip->i_e2fs_dtime != 0 ||
ip->i_e2fs_gen != ufhp->ufid_gen) {
vput(nvp);
*vpp = NULLVP;
return (ESTALE);
}
*vpp = nvp;
*exflagsp = np->netc_exflags;
*credanonp = &np->netc_anon;
return (0);
}
/*
* Called by main() when ext2fs is going to be mounted as root.
@ -971,18 +924,16 @@ ext2fs_vget(mp, ino, vpp)
* - check that the inode number is valid
* - call ext2fs_vget() to get the locked inode
* - check for an unallocated inode (i_mode == 0)
* - check that the given client host has export rights and return
* those rights via. exflagsp and credanonp
*/
int
ext2fs_fhtovp(mp, fhp, nam, vpp, exflagsp, credanonp)
ext2fs_fhtovp(mp, fhp, vpp)
register struct mount *mp;
struct fid *fhp;
struct mbuf *nam;
struct vnode **vpp;
int *exflagsp;
struct ucred **credanonp;
{
register struct inode *ip;
struct vnode *nvp;
int error;
register struct ufid *ufhp;
struct m_ext2fs *fs;
@ -991,7 +942,20 @@ ext2fs_fhtovp(mp, fhp, nam, vpp, exflagsp, credanonp)
if ((ufhp->ufid_ino < EXT2_FIRSTINO && ufhp->ufid_ino != EXT2_ROOTINO) ||
ufhp->ufid_ino >= fs->e2fs_ncg * fs->e2fs.e2fs_ipg)
return (ESTALE);
return (ext2fs_check_export(mp, ufhp, nam, vpp, exflagsp, credanonp));
if ((error = VFS_VGET(mp, ufhp->ufid_ino, &nvp)) != 0) {
*vpp = NULLVP;
return (error);
}
ip = VTOI(nvp);
if (ip->i_e2fs_mode == 0 || ip->i_e2fs_dtime != 0 ||
ip->i_e2fs_gen != ufhp->ufid_gen) {
vput(nvp);
*vpp = NULLVP;
return (ESTALE);
}
*vpp = nvp;
return (0);
}
/*

View File

@ -1,4 +1,4 @@
/* $NetBSD: ffs_extern.h,v 1.11 1998/09/01 03:11:08 thorpej Exp $ */
/* $NetBSD: ffs_extern.h,v 1.12 1999/02/26 23:44:49 wrstuden Exp $ */
/*-
* Copyright (c) 1991, 1993, 1994
@ -121,8 +121,7 @@ int ffs_flushfiles __P((struct mount *, int, struct proc *));
int ffs_statfs __P((struct mount *, struct statfs *, struct proc *));
int ffs_sync __P((struct mount *, int, struct ucred *, struct proc *));
int ffs_vget __P((struct mount *, ino_t, struct vnode **));
int ffs_fhtovp __P((struct mount *, struct fid *, struct mbuf *,
struct vnode **, int *, struct ucred **));
int ffs_fhtovp __P((struct mount *, struct fid *, struct vnode **));
int ffs_vptofh __P((struct vnode *, struct fid *));
int ffs_sysctl __P((int *, u_int, void *, size_t *, void *, size_t,
struct proc *));

View File

@ -1,4 +1,4 @@
/* $NetBSD: ffs_vfsops.c,v 1.47 1999/02/10 13:14:09 bouyer Exp $ */
/* $NetBSD: ffs_vfsops.c,v 1.48 1999/02/26 23:44:49 wrstuden Exp $ */
/*
* Copyright (c) 1989, 1991, 1993, 1994
@ -104,6 +104,7 @@ struct vfsops ffs_vfsops = {
ffs_init,
ffs_sysctl,
ffs_mountroot,
ufs_check_export,
ffs_vnodeopv_descs,
};
@ -974,13 +975,10 @@ ffs_vget(mp, ino, vpp)
* those rights via. exflagsp and credanonp
*/
int
ffs_fhtovp(mp, fhp, nam, vpp, exflagsp, credanonp)
ffs_fhtovp(mp, fhp, vpp)
register struct mount *mp;
struct fid *fhp;
struct mbuf *nam;
struct vnode **vpp;
int *exflagsp;
struct ucred **credanonp;
{
register struct ufid *ufhp;
struct fs *fs;
@ -990,7 +988,7 @@ ffs_fhtovp(mp, fhp, nam, vpp, exflagsp, credanonp)
if (ufhp->ufid_ino < ROOTINO ||
ufhp->ufid_ino >= fs->fs_ncg * fs->fs_ipg)
return (ESTALE);
return (ufs_check_export(mp, ufhp, nam, vpp, exflagsp, credanonp));
return (ufs_fhtovp(mp, ufhp, vpp));
}
/*

View File

@ -1,4 +1,4 @@
/* $NetBSD: lfs_extern.h,v 1.11 1998/09/11 21:27:12 pk Exp $ */
/* $NetBSD: lfs_extern.h,v 1.12 1999/02/26 23:44:49 wrstuden Exp $ */
/*-
* Copyright (c) 1991, 1993, 1994
@ -119,7 +119,7 @@ int lfs_unmount __P((struct mount *, int, struct proc *));
int lfs_statfs __P((struct mount *, struct statfs *, struct proc *));
int lfs_sync __P((struct mount *, int, struct ucred *, struct proc *));
int lfs_vget __P((struct mount *, ino_t, struct vnode **));
int lfs_fhtovp __P((struct mount *, struct fid *, struct mbuf *, struct vnode **, int *, struct ucred **));
int lfs_fhtovp __P((struct mount *, struct fid *, struct vnode **));
int lfs_vptofh __P((struct vnode *, struct fid *));
int lfs_sysctl __P((int *, u_int, void *, size_t *, void *, size_t,
struct proc *));

View File

@ -1,4 +1,4 @@
/* $NetBSD: lfs_vfsops.c,v 1.24 1998/09/11 21:27:13 pk Exp $ */
/* $NetBSD: lfs_vfsops.c,v 1.25 1999/02/26 23:44:49 wrstuden Exp $ */
/*
* Copyright (c) 1989, 1991, 1993, 1994
@ -94,6 +94,7 @@ struct vfsops lfs_vfsops = {
lfs_init,
lfs_sysctl,
NULL,
ufs_check_export,
lfs_vnodeopv_descs,
};
@ -630,8 +631,6 @@ lfs_vget(mp, ino, vpp)
* - check that the inode number is valid
* - call lfs_vget() to get the locked inode
* - check for an unallocated inode (i_mode == 0)
* - check that the given client host has export rights and return
* those rights via. exflagsp and credanonp
*
* XXX
* use ifile to see if inode is allocated instead of reading off disk
@ -639,20 +638,17 @@ lfs_vget(mp, ino, vpp)
* generational number.
*/
int
lfs_fhtovp(mp, fhp, nam, vpp, exflagsp, credanonp)
lfs_fhtovp(mp, fhp, vpp)
register struct mount *mp;
struct fid *fhp;
struct mbuf *nam;
struct vnode **vpp;
int *exflagsp;
struct ucred **credanonp;
{
register struct ufid *ufhp;
ufhp = (struct ufid *)fhp;
if (ufhp->ufid_ino < ROOTINO)
return (ESTALE);
return (ufs_check_export(mp, ufhp, nam, vpp, exflagsp, credanonp));
return (ufs_fhtovp(mp, ufhp, vpp));
}
/*

View File

@ -1,4 +1,4 @@
/* $NetBSD: mfs_vfsops.c,v 1.18 1998/08/09 20:15:40 perry Exp $ */
/* $NetBSD: mfs_vfsops.c,v 1.19 1999/02/26 23:44:50 wrstuden Exp $ */
/*
* Copyright (c) 1989, 1990, 1993, 1994
@ -94,6 +94,7 @@ struct vfsops mfs_vfsops = {
mfs_init,
ffs_sysctl,
NULL,
ufs_check_export,
mfs_vnodeopv_descs,
};

View File

@ -1,4 +1,4 @@
/* $NetBSD: ufs_extern.h,v 1.16 1998/11/12 19:54:42 thorpej Exp $ */
/* $NetBSD: ufs_extern.h,v 1.17 1999/02/26 23:44:50 wrstuden Exp $ */
/*-
* Copyright (c) 1991, 1993, 1994
@ -154,8 +154,9 @@ void dqflush __P((struct vnode *));
int ufs_start __P((struct mount *, int, struct proc *));
int ufs_root __P((struct mount *, struct vnode **));
int ufs_quotactl __P((struct mount *, int, uid_t, caddr_t, struct proc *));
int ufs_check_export __P((struct mount *, struct ufid *, struct mbuf *,
struct vnode **, int *, struct ucred **));
int ufs_fhtovp __P((struct mount *, struct ufid *, struct vnode **));
int ufs_check_export __P((struct mount *, struct mbuf *, int *,
struct ucred **));
/* ufs_vnops.c */
int ufs_vinit __P((struct mount *, int (**) __P((void *)),

View File

@ -1,4 +1,4 @@
/* $NetBSD: ufs_vfsops.c,v 1.8 1998/08/09 03:16:23 mrg Exp $ */
/* $NetBSD: ufs_vfsops.c,v 1.9 1999/02/26 23:44:50 wrstuden Exp $ */
/*
* Copyright (c) 1991, 1993, 1994
@ -163,26 +163,18 @@ ufs_quotactl(mp, cmds, uid, arg, p)
}
/*
* This is the generic part of fhtovp called after the underlying
* filesystem has validated the file handle.
*
* Verify that a host should have access to a filesystem, and if so
* return a vnode for the presented file handle.
* Verify a remote client has export rights and return these rights via.
* exflagsp and credanonp.
*/
int
ufs_check_export(mp, ufhp, nam, vpp, exflagsp, credanonp)
ufs_check_export(mp, nam, exflagsp, credanonp)
register struct mount *mp;
struct ufid *ufhp;
struct mbuf *nam;
struct vnode **vpp;
int *exflagsp;
struct ucred **credanonp;
{
register struct inode *ip;
register struct netcred *np;
register struct ufsmount *ump = VFSTOUFS(mp);
struct vnode *nvp;
int error;
/*
* Get the export permission structure for this <mp, client> tuple.
@ -191,6 +183,25 @@ ufs_check_export(mp, ufhp, nam, vpp, exflagsp, credanonp)
if (np == NULL)
return (EACCES);
*exflagsp = np->netc_exflags;
*credanonp = &np->netc_anon;
return (0);
}
/*
* This is the generic part of fhtovp called after the underlying
* filesystem has validated the file handle.
*/
int
ufs_fhtovp(mp, ufhp, vpp)
register struct mount *mp;
struct ufid *ufhp;
struct vnode **vpp;
{
struct vnode *nvp;
register struct inode *ip;
int error;
if ((error = VFS_VGET(mp, ufhp->ufid_ino, &nvp)) != 0) {
*vpp = NULLVP;
return (error);
@ -202,8 +213,6 @@ ufs_check_export(mp, ufhp, nam, vpp, exflagsp, credanonp)
return (ESTALE);
}
*vpp = nvp;
*exflagsp = np->netc_exflags;
*credanonp = &np->netc_anon;
return (0);
}