Changeset View
Changeset View
Standalone View
Standalone View
sys/fs/smbfs/smbfs_vnops.c
Show First 20 Lines • Show All 153 Lines • ▼ Show 20 Lines | smbfs_open(struct vop_open_args *ap) | ||||
if (vp->v_type == VDIR) { | if (vp->v_type == VDIR) { | ||||
np->n_flag |= NOPEN; | np->n_flag |= NOPEN; | ||||
return 0; | return 0; | ||||
} | } | ||||
if (np->n_flag & NMODIFIED) { | if (np->n_flag & NMODIFIED) { | ||||
if ((error = smbfs_vinvalbuf(vp, ap->a_td)) == EINTR) | if ((error = smbfs_vinvalbuf(vp, ap->a_td)) == EINTR) | ||||
return error; | return error; | ||||
smbfs_attr_cacheremove(vp); | smbfs_attr_cacheremove(vp); | ||||
error = VOP_GETATTR(vp, &vattr, ap->a_cred); | error = VOP_GETATTR(vp, 0, &vattr, ap->a_cred); | ||||
if (error) | if (error) | ||||
return error; | return error; | ||||
np->n_mtime.tv_sec = vattr.va_mtime.tv_sec; | np->n_mtime.tv_sec = vattr.va_mtime.tv_sec; | ||||
} else { | } else { | ||||
error = VOP_GETATTR(vp, &vattr, ap->a_cred); | error = VOP_GETATTR(vp, 0, &vattr, ap->a_cred); | ||||
if (error) | if (error) | ||||
return error; | return error; | ||||
if (np->n_mtime.tv_sec != vattr.va_mtime.tv_sec) { | if (np->n_mtime.tv_sec != vattr.va_mtime.tv_sec) { | ||||
error = smbfs_vinvalbuf(vp, ap->a_td); | error = smbfs_vinvalbuf(vp, ap->a_td); | ||||
if (error == EINTR) | if (error == EINTR) | ||||
return error; | return error; | ||||
np->n_mtime.tv_sec = vattr.va_mtime.tv_sec; | np->n_mtime.tv_sec = vattr.va_mtime.tv_sec; | ||||
} | } | ||||
▲ Show 20 Lines • Show All 234 Lines • ▼ Show 20 Lines | #endif | ||||
*/ | */ | ||||
if ((np->n_flag & NOPEN) == 0) { | if ((np->n_flag & NOPEN) == 0) { | ||||
if (vcp->vc_flags & SMBV_WIN95) { | if (vcp->vc_flags & SMBV_WIN95) { | ||||
error = VOP_OPEN(vp, FWRITE, ap->a_cred, td, | error = VOP_OPEN(vp, FWRITE, ap->a_cred, td, | ||||
NULL); | NULL); | ||||
if (!error) { | if (!error) { | ||||
/* error = smbfs_smb_setfattrNT(np, 0, | /* error = smbfs_smb_setfattrNT(np, 0, | ||||
mtime, atime, scred); | mtime, atime, scred); | ||||
VOP_GETATTR(vp, &vattr, ap->a_cred); */ | VOP_GETATTR(vp, 0, &vattr, ap->a_cred); */ | ||||
if (mtime) | if (mtime) | ||||
np->n_mtime = *mtime; | np->n_mtime = *mtime; | ||||
VOP_CLOSE(vp, FWRITE, ap->a_cred, td); | VOP_CLOSE(vp, FWRITE, ap->a_cred, td); | ||||
} | } | ||||
} else if ((vcp->vc_sopt.sv_caps & SMB_CAP_NT_SMBS)) { | } else if ((vcp->vc_sopt.sv_caps & SMB_CAP_NT_SMBS)) { | ||||
error = smbfs_smb_setptime2(np, mtime, atime, 0, scred); | error = smbfs_smb_setptime2(np, mtime, atime, 0, scred); | ||||
/* error = smbfs_smb_setpattrNT(np, 0, mtime, atime, scred);*/ | /* error = smbfs_smb_setpattrNT(np, 0, mtime, atime, scred);*/ | ||||
} else if (SMB_DIALECT(vcp) >= SMB_DIALECT_LANMAN2_0) { | } else if (SMB_DIALECT(vcp) >= SMB_DIALECT_LANMAN2_0) { | ||||
Show All 16 Lines | /* error = smbfs_smb_setpattrNT(np, 0, mtime, atime, scred);*/ | ||||
} | } | ||||
} | } | ||||
} | } | ||||
/* | /* | ||||
* Invalidate attribute cache in case if server doesn't set | * Invalidate attribute cache in case if server doesn't set | ||||
* required attributes. | * required attributes. | ||||
*/ | */ | ||||
smbfs_attr_cacheremove(vp); /* invalidate cache */ | smbfs_attr_cacheremove(vp); /* invalidate cache */ | ||||
VOP_GETATTR(vp, vap, ap->a_cred); | VOP_GETATTR(vp, 0, vap, ap->a_cred); | ||||
np->n_mtime.tv_sec = vap->va_mtime.tv_sec; | np->n_mtime.tv_sec = vap->va_mtime.tv_sec; | ||||
out: | out: | ||||
smbfs_free_scred(scred); | smbfs_free_scred(scred); | ||||
return error; | return error; | ||||
} | } | ||||
/* | /* | ||||
* smbfs_read call. | * smbfs_read call. | ||||
*/ | */ | ||||
▲ Show 20 Lines • Show All 42 Lines • ▼ Show 20 Lines | smbfs_create(struct vop_create_args *ap) | ||||
char *name = cnp->cn_nameptr; | char *name = cnp->cn_nameptr; | ||||
int nmlen = cnp->cn_namelen; | int nmlen = cnp->cn_namelen; | ||||
int error; | int error; | ||||
SMBVDEBUG("\n"); | SMBVDEBUG("\n"); | ||||
*vpp = NULL; | *vpp = NULL; | ||||
if (vap->va_type != VREG) | if (vap->va_type != VREG) | ||||
return EOPNOTSUPP; | return EOPNOTSUPP; | ||||
if ((error = VOP_GETATTR(dvp, &vattr, cnp->cn_cred))) | if ((error = VOP_GETATTR(dvp, 0, &vattr, cnp->cn_cred))) | ||||
return error; | return error; | ||||
scred = smbfs_malloc_scred(); | scred = smbfs_malloc_scred(); | ||||
smb_makescred(scred, curthread, cnp->cn_cred); | smb_makescred(scred, curthread, cnp->cn_cred); | ||||
error = smbfs_smb_create(dnp, name, nmlen, scred); | error = smbfs_smb_create(dnp, name, nmlen, scred); | ||||
if (error) | if (error) | ||||
goto out; | goto out; | ||||
error = smbfs_smb_lookup(dnp, name, nmlen, &fattr, scred); | error = smbfs_smb_lookup(dnp, name, nmlen, &fattr, scred); | ||||
▲ Show 20 Lines • Show All 163 Lines • ▼ Show 20 Lines | /* struct vattr *vap = ap->a_vap;*/ | ||||
struct smbnode *dnp = VTOSMB(dvp); | struct smbnode *dnp = VTOSMB(dvp); | ||||
struct vattr vattr; | struct vattr vattr; | ||||
struct smb_cred *scred; | struct smb_cred *scred; | ||||
struct smbfattr fattr; | struct smbfattr fattr; | ||||
char *name = cnp->cn_nameptr; | char *name = cnp->cn_nameptr; | ||||
int len = cnp->cn_namelen; | int len = cnp->cn_namelen; | ||||
int error; | int error; | ||||
if ((error = VOP_GETATTR(dvp, &vattr, cnp->cn_cred))) { | if ((error = VOP_GETATTR(dvp, 0, &vattr, cnp->cn_cred))) { | ||||
return error; | return error; | ||||
} | } | ||||
if ((name[0] == '.') && ((len == 1) || ((len == 2) && (name[1] == '.')))) | if ((name[0] == '.') && ((len == 1) || ((len == 2) && (name[1] == '.')))) | ||||
return EEXIST; | return EEXIST; | ||||
scred = smbfs_malloc_scred(); | scred = smbfs_malloc_scred(); | ||||
smb_makescred(scred, curthread, cnp->cn_cred); | smb_makescred(scred, curthread, cnp->cn_cred); | ||||
error = smbfs_smb_mkdir(dnp, name, len, scred); | error = smbfs_smb_mkdir(dnp, name, len, scred); | ||||
if (error) | if (error) | ||||
▲ Show 20 Lines • Show All 165 Lines • ▼ Show 20 Lines | */ | ||||
struct smbnode *np = VTOSMB(vp); | struct smbnode *np = VTOSMB(vp); | ||||
struct vattr vattr; | struct vattr vattr; | ||||
char buf[10]; | char buf[10]; | ||||
int i, attr, error; | int i, attr, error; | ||||
error = VOP_ACCESS(vp, VREAD, cred, td); | error = VOP_ACCESS(vp, VREAD, cred, td); | ||||
if (error) | if (error) | ||||
return error; | return error; | ||||
error = VOP_GETATTR(vp, &vattr, cred); | error = VOP_GETATTR(vp, 0, &vattr, cred); | ||||
if (error) | if (error) | ||||
return error; | return error; | ||||
if (strcmp(name, "dosattr") == 0) { | if (strcmp(name, "dosattr") == 0) { | ||||
attr = np->n_dosattr; | attr = np->n_dosattr; | ||||
for (i = 0; i < 6; i++, attr >>= 1) | for (i = 0; i < 6; i++, attr >>= 1) | ||||
buf[i] = (attr & 1) ? smbfs_atl[i] : '-'; | buf[i] = (attr & 1) ? smbfs_atl[i] : '-'; | ||||
buf[i] = 0; | buf[i] = 0; | ||||
error = uiomove(buf, i, uio); | error = uiomove(buf, i, uio); | ||||
▲ Show 20 Lines • Show All 202 Lines • ▼ Show 20 Lines | smbfs_lookup(struct vop_lookup_args *ap) | ||||
SMBVDEBUG("cache_lookup returned %d\n", error); | SMBVDEBUG("cache_lookup returned %d\n", error); | ||||
if (error > 0) | if (error > 0) | ||||
return error; | return error; | ||||
if (error) { /* name was found */ | if (error) { /* name was found */ | ||||
struct vattr vattr; | struct vattr vattr; | ||||
killit = 0; | killit = 0; | ||||
vp = *vpp; | vp = *vpp; | ||||
error = VOP_GETATTR(vp, &vattr, cnp->cn_cred); | error = VOP_GETATTR(vp, 0, &vattr, cnp->cn_cred); | ||||
/* | /* | ||||
* If the file type on the server is inconsistent | * If the file type on the server is inconsistent | ||||
* with what it was when we created the vnode, | * with what it was when we created the vnode, | ||||
* kill the bogus vnode now and fall through to | * kill the bogus vnode now and fall through to | ||||
* the code below to create a new one with the | * the code below to create a new one with the | ||||
* right type. | * right type. | ||||
*/ | */ | ||||
if (error == 0 && | if (error == 0 && | ||||
▲ Show 20 Lines • Show All 149 Lines • Show Last 20 Lines |