From f4a7e7e6df16c0767a7e49a10aa2936281fff186 Mon Sep 17 00:00:00 2001 From: bp Date: Sun, 2 Dec 2001 08:56:58 +0000 Subject: Catch up with KSE changes. Submitted by: Max Khon --- sys/fs/smbfs/smbfs_vnops.c | 129 +++++++++++++++++++++++---------------------- 1 file changed, 65 insertions(+), 64 deletions(-) (limited to 'sys/fs/smbfs/smbfs_vnops.c') diff --git a/sys/fs/smbfs/smbfs_vnops.c b/sys/fs/smbfs/smbfs_vnops.c index 4c20ca1e..e69b213 100644 --- a/sys/fs/smbfs/smbfs_vnops.c +++ b/sys/fs/smbfs/smbfs_vnops.c @@ -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; } } -- cgit v1.1