Catch up with KSE changes.

Submitted by:	Max Khon <fjoe@iclub.nsu.ru>
This commit is contained in:
Boris Popov 2001-12-02 08:56:58 +00:00
parent 262c1c1a4e
commit b1c996c40b
Notes: svn2git 2020-12-20 02:59:44 +00:00
svn path=/head/; revision=87194
5 changed files with 158 additions and 155 deletions

View File

@ -97,9 +97,9 @@ struct smbmount {
#define VTOSMBFS(vp) (VFSTOSMBFS(VTOVFS(vp)))
int smbfs_ioctl(struct vop_ioctl_args *ap);
int smbfs_doio(struct buf *bp, struct ucred *cr, struct proc *p);
int smbfs_doio(struct buf *bp, struct ucred *cr, struct thread *td);
int smbfs_vinvalbuf(struct vnode *vp, int flags, struct ucred *cred,
struct proc *p, int intrflg);
struct thread *td, int intrflg);
#endif /* KERNEL */
#endif /* _SMBFS_SMBFS_H_ */

View File

@ -94,7 +94,7 @@ smbfs_readvdir(struct vnode *vp, struct uio *uio, struct ucred *cred)
np = VTOSMB(vp);
SMBVDEBUG("dirname='%s'\n", np->n_name);
smb_makescred(&scred, uio->uio_procp, cred);
smb_makescred(&scred, uio->uio_td, cred);
offset = uio->uio_offset / DE_SIZE; /* offset in the directory */
limit = uio->uio_resid / DE_SIZE;
if (uio->uio_resid < DE_SIZE || uio->uio_offset < 0)
@ -183,7 +183,7 @@ smbfs_readvnode(struct vnode *vp, struct uio *uiop, struct ucred *cred)
{
struct smbmount *smp = VFSTOSMBFS(vp->v_mount);
struct smbnode *np = VTOSMB(vp);
struct proc *p;
struct thread *td;
struct vattr vattr;
struct smb_cred scred;
int error, lks;
@ -198,36 +198,36 @@ smbfs_readvnode(struct vnode *vp, struct uio *uiop, struct ucred *cred)
return EINVAL;
/* if (uiop->uio_offset + uiop->uio_resid > smp->nm_maxfilesize)
return EFBIG;*/
p = uiop->uio_procp;
td = uiop->uio_td;
if (vp->v_type == VDIR) {
lks = LK_EXCLUSIVE;/*lockstatus(&vp->v_lock, p);*/
lks = LK_EXCLUSIVE;/*lockstatus(&vp->v_lock, td);*/
if (lks == LK_SHARED)
vn_lock(vp, LK_UPGRADE | LK_RETRY, p);
vn_lock(vp, LK_UPGRADE | LK_RETRY, td);
error = smbfs_readvdir(vp, uiop, cred);
if (lks == LK_SHARED)
vn_lock(vp, LK_DOWNGRADE | LK_RETRY, p);
vn_lock(vp, LK_DOWNGRADE | LK_RETRY, td);
return error;
}
/* biosize = SSTOCN(smp->sm_share)->sc_txmax;*/
if (np->n_flag & NMODIFIED) {
smbfs_attr_cacheremove(vp);
error = VOP_GETATTR(vp, &vattr, cred, p);
error = VOP_GETATTR(vp, &vattr, cred, td);
if (error)
return error;
np->n_mtime.tv_sec = vattr.va_mtime.tv_sec;
} else {
error = VOP_GETATTR(vp, &vattr, cred, p);
error = VOP_GETATTR(vp, &vattr, cred, td);
if (error)
return error;
if (np->n_mtime.tv_sec != vattr.va_mtime.tv_sec) {
error = smbfs_vinvalbuf(vp, V_SAVE, cred, p, 1);
error = smbfs_vinvalbuf(vp, V_SAVE, cred, td, 1);
if (error)
return error;
np->n_mtime.tv_sec = vattr.va_mtime.tv_sec;
}
}
smb_makescred(&scred, p, cred);
smb_makescred(&scred, td, cred);
return smb_read(smp->sm_share, np->n_fid, uiop, &scred);
}
@ -239,6 +239,7 @@ smbfs_writevnode(struct vnode *vp, struct uio *uiop,
struct smbnode *np = VTOSMB(vp);
struct smb_cred scred;
struct proc *p;
struct thread *td;
int error = 0;
if (vp->v_type != VREG) {
@ -250,11 +251,12 @@ smbfs_writevnode(struct vnode *vp, struct uio *uiop,
return EINVAL;
/* if (uiop->uio_offset + uiop->uio_resid > smp->nm_maxfilesize)
return (EFBIG);*/
p = uiop->uio_procp;
td = uiop->uio_td;
p = td->td_proc;
if (ioflag & (IO_APPEND | IO_SYNC)) {
if (np->n_flag & NMODIFIED) {
smbfs_attr_cacheremove(vp);
error = smbfs_vinvalbuf(vp, V_SAVE, cred, p, 1);
error = smbfs_vinvalbuf(vp, V_SAVE, cred, td, 1);
if (error)
return error;
}
@ -264,7 +266,7 @@ smbfs_writevnode(struct vnode *vp, struct uio *uiop,
* File size can be changed by another client
*/
smbfs_attr_cacheremove(vp);
error = VOP_GETATTR(vp, &vattr, cred, p);
error = VOP_GETATTR(vp, &vattr, cred, td);
if (error) return (error);
#endif
uiop->uio_offset = np->n_size;
@ -273,12 +275,12 @@ smbfs_writevnode(struct vnode *vp, struct uio *uiop,
if (uiop->uio_resid == 0)
return 0;
if (p && uiop->uio_offset + uiop->uio_resid > p->p_rlimit[RLIMIT_FSIZE].rlim_cur) {
PROC_LOCK(p);
psignal(p, SIGXFSZ);
PROC_UNLOCK(p);
PROC_LOCK(td->td_proc);
psignal(td->td_proc, SIGXFSZ);
PROC_UNLOCK(td->td_proc);
return EFBIG;
}
smb_makescred(&scred, p, cred);
smb_makescred(&scred, td, cred);
error = smb_write(smp->sm_share, np->n_fid, uiop, &scred);
SMBVDEBUG("after: ofs=%d,resid=%d\n",(int)uiop->uio_offset, uiop->uio_resid);
if (!error) {
@ -294,7 +296,7 @@ smbfs_writevnode(struct vnode *vp, struct uio *uiop,
* Do an I/O operation to/from a cache block.
*/
int
smbfs_doio(struct buf *bp, struct ucred *cr, struct proc *p)
smbfs_doio(struct buf *bp, struct ucred *cr, struct thread *td)
{
struct vnode *vp = bp->b_vp;
struct smbmount *smp = VFSTOSMBFS(vp->v_mount);
@ -307,9 +309,9 @@ smbfs_doio(struct buf *bp, struct ucred *cr, struct proc *p)
uiop->uio_iov = &io;
uiop->uio_iovcnt = 1;
uiop->uio_segflg = UIO_SYSSPACE;
uiop->uio_procp = p;
uiop->uio_td = td;
smb_makescred(&scred, p, cr);
smb_makescred(&scred, td, cr);
if (bp->b_iocmd == BIO_READ) {
io.iov_len = uiop->uio_resid = bp->b_bcount;
@ -418,7 +420,7 @@ smbfs_getpages(ap)
vm_offset_t kva;
struct buf *bp;
struct vnode *vp;
struct proc *p;
struct thread *td;
struct ucred *cred;
struct smbmount *smp;
struct smbnode *np;
@ -426,8 +428,8 @@ smbfs_getpages(ap)
vm_page_t *pages;
vp = ap->a_vp;
p = curproc; /* XXX */
cred = curproc->p_ucred; /* XXX */
td = curthread; /* XXX */
cred = td->td_proc->p_ucred; /* XXX */
np = VTOSMB(vp);
smp = VFSTOSMBFS(vp->v_mount);
pages = ap->a_m;
@ -437,7 +439,7 @@ smbfs_getpages(ap)
printf("smbfs_getpages: called with non-merged cache vnode??\n");
return VM_PAGER_ERROR;
}
smb_makescred(&scred, p, cred);
smb_makescred(&scred, td, cred);
#if __FreeBSD_version >= 400000
bp = getpbuf(&smbfs_pbuf_freecnt);
@ -458,7 +460,7 @@ smbfs_getpages(ap)
uio.uio_resid = count;
uio.uio_segflg = UIO_SYSSPACE;
uio.uio_rw = UIO_READ;
uio.uio_procp = p;
uio.uio_td = td;
error = smb_read(smp->sm_share, np->n_fid, &uio, &scred);
pmap_qremove(kva, npages);
@ -542,15 +544,15 @@ smbfs_putpages(ap)
{
int error;
struct vnode *vp = ap->a_vp;
struct proc *p;
struct thread *td;
struct ucred *cred;
#ifdef SMBFS_RWGENERIC
p = curproc; /* XXX */
cred = p->p_ucred; /* XXX */
VOP_OPEN(vp, FWRITE, cred, p);
td = curthread; /* XXX */
cred = td->td_proc->p_ucred; /* XXX */
VOP_OPEN(vp, FWRITE, cred, td);
error = vop_stdputpages(ap);
VOP_CLOSE(vp, FWRITE, cred, p);
VOP_CLOSE(vp, FWRITE, cred, td);
return error;
#else
struct uio uio;
@ -564,9 +566,9 @@ smbfs_putpages(ap)
struct smb_cred scred;
vm_page_t *pages;
p = curproc; /* XXX */
cred = p->p_ucred; /* XXX */
/* VOP_OPEN(vp, FWRITE, cred, p);*/
td = curthread; /* XXX */
cred = td->td_proc->p_ucred; /* XXX */
/* VOP_OPEN(vp, FWRITE, cred, td);*/
np = VTOSMB(vp);
smp = VFSTOSMBFS(vp->v_mount);
pages = ap->a_m;
@ -596,12 +598,12 @@ smbfs_putpages(ap)
uio.uio_resid = count;
uio.uio_segflg = UIO_SYSSPACE;
uio.uio_rw = UIO_WRITE;
uio.uio_procp = p;
uio.uio_td = td;
SMBVDEBUG("ofs=%d,resid=%d\n",(int)uio.uio_offset, uio.uio_resid);
smb_makescred(&scred, p, cred);
smb_makescred(&scred, td, cred);
error = smb_write(smp->sm_share, np->n_fid, &uio, &scred);
/* VOP_CLOSE(vp, FWRITE, cred, p);*/
/* VOP_CLOSE(vp, FWRITE, cred, td);*/
SMBVDEBUG("paged write done: %d\n", error);
pmap_qremove(kva, npages);
@ -627,11 +629,11 @@ smbfs_putpages(ap)
* doing the flush, just wait for completion.
*/
int
smbfs_vinvalbuf(vp, flags, cred, p, intrflg)
smbfs_vinvalbuf(vp, flags, cred, td, intrflg)
struct vnode *vp;
int flags;
struct ucred *cred;
struct proc *p;
struct thread *td;
int intrflg;
{
struct smbnode *np = VTOSMB(vp);
@ -649,12 +651,12 @@ smbfs_vinvalbuf(vp, flags, cred, p, intrflg)
while (np->n_flag & NFLUSHINPROG) {
np->n_flag |= NFLUSHWANT;
error = tsleep((caddr_t)&np->n_flag, PRIBIO + 2, "smfsvinv", slptimeo);
error = smb_proc_intr(p);
error = smb_proc_intr(td->td_proc);
if (error == EINTR && intrflg)
return EINTR;
}
np->n_flag |= NFLUSHINPROG;
error = vinvalbuf(vp, flags, cred, p, slpflag, 0);
error = vinvalbuf(vp, flags, cred, td, slpflag, 0);
while (error) {
if (intrflg && (error == ERESTART || error == EINTR)) {
np->n_flag &= ~NFLUSHINPROG;
@ -664,7 +666,7 @@ smbfs_vinvalbuf(vp, flags, cred, p, intrflg)
}
return EINTR;
}
error = vinvalbuf(vp, flags, cred, p, slpflag, 0);
error = vinvalbuf(vp, flags, cred, td, slpflag, 0);
}
np->n_flag &= ~(NMODIFIED | NFLUSHINPROG);
if (np->n_flag & NFLUSHWANT) {

View File

@ -57,8 +57,8 @@
#include <fs/smbfs/smbfs_subr.h>
#define SMBFS_NOHASH(smp, hval) (&(smp)->sm_hash[(hval) & (smp)->sm_hashlen])
#define smbfs_hash_lock(smp, p) lockmgr(&smp->sm_hashlock, LK_EXCLUSIVE, NULL, p)
#define smbfs_hash_unlock(smp, p) lockmgr(&smp->sm_hashlock, LK_RELEASE, NULL, p)
#define smbfs_hash_lock(smp, td) lockmgr(&smp->sm_hashlock, LK_EXCLUSIVE, NULL, td)
#define smbfs_hash_unlock(smp, td) lockmgr(&smp->sm_hashlock, LK_RELEASE, NULL, td)
extern vop_t **smbfs_vnodeop_p;
@ -164,7 +164,7 @@ static int
smbfs_node_alloc(struct mount *mp, struct vnode *dvp,
const char *name, int nmlen, struct smbfattr *fap, struct vnode **vpp)
{
struct proc *p = curproc; /* XXX */
struct thread *td = curthread; /* XXX */
struct smbmount *smp = VFSTOSMBFS(mp);
struct smbnode_hashhead *nhpp;
struct smbnode *np, *np2, *dnp;
@ -181,7 +181,7 @@ smbfs_node_alloc(struct mount *mp, struct vnode *dvp,
if (dvp == NULL)
return EINVAL;
vp = VTOSMB(dvp)->n_parent->n_vnode;
error = vget(vp, LK_EXCLUSIVE, p);
error = vget(vp, LK_EXCLUSIVE, td);
if (error == 0)
*vpp = vp;
return error;
@ -196,7 +196,7 @@ smbfs_node_alloc(struct mount *mp, struct vnode *dvp,
}
hashval = smbfs_hash(name, nmlen);
retry:
smbfs_hash_lock(smp, p);
smbfs_hash_lock(smp, td);
loop:
nhpp = SMBFS_NOHASH(smp, hashval);
LIST_FOREACH(np, nhpp, n_hash) {
@ -205,13 +205,13 @@ loop:
np->n_nmlen != nmlen || bcmp(name, np->n_name, nmlen) != 0)
continue;
VI_LOCK(vp);
smbfs_hash_unlock(smp, p);
if (vget(vp, LK_EXCLUSIVE | LK_INTERLOCK, p) != 0)
smbfs_hash_unlock(smp, td);
if (vget(vp, LK_EXCLUSIVE | LK_INTERLOCK, td) != 0)
goto retry;
*vpp = vp;
return 0;
}
smbfs_hash_unlock(smp, p);
smbfs_hash_unlock(smp, td);
/*
* If we don't have node attributes, then it is an explicit lookup
* for an existing vnode.
@ -244,9 +244,9 @@ loop:
SMBERROR("new vnode '%s' born without parent ?\n", np->n_name);
lockinit(&vp->v_lock, PINOD, "smbnode", 0, LK_CANRECURSE);
vn_lock(vp, LK_EXCLUSIVE | LK_RETRY, p);
vn_lock(vp, LK_EXCLUSIVE | LK_RETRY, td);
smbfs_hash_lock(smp, p);
smbfs_hash_lock(smp, td);
LIST_FOREACH(np2, nhpp, n_hash) {
if (np2->n_parent != dnp ||
np2->n_nmlen != nmlen || bcmp(name, np2->n_name, nmlen) != 0)
@ -257,7 +257,7 @@ loop:
goto loop;
}
LIST_INSERT_HEAD(nhpp, np, n_hash);
smbfs_hash_unlock(smp, p);
smbfs_hash_unlock(smp, td);
*vpp = vp;
return 0;
}
@ -288,18 +288,18 @@ int
smbfs_reclaim(ap)
struct vop_reclaim_args /* {
struct vnode *a_vp;
struct proc *a_p;
struct thread *a_p;
} */ *ap;
{
struct vnode *vp = ap->a_vp;
struct proc *p = ap->a_p;
struct thread *td = ap->a_td;
struct vnode *dvp;
struct smbnode *np = VTOSMB(vp);
struct smbmount *smp = VTOSMBFS(vp);
SMBVDEBUG("%s,%d\n", np->n_name, vp->v_usecount);
smbfs_hash_lock(smp, p);
smbfs_hash_lock(smp, td);
dvp = (np->n_parent && (np->n_flag & NREFPARENT)) ?
np->n_parent->n_vnode : NULL;
@ -312,7 +312,7 @@ smbfs_reclaim(ap)
smp->sm_root = NULL;
}
vp->v_data = NULL;
smbfs_hash_unlock(smp, p);
smbfs_hash_unlock(smp, td);
if (np->n_name)
smbfs_name_free(np->n_name);
FREE(np, M_SMBNODE);
@ -333,11 +333,11 @@ int
smbfs_inactive(ap)
struct vop_inactive_args /* {
struct vnode *a_vp;
struct proc *a_p;
struct thread *a_td;
} */ *ap;
{
struct proc *p = ap->a_p;
struct ucred *cred = p->p_ucred;
struct thread *td = ap->a_td;
struct ucred *cred = td->td_proc->p_ucred;
struct vnode *vp = ap->a_vp;
struct smbnode *np = VTOSMB(vp);
struct smb_cred scred;
@ -345,13 +345,13 @@ smbfs_inactive(ap)
SMBVDEBUG("%s: %d\n", VTOSMB(vp)->n_name, vp->v_usecount);
if (np->n_opencount) {
error = smbfs_vinvalbuf(vp, V_SAVE, cred, p, 1);
smb_makescred(&scred, p, cred);
error = smbfs_vinvalbuf(vp, V_SAVE, cred, td, 1);
smb_makescred(&scred, td, cred);
error = smbfs_smb_close(np->n_mount->sm_share, np->n_fid,
&np->n_mtime, &scred);
np->n_opencount = 0;
}
VOP_UNLOCK(vp, 0, p);
VOP_UNLOCK(vp, 0, td);
return (0);
}
/*

View File

@ -78,13 +78,13 @@ static MALLOC_DEFINE(M_SMBFSHASH, "SMBFS hash", "SMBFS hash table");
static int smbfs_mount(struct mount *, char *, caddr_t,
struct nameidata *, struct proc *);
static int smbfs_quotactl(struct mount *, int, uid_t, caddr_t, struct proc *);
struct nameidata *, struct thread *);
static int smbfs_quotactl(struct mount *, int, uid_t, caddr_t, struct thread *);
static int smbfs_root(struct mount *, struct vnode **);
static int smbfs_start(struct mount *, int, struct proc *);
static int smbfs_statfs(struct mount *, struct statfs *, struct proc *);
static int smbfs_sync(struct mount *, int, struct ucred *, struct proc *);
static int smbfs_unmount(struct mount *, int, struct proc *);
static int smbfs_start(struct mount *, int, struct thread *);
static int smbfs_statfs(struct mount *, struct statfs *, struct thread *);
static int smbfs_sync(struct mount *, int, struct ucred *, struct thread *);
static int smbfs_unmount(struct mount *, int, struct thread *);
static int smbfs_init(struct vfsconf *vfsp);
static int smbfs_uninit(struct vfsconf *vfsp);
@ -134,7 +134,7 @@ int smbfs_pbuf_freecnt = -1; /* start out unlimited */
static int
smbfs_mount(struct mount *mp, char *path, caddr_t data,
struct nameidata *ndp, struct proc *p)
struct nameidata *ndp, struct thread *td)
{
struct smbfs_args args; /* will hold data from mount request */
struct smbmount *smp = NULL;
@ -164,14 +164,14 @@ smbfs_mount(struct mount *mp, char *path, caddr_t data,
SMBFS_VERSION, args.version);
return EINVAL;
}
smb_makescred(&scred, p, p->p_ucred);
smb_makescred(&scred, td, td->td_proc->p_ucred);
error = smb_dev2share(args.dev, SMBM_EXEC, &scred, &ssp);
if (error) {
printf("invalid device handle %d (%d)\n", args.dev, error);
return error;
}
vcp = SSTOVC(ssp);
smb_share_unlock(ssp, 0, p);
smb_share_unlock(ssp, 0, td);
mp->mnt_stat.f_iosize = SSTOVC(ssp)->vc_txmax;
#ifdef SMBFS_USEZONE
@ -226,7 +226,7 @@ smbfs_mount(struct mount *mp, char *path, caddr_t data,
error = smbfs_root(mp, &vp);
if (error)
goto bad;
VOP_UNLOCK(vp, 0, p);
VOP_UNLOCK(vp, 0, td);
SMBVDEBUG("root.v_usecount = %d\n", vp->v_usecount);
#ifdef DIAGNOSTICS
@ -251,7 +251,7 @@ bad:
/* Unmount the filesystem described by mp. */
static int
smbfs_unmount(struct mount *mp, int mntflags, struct proc *p)
smbfs_unmount(struct mount *mp, int mntflags, struct thread *td)
{
struct smbmount *smp = VFSTOSMBFS(mp);
struct smb_cred scred;
@ -265,7 +265,7 @@ smbfs_unmount(struct mount *mp, int mntflags, struct proc *p)
error = vflush(mp, 1, flags);
if (error)
return error;
smb_makescred(&scred, p, p->p_ucred);
smb_makescred(&scred, td, td->td_proc->p_ucred);
smb_share_put(smp->sm_share, &scred);
mp->mnt_data = (qaddr_t)0;
@ -291,8 +291,8 @@ smbfs_root(struct mount *mp, struct vnode **vpp)
struct vnode *vp;
struct smbnode *np;
struct smbfattr fattr;
struct proc *p = curproc;
struct ucred *cred = p->p_ucred;
struct thread *td = curthread;
struct ucred *cred = td->td_proc->p_ucred;
struct smb_cred scred;
int error;
@ -302,9 +302,9 @@ smbfs_root(struct mount *mp, struct vnode **vpp)
}
if (smp->sm_root) {
*vpp = SMBTOV(smp->sm_root);
return vget(*vpp, LK_EXCLUSIVE | LK_RETRY, p);
return vget(*vpp, LK_EXCLUSIVE | LK_RETRY, td);
}
smb_makescred(&scred, p, cred);
smb_makescred(&scred, td, cred);
error = smbfs_smb_lookup(NULL, NULL, 0, &fattr, &scred);
if (error)
return error;
@ -323,10 +323,10 @@ smbfs_root(struct mount *mp, struct vnode **vpp)
*/
/* ARGSUSED */
static int
smbfs_start(mp, flags, p)
smbfs_start(mp, flags, td)
struct mount *mp;
int flags;
struct proc *p;
struct thread *td;
{
SMBVDEBUG("flags=%04x\n", flags);
return 0;
@ -337,12 +337,12 @@ smbfs_start(mp, flags, p)
*/
/* ARGSUSED */
static int
smbfs_quotactl(mp, cmd, uid, arg, p)
smbfs_quotactl(mp, cmd, uid, arg, td)
struct mount *mp;
int cmd;
uid_t uid;
caddr_t arg;
struct proc *p;
struct thread *td;
{
SMBVDEBUG("return EOPNOTSUPP\n");
return EOPNOTSUPP;
@ -358,7 +358,7 @@ smbfs_init(struct vfsconf *vfsp)
name[0] = CTL_HW;
name[1] = HW_NCPU;
error = kernel_sysctl(curproc, name, 2, &ncpu, &olen, NULL, 0, &plen);
error = kernel_sysctl(curthread, name, 2, &ncpu, &olen, NULL, 0, &plen);
if (error == 0 && ncpu > 1)
printf("warning: smbfs module compiled without SMP support.");
#endif
@ -384,7 +384,7 @@ smbfs_uninit(struct vfsconf *vfsp)
* smbfs_statfs call
*/
int
smbfs_statfs(struct mount *mp, struct statfs *sbp, struct proc *p)
smbfs_statfs(struct mount *mp, struct statfs *sbp, struct thread *td)
{
struct smbmount *smp = VFSTOSMBFS(mp);
struct smbnode *np = smp->sm_root;
@ -397,7 +397,7 @@ smbfs_statfs(struct mount *mp, struct statfs *sbp, struct proc *p)
sbp->f_iosize = SSTOVC(ssp)->vc_txmax; /* optimal transfer block size */
sbp->f_spare2 = 0; /* placeholder */
smb_makescred(&scred, p, p->p_ucred);
smb_makescred(&scred, td, td->td_proc->p_ucred);
if (SMB_DIALECT(SSTOVC(ssp)) >= SMB_DIALECT_LANMAN2_0)
error = smbfs_smb_statfs2(ssp, sbp, &scred);
@ -422,11 +422,11 @@ smbfs_statfs(struct mount *mp, struct statfs *sbp, struct proc *p)
*/
/* ARGSUSED */
static int
smbfs_sync(mp, waitfor, cred, p)
smbfs_sync(mp, waitfor, cred, td)
struct mount *mp;
int waitfor;
struct ucred *cred;
struct proc *p;
struct thread *td;
{
struct vnode *vp;
int error, allerror = 0;
@ -450,9 +450,9 @@ loop:
#endif
waitfor == MNT_LAZY)
continue;
if (vget(vp, LK_EXCLUSIVE, p))
if (vget(vp, LK_EXCLUSIVE, td))
goto loop;
error = VOP_FSYNC(vp, cred, waitfor, p);
error = VOP_FSYNC(vp, cred, waitfor, td);
if (error)
allerror = error;
vput(vp);

View File

@ -139,7 +139,7 @@ smbfs_access(ap)
struct vnode *a_vp;
int a_mode;
struct ucred *a_cred;
struct proc *a_p;
struct thread *a_td;
} */ *ap;
{
struct vnode *vp = ap->a_vp;
@ -175,7 +175,7 @@ smbfs_open(ap)
struct vnode *a_vp;
int a_mode;
struct ucred *a_cred;
struct proc *a_p;
struct thread *a_td;
} */ *ap;
{
struct vnode *vp = ap->a_vp;
@ -195,19 +195,19 @@ smbfs_open(ap)
return 0;
}
if (np->n_flag & NMODIFIED) {
if ((error = smbfs_vinvalbuf(vp, V_SAVE, ap->a_cred, ap->a_p, 1)) == EINTR)
if ((error = smbfs_vinvalbuf(vp, V_SAVE, ap->a_cred, ap->a_td, 1)) == EINTR)
return error;
smbfs_attr_cacheremove(vp);
error = VOP_GETATTR(vp, &vattr, ap->a_cred, ap->a_p);
error = VOP_GETATTR(vp, &vattr, ap->a_cred, ap->a_td);
if (error)
return error;
np->n_mtime.tv_sec = vattr.va_mtime.tv_sec;
} else {
error = VOP_GETATTR(vp, &vattr, ap->a_cred, ap->a_p);
error = VOP_GETATTR(vp, &vattr, ap->a_cred, ap->a_td);
if (error)
return error;
if (np->n_mtime.tv_sec != vattr.va_mtime.tv_sec) {
error = smbfs_vinvalbuf(vp, V_SAVE, ap->a_cred, ap->a_p, 1);
error = smbfs_vinvalbuf(vp, V_SAVE, ap->a_cred, ap->a_td, 1);
if (error == EINTR)
return error;
np->n_mtime.tv_sec = vattr.va_mtime.tv_sec;
@ -220,7 +220,7 @@ smbfs_open(ap)
accmode = SMB_AM_OPENREAD;
if ((vp->v_mount->mnt_flag & MNT_RDONLY) == 0)
accmode = SMB_AM_OPENRW;
smb_makescred(&scred, ap->a_p, ap->a_cred);
smb_makescred(&scred, ap->a_td, ap->a_cred);
error = smbfs_smb_open(np, accmode, &scred);
if (error) {
if (mode & FWRITE)
@ -240,14 +240,14 @@ smbfs_closel(struct vop_close_args *ap)
{
struct vnode *vp = ap->a_vp;
struct smbnode *np = VTOSMB(vp);
struct proc *p = ap->a_p;
struct thread *td = ap->a_td;
struct smb_cred scred;
struct vattr vattr;
int error;
SMBVDEBUG("name=%s, pid=%d, c=%d\n",np->n_name, p->p_pid, np->n_opencount);
SMBVDEBUG("name=%s, pid=%d, c=%d\n",np->n_name, td->td_pid, np->n_opencount);
smb_makescred(&scred, p, ap->a_cred);
smb_makescred(&scred, td, ap->a_cred);
if (np->n_opencount == 0) {
SMBERROR("Negative opencount\n");
@ -263,10 +263,10 @@ smbfs_closel(struct vop_close_args *ap)
}
error = 0;
} else {
error = smbfs_vinvalbuf(vp, V_SAVE, ap->a_cred, p, 1);
error = smbfs_vinvalbuf(vp, V_SAVE, ap->a_cred, td, 1);
if (np->n_opencount)
return error;
VOP_GETATTR(vp, &vattr, ap->a_cred, p);
VOP_GETATTR(vp, &vattr, ap->a_cred, td);
error = smbfs_smb_close(np->n_mount->sm_share, np->n_fid,
&np->n_mtime, &scred);
}
@ -285,22 +285,22 @@ smbfs_close(ap)
struct vnode *a_vp;
int a_fflag;
struct ucred *a_cred;
struct proc *a_p;
struct thread *a_td;
} */ *ap;
{
struct vnode *vp = ap->a_vp;
struct proc *p = ap->a_p;
struct thread *td = ap->a_td;
int error, dolock;
VI_LOCK(vp);
dolock = (vp->v_flag & VXLOCK) == 0;
if (dolock)
vn_lock(vp, LK_EXCLUSIVE | LK_RETRY | LK_INTERLOCK, p);
vn_lock(vp, LK_EXCLUSIVE | LK_RETRY | LK_INTERLOCK, td);
else
VI_UNLOCK(vp);
error = smbfs_closel(ap);
if (dolock)
VOP_UNLOCK(vp, 0, p);
VOP_UNLOCK(vp, 0, td);
return error;
}
@ -313,7 +313,7 @@ smbfs_getattr(ap)
struct vnode *a_vp;
struct vattr *a_vap;
struct ucred *a_cred;
struct proc *a_p;
struct thread *a_td;
} */ *ap;
{
struct vnode *vp = ap->a_vp;
@ -329,7 +329,7 @@ smbfs_getattr(ap)
if (!error)
return 0;
SMBVDEBUG("not in the cache\n");
smb_makescred(&scred, ap->a_p, ap->a_cred);
smb_makescred(&scred, ap->a_td, ap->a_cred);
oldsize = np->n_size;
error = smbfs_smb_lookup(np, NULL, 0, &fattr, &scred);
if (error) {
@ -349,7 +349,7 @@ smbfs_setattr(ap)
struct vnode *a_vp;
struct vattr *a_vap;
struct ucred *a_cred;
struct proc *a_p;
struct thread *a_td;
} */ *ap;
{
struct vnode *vp = ap->a_vp;
@ -373,7 +373,7 @@ smbfs_setattr(ap)
vap->va_atime.tv_sec != VNOVAL || vap->va_mtime.tv_sec != VNOVAL ||
vap->va_mode != (mode_t)VNOVAL) && isreadonly)
return EROFS;
smb_makescred(&scred, ap->a_p, ap->a_cred);
smb_makescred(&scred, ap->a_td, ap->a_cred);
if (vap->va_size != VNOVAL) {
switch (vp->v_type) {
case VDIR:
@ -422,13 +422,13 @@ smbfs_setattr(ap)
*/
if (np->n_opencount == 0) {
if (vcp->vc_flags & SMBV_WIN95) {
error = VOP_OPEN(vp, FWRITE, ap->a_cred, ap->a_p);
error = VOP_OPEN(vp, FWRITE, ap->a_cred, ap->a_td);
if (!error) {
/* error = smbfs_smb_setfattrNT(np, 0, mtime, atime, &scred);
VOP_GETATTR(vp, &vattr, ap->a_cred, ap->a_p);*/
VOP_GETATTR(vp, &vattr, ap->a_cred, ap->a_td);*/
if (mtime)
np->n_mtime = *mtime;
VOP_CLOSE(vp, FWRITE, ap->a_cred, ap->a_p);
VOP_CLOSE(vp, FWRITE, ap->a_cred, ap->a_td);
}
} else if ((vcp->vc_sopt.sv_caps & SMB_CAP_NT_SMBS)) {
error = smbfs_smb_setptime2(np, mtime, atime, 0, &scred);
@ -458,7 +458,7 @@ smbfs_setattr(ap)
* required attributes.
*/
smbfs_attr_cacheremove(vp); /* invalidate cache */
VOP_GETATTR(vp, vap, ap->a_cred, ap->a_p);
VOP_GETATTR(vp, vap, ap->a_cred, ap->a_td);
np->n_mtime.tv_sec = vap->va_mtime.tv_sec;
return error;
}
@ -534,9 +534,9 @@ smbfs_create(ap)
*vpp = NULL;
if (vap->va_type != VREG)
return EOPNOTSUPP;
if ((error = VOP_GETATTR(dvp, &vattr, cnp->cn_cred, cnp->cn_proc)))
if ((error = VOP_GETATTR(dvp, &vattr, cnp->cn_cred, cnp->cn_thread)))
return error;
smb_makescred(&scred, cnp->cn_proc, cnp->cn_cred);
smb_makescred(&scred, cnp->cn_thread, cnp->cn_cred);
error = smbfs_smb_create(dnp, name, nmlen, &scred);
if (error)
@ -571,7 +571,7 @@ smbfs_remove(ap)
if (vp->v_type == VDIR || np->n_opencount || vp->v_usecount != 1)
return EPERM;
smb_makescred(&scred, cnp->cn_proc, cnp->cn_cred);
smb_makescred(&scred, cnp->cn_thread, cnp->cn_cred);
error = smbfs_smb_delete(np, &scred);
cache_purge(vp);
return error;
@ -619,7 +619,7 @@ smbfs_rename(ap)
flags |= 1;
} else
return EINVAL;
smb_makescred(&scred, tcnp->cn_proc, tcnp->cn_cred);
smb_makescred(&scred, tcnp->cn_thread, tcnp->cn_cred);
/*
* It seems that Samba doesn't implement SMB_COM_MOVE call...
*/
@ -726,12 +726,12 @@ smbfs_mkdir(ap)
int len = cnp->cn_namelen;
int error;
if ((error = VOP_GETATTR(dvp, &vattr, cnp->cn_cred, cnp->cn_proc))) {
if ((error = VOP_GETATTR(dvp, &vattr, cnp->cn_cred, cnp->cn_thread))) {
return error;
}
if ((name[0] == '.') && ((len == 1) || ((len == 2) && (name[1] == '.'))))
return EEXIST;
smb_makescred(&scred, cnp->cn_proc, cnp->cn_cred);
smb_makescred(&scred, cnp->cn_thread, cnp->cn_cred);
error = smbfs_smb_mkdir(dnp, name, len, &scred);
if (error)
return error;
@ -768,7 +768,7 @@ smbfs_rmdir(ap)
if (dvp == vp)
return EINVAL;
smb_makescred(&scred, cnp->cn_proc, cnp->cn_cred);
smb_makescred(&scred, cnp->cn_thread, cnp->cn_cred);
error = smbfs_smb_rmdir(np, &scred);
dnp->n_flag |= NMODIFIED;
smbfs_attr_cacheremove(dvp);
@ -815,10 +815,10 @@ smbfs_fsync(ap)
struct vnode * a_vp;
struct ucred * a_cred;
int a_waitfor;
struct proc * a_p;
struct thread * a_td;
} */ *ap;
{
/* return (smb_flush(ap->a_vp, ap->a_cred, ap->a_waitfor, ap->a_p, 1));*/
/* return (smb_flush(ap->a_vp, ap->a_cred, ap->a_waitfor, ap->a_td, 1));*/
return (0);
}
@ -880,23 +880,23 @@ smbfs_strategy (ap)
{
struct buf *bp=ap->a_bp;
struct ucred *cr;
struct proc *p;
struct thread *td;
int error = 0;
SMBVDEBUG("\n");
if (bp->b_flags & B_PHYS)
panic("smbfs physio");
if (bp->b_flags & B_ASYNC)
p = (struct proc *)0;
td = (struct thread *)0;
else
p = curproc; /* XXX */
td = curthread; /* XXX */
if (bp->b_iocmd == BIO_READ)
cr = bp->b_rcred;
else
cr = bp->b_wcred;
if ((bp->b_flags & B_ASYNC) == 0 )
error = smbfs_doio(bp, cr, p);
error = smbfs_doio(bp, cr, td);
return error;
}
@ -908,7 +908,7 @@ smbfs_ioctl(ap)
caddr_t a_data;
int fflag;
struct ucred *cred;
struct proc *p;
struct thread *td;
} */ *ap;
{
return EINVAL;
@ -922,12 +922,12 @@ smbfs_getextattr(struct vop_getextattr_args *ap)
IN char *a_name;
INOUT struct uio *a_uio;
IN struct ucred *a_cred;
IN struct proc *a_p;
IN struct thread *a_td;
};
*/
{
struct vnode *vp = ap->a_vp;
struct proc *p = ap->a_p;
struct thread *td = ap->a_td;
struct ucred *cred = ap->a_cred;
struct uio *uio = ap->a_uio;
const char *name = ap->a_name;
@ -936,10 +936,10 @@ smbfs_getextattr(struct vop_getextattr_args *ap)
char buf[10];
int i, attr, error;
error = VOP_ACCESS(vp, VREAD, cred, p);
error = VOP_ACCESS(vp, VREAD, cred, td);
if (error)
return error;
error = VOP_GETATTR(vp, &vattr, cred, p);
error = VOP_GETATTR(vp, &vattr, cred, td);
if (error)
return error;
if (strcmp(name, "dosattr") == 0) {
@ -974,7 +974,8 @@ smbfs_advlock(ap)
struct flock *fl = ap->a_fl;
caddr_t id = (caddr_t)1 /* ap->a_id */;
/* int flags = ap->a_flags;*/
struct proc *p = curproc;
struct thread *td = curthread;
struct proc *p = td ? td->td_proc : NULL;
struct smb_cred scred;
u_quad_t size;
off_t start, end, oadd;
@ -1025,7 +1026,7 @@ smbfs_advlock(ap)
return EOVERFLOW;
end = start + oadd;
}
smb_makescred(&scred, p, p ? p->p_ucred : NULL);
smb_makescred(&scred, td, p ? p->p_ucred : NULL);
switch (ap->a_op) {
case F_SETLK:
switch (fl->l_type) {
@ -1116,7 +1117,7 @@ smbfs_lookup(ap)
} */ *ap;
{
struct componentname *cnp = ap->a_cnp;
struct proc *p = cnp->cn_proc;
struct thread *td = cnp->cn_thread;
struct vnode *dvp = ap->a_dvp;
struct vnode **vpp = ap->a_vpp;
struct vnode *vp;
@ -1154,7 +1155,7 @@ smbfs_lookup(ap)
islastcn = flags & ISLASTCN;
if (islastcn && (mp->mnt_flag & MNT_RDONLY) && (nameiop != LOOKUP))
return EROFS;
if ((error = VOP_ACCESS(dvp, VEXEC, cnp->cn_cred, p)) != 0)
if ((error = VOP_ACCESS(dvp, VEXEC, cnp->cn_cred, td)) != 0)
return error;
lockparent = flags & LOCKPARENT;
wantparent = flags & (LOCKPARENT|WANTPARENT);
@ -1182,24 +1183,24 @@ smbfs_lookup(ap)
error = 0;
SMBVDEBUG("cached '.'\n");
} else if (flags & ISDOTDOT) {
VOP_UNLOCK(dvp, 0, p); /* unlock parent */
VOP_UNLOCK(dvp, 0, td); /* unlock parent */
cnp->cn_flags |= PDIRUNLOCK;
error = vget(vp, LK_EXCLUSIVE, p);
error = vget(vp, LK_EXCLUSIVE, td);
if (!error && lockparent && islastcn) {
error = vn_lock(dvp, LK_EXCLUSIVE, p);
error = vn_lock(dvp, LK_EXCLUSIVE, td);
if (error == 0)
cnp->cn_flags &= ~PDIRUNLOCK;
}
} else {
error = vget(vp, LK_EXCLUSIVE, p);
error = vget(vp, LK_EXCLUSIVE, td);
if (!lockparent || error || !islastcn) {
VOP_UNLOCK(dvp, 0, p);
VOP_UNLOCK(dvp, 0, td);
cnp->cn_flags |= PDIRUNLOCK;
}
}
if (!error) {
if (vpid == vp->v_id) {
if (!VOP_GETATTR(vp, &vattr, cnp->cn_cred, p)
if (!VOP_GETATTR(vp, &vattr, cnp->cn_cred, td)
/* && vattr.va_ctime.tv_sec == VTOSMB(vp)->n_ctime*/) {
if (nameiop != LOOKUP && islastcn)
cnp->cn_flags |= SAVENAME;
@ -1210,9 +1211,9 @@ smbfs_lookup(ap)
}
vput(vp);
if (lockparent && dvp != vp && islastcn)
VOP_UNLOCK(dvp, 0, p);
VOP_UNLOCK(dvp, 0, td);
}
error = vn_lock(dvp, LK_EXCLUSIVE, p);
error = vn_lock(dvp, LK_EXCLUSIVE, td);
*vpp = NULLVP;
if (error) {
cnp->cn_flags |= PDIRUNLOCK;
@ -1225,7 +1226,7 @@ smbfs_lookup(ap)
*/
error = 0;
*vpp = NULLVP;
smb_makescred(&scred, p, cnp->cn_cred);
smb_makescred(&scred, td, cnp->cn_cred);
fap = &fattr;
if (flags & ISDOTDOT) {
error = smbfs_smb_lookup(dnp->n_parent, NULL, 0, fap, &scred);
@ -1245,7 +1246,7 @@ smbfs_lookup(ap)
if ((nameiop == CREATE || nameiop == RENAME) && wantparent && islastcn) {
cnp->cn_flags |= SAVENAME;
if (!lockparent) {
VOP_UNLOCK(dvp, 0, p);
VOP_UNLOCK(dvp, 0, td);
cnp->cn_flags |= PDIRUNLOCK;
}
return (EJUSTRETURN);
@ -1258,7 +1259,7 @@ smbfs_lookup(ap)
* handle DELETE case ...
*/
if (nameiop == DELETE && islastcn) { /* delete last component */
error = VOP_ACCESS(dvp, VWRITE, cnp->cn_cred, p);
error = VOP_ACCESS(dvp, VWRITE, cnp->cn_cred, td);
if (error)
return error;
if (isdot) {
@ -1272,13 +1273,13 @@ smbfs_lookup(ap)
*vpp = vp;
cnp->cn_flags |= SAVENAME;
if (!lockparent) {
VOP_UNLOCK(dvp, 0, p);
VOP_UNLOCK(dvp, 0, td);
cnp->cn_flags |= PDIRUNLOCK;
}
return 0;
}
if (nameiop == RENAME && islastcn && wantparent) {
error = VOP_ACCESS(dvp, VWRITE, cnp->cn_cred, p);
error = VOP_ACCESS(dvp, VWRITE, cnp->cn_cred, td);
if (error)
return error;
if (isdot)
@ -1289,20 +1290,20 @@ smbfs_lookup(ap)
*vpp = vp;
cnp->cn_flags |= SAVENAME;
if (!lockparent) {
VOP_UNLOCK(dvp, 0, p);
VOP_UNLOCK(dvp, 0, td);
cnp->cn_flags |= PDIRUNLOCK;
}
return 0;
}
if (flags & ISDOTDOT) {
VOP_UNLOCK(dvp, 0, p);
VOP_UNLOCK(dvp, 0, td);
error = smbfs_nget(mp, dvp, name, nmlen, NULL, &vp);
if (error) {
vn_lock(dvp, LK_EXCLUSIVE | LK_RETRY, p);
vn_lock(dvp, LK_EXCLUSIVE | LK_RETRY, td);
return error;
}
if (lockparent && islastcn) {
error = vn_lock(dvp, LK_EXCLUSIVE, p);
error = vn_lock(dvp, LK_EXCLUSIVE, td);
if (error) {
cnp->cn_flags |= PDIRUNLOCK;
vput(vp);
@ -1320,7 +1321,7 @@ smbfs_lookup(ap)
*vpp = vp;
SMBVDEBUG("lookup: getnewvp!\n");
if (!lockparent || !islastcn) {
VOP_UNLOCK(dvp, 0, p);
VOP_UNLOCK(dvp, 0, td);
cnp->cn_flags |= PDIRUNLOCK;
}
}