mirror of
https://git.openafs.org/openafs.git
synced 2025-01-20 07:51:00 +00:00
osi-credp-20030827
Use a pointer for afs_osi_cred, and crget() instead of just inventing one. Required for FreeBSD, which puts a mutex in the cred. Not strictly required for other BSDs, but it's more correct.
This commit is contained in:
parent
3d50a78236
commit
f40f466c7f
@ -34,15 +34,8 @@ osi_UFSOpen(afs_int32 ainode)
|
|||||||
afs_int32 code = 0;
|
afs_int32 code = 0;
|
||||||
int dummy;
|
int dummy;
|
||||||
AFS_STATCNT(osi_UFSOpen);
|
AFS_STATCNT(osi_UFSOpen);
|
||||||
if (cacheDiskType != AFS_FCACHE_TYPE_UFS) {
|
if (cacheDiskType != AFS_FCACHE_TYPE_UFS)
|
||||||
osi_Panic("UFSOpen called for non-UFS cache\n");
|
osi_Panic("UFSOpen called for non-UFS cache\n");
|
||||||
}
|
|
||||||
if (!afs_osicred_initialized) {
|
|
||||||
/* valid for alpha_osf, SunOS, Ultrix */
|
|
||||||
memset((char *)&afs_osi_cred, 0, sizeof(struct AFS_UCRED));
|
|
||||||
afs_osi_cred.cr_ref++;
|
|
||||||
afs_osicred_initialized = 1;
|
|
||||||
}
|
|
||||||
afile = (struct osi_file *)osi_AllocSmallSpace(sizeof(struct osi_file));
|
afile = (struct osi_file *)osi_AllocSmallSpace(sizeof(struct osi_file));
|
||||||
AFS_GUNLOCK();
|
AFS_GUNLOCK();
|
||||||
code =
|
code =
|
||||||
@ -61,7 +54,7 @@ osi_UFSOpen(afs_int32 ainode)
|
|||||||
#endif
|
#endif
|
||||||
afile->size = VTOI(afile->vnode)->i_size;
|
afile->size = VTOI(afile->vnode)->i_size;
|
||||||
afile->offset = 0;
|
afile->offset = 0;
|
||||||
afile->proc = (int (*)())0;
|
afile->proc = NULL;
|
||||||
afile->inum = ainode; /* for hint validity checking */
|
afile->inum = ainode; /* for hint validity checking */
|
||||||
return (void *)afile;
|
return (void *)afile;
|
||||||
}
|
}
|
||||||
@ -75,9 +68,9 @@ afs_osi_Stat(register struct osi_file *afile, register struct osi_stat *astat)
|
|||||||
MObtainWriteLock(&afs_xosi, 320);
|
MObtainWriteLock(&afs_xosi, 320);
|
||||||
AFS_GUNLOCK();
|
AFS_GUNLOCK();
|
||||||
#if defined(AFS_FBSD50_ENV)
|
#if defined(AFS_FBSD50_ENV)
|
||||||
code = VOP_GETATTR(afile->vnode, &tvattr, &afs_osi_cred, curthread);
|
code = VOP_GETATTR(afile->vnode, &tvattr, afs_osi_credp, curthread);
|
||||||
#else
|
#else
|
||||||
code = VOP_GETATTR(afile->vnode, &tvattr, &afs_osi_cred, curproc);
|
code = VOP_GETATTR(afile->vnode, &tvattr, afs_osi_credp, curproc);
|
||||||
#endif
|
#endif
|
||||||
AFS_GLOCK();
|
AFS_GLOCK();
|
||||||
if (code == 0) {
|
if (code == 0) {
|
||||||
@ -122,9 +115,9 @@ osi_UFSTruncate(register struct osi_file *afile, afs_int32 asize)
|
|||||||
tvattr.va_size = asize;
|
tvattr.va_size = asize;
|
||||||
AFS_GUNLOCK();
|
AFS_GUNLOCK();
|
||||||
#if defined(AFS_FBSD50_ENV)
|
#if defined(AFS_FBSD50_ENV)
|
||||||
code = VOP_SETATTR(afile->vnode, &tvattr, &afs_osi_cred, curthread);
|
code = VOP_SETATTR(afile->vnode, &tvattr, afs_osi_credp, curthread);
|
||||||
#else
|
#else
|
||||||
code = VOP_SETATTR(afile->vnode, &tvattr, &afs_osi_cred, curproc);
|
code = VOP_SETATTR(afile->vnode, &tvattr, afs_osi_credp, curproc);
|
||||||
#endif
|
#endif
|
||||||
AFS_GLOCK();
|
AFS_GLOCK();
|
||||||
MReleaseWriteLock(&afs_xosi);
|
MReleaseWriteLock(&afs_xosi);
|
||||||
@ -164,7 +157,7 @@ afs_osi_Read(register struct osi_file *afile, int offset, void *aptr,
|
|||||||
AFS_GUNLOCK();
|
AFS_GUNLOCK();
|
||||||
code =
|
code =
|
||||||
gop_rdwr(UIO_READ, afile->vnode, (caddr_t) aptr, asize, afile->offset,
|
gop_rdwr(UIO_READ, afile->vnode, (caddr_t) aptr, asize, afile->offset,
|
||||||
AFS_UIOSYS, IO_UNIT, &afs_osi_cred, &resid);
|
AFS_UIOSYS, IO_UNIT, afs_osi_credp, &resid);
|
||||||
AFS_GLOCK();
|
AFS_GLOCK();
|
||||||
if (code == 0) {
|
if (code == 0) {
|
||||||
code = asize - resid;
|
code = asize - resid;
|
||||||
@ -194,7 +187,7 @@ afs_osi_Write(register struct osi_file *afile, afs_int32 offset, void *aptr,
|
|||||||
AFS_GUNLOCK();
|
AFS_GUNLOCK();
|
||||||
code =
|
code =
|
||||||
gop_rdwr(UIO_WRITE, afile->vnode, (caddr_t) aptr, asize,
|
gop_rdwr(UIO_WRITE, afile->vnode, (caddr_t) aptr, asize,
|
||||||
afile->offset, AFS_UIOSYS, IO_UNIT, &afs_osi_cred,
|
afile->offset, AFS_UIOSYS, IO_UNIT, afs_osi_credp,
|
||||||
&resid);
|
&resid);
|
||||||
AFS_GLOCK();
|
AFS_GLOCK();
|
||||||
}
|
}
|
||||||
|
@ -320,7 +320,7 @@ afs_vop_close(ap)
|
|||||||
if (ap->a_cred)
|
if (ap->a_cred)
|
||||||
code = afs_close(avc, ap->a_fflag, ap->a_cred);
|
code = afs_close(avc, ap->a_fflag, ap->a_cred);
|
||||||
else
|
else
|
||||||
code = afs_close(avc, ap->a_fflag, &afs_osi_cred);
|
code = afs_close(avc, ap->a_fflag, afs_osi_credp);
|
||||||
afs_BozonLock(&avc->pvnLock, avc);
|
afs_BozonLock(&avc->pvnLock, avc);
|
||||||
osi_FlushPages(avc, ap->a_cred); /* hold bozon lock, but not basic vnode lock */
|
osi_FlushPages(avc, ap->a_cred); /* hold bozon lock, but not basic vnode lock */
|
||||||
afs_BozonUnlock(&avc->pvnLock, avc);
|
afs_BozonUnlock(&avc->pvnLock, avc);
|
||||||
@ -695,7 +695,7 @@ afs_vop_fsync(ap)
|
|||||||
if (ap->a_cred)
|
if (ap->a_cred)
|
||||||
error = afs_fsync(VTOAFS(vp), ap->a_cred);
|
error = afs_fsync(VTOAFS(vp), ap->a_cred);
|
||||||
else
|
else
|
||||||
error = afs_fsync(VTOAFS(vp), &afs_osi_cred);
|
error = afs_fsync(VTOAFS(vp), afs_osi_credp);
|
||||||
AFS_GUNLOCK();
|
AFS_GUNLOCK();
|
||||||
return error;
|
return error;
|
||||||
}
|
}
|
||||||
|
@ -34,15 +34,8 @@ osi_UFSOpen(afs_int32 ainode)
|
|||||||
afs_int32 code = 0;
|
afs_int32 code = 0;
|
||||||
int dummy;
|
int dummy;
|
||||||
AFS_STATCNT(osi_UFSOpen);
|
AFS_STATCNT(osi_UFSOpen);
|
||||||
if (cacheDiskType != AFS_FCACHE_TYPE_UFS) {
|
if (cacheDiskType != AFS_FCACHE_TYPE_UFS)
|
||||||
osi_Panic("UFSOpen called for non-UFS cache\n");
|
osi_Panic("UFSOpen called for non-UFS cache\n");
|
||||||
}
|
|
||||||
if (!afs_osicred_initialized) {
|
|
||||||
/* valid for alpha_osf, SunOS, Ultrix */
|
|
||||||
memset((char *)&afs_osi_cred, 0, sizeof(struct AFS_UCRED));
|
|
||||||
afs_osi_cred.cr_ref++;
|
|
||||||
afs_osicred_initialized = 1;
|
|
||||||
}
|
|
||||||
afile = (struct osi_file *)osi_AllocSmallSpace(sizeof(struct osi_file));
|
afile = (struct osi_file *)osi_AllocSmallSpace(sizeof(struct osi_file));
|
||||||
AFS_GUNLOCK();
|
AFS_GUNLOCK();
|
||||||
code =
|
code =
|
||||||
@ -70,7 +63,7 @@ afs_osi_Stat(register struct osi_file *afile, register struct osi_stat *astat)
|
|||||||
AFS_STATCNT(osi_Stat);
|
AFS_STATCNT(osi_Stat);
|
||||||
MObtainWriteLock(&afs_xosi, 320);
|
MObtainWriteLock(&afs_xosi, 320);
|
||||||
AFS_GUNLOCK();
|
AFS_GUNLOCK();
|
||||||
VOP_GETATTR(afile->vnode, &tvattr, &afs_osi_cred, code);
|
VOP_GETATTR(afile->vnode, &tvattr, afs_osi_credp, code);
|
||||||
AFS_GLOCK();
|
AFS_GLOCK();
|
||||||
if (code == 0) {
|
if (code == 0) {
|
||||||
astat->size = tvattr.va_size;
|
astat->size = tvattr.va_size;
|
||||||
@ -116,11 +109,11 @@ osi_UFSTruncate(register struct osi_file *afile, afs_int32 asize)
|
|||||||
* of ufs's references directly to cred instead of to
|
* of ufs's references directly to cred instead of to
|
||||||
* credentials parameter. Probably should fix ufs some day. */
|
* credentials parameter. Probably should fix ufs some day. */
|
||||||
oldCred = curproc->p_cred->pc_ucred; /* remember old credentials pointer */
|
oldCred = curproc->p_cred->pc_ucred; /* remember old credentials pointer */
|
||||||
curproc->p_cred->pc_ucred = &afs_osi_cred;
|
curproc->p_cred->pc_ucred = afs_osi_credp;
|
||||||
/* temporarily use superuser credentials */
|
/* temporarily use superuser credentials */
|
||||||
tvattr.va_size = asize;
|
tvattr.va_size = asize;
|
||||||
AFS_GUNLOCK();
|
AFS_GUNLOCK();
|
||||||
VOP_SETATTR(afile->vnode, &tvattr, &afs_osi_cred, code);
|
VOP_SETATTR(afile->vnode, &tvattr, afs_osi_credp, code);
|
||||||
AFS_GLOCK();
|
AFS_GLOCK();
|
||||||
curproc->p_cred->pc_ucred = oldCred; /* restore */
|
curproc->p_cred->pc_ucred = oldCred; /* restore */
|
||||||
MReleaseWriteLock(&afs_xosi);
|
MReleaseWriteLock(&afs_xosi);
|
||||||
@ -162,7 +155,7 @@ afs_osi_Read(register struct osi_file *afile, int offset, void *aptr,
|
|||||||
AFS_GUNLOCK();
|
AFS_GUNLOCK();
|
||||||
code =
|
code =
|
||||||
gop_rdwr(UIO_READ, afile->vnode, (caddr_t) aptr, asize, afile->offset,
|
gop_rdwr(UIO_READ, afile->vnode, (caddr_t) aptr, asize, afile->offset,
|
||||||
AFS_UIOSYS, IO_UNIT, &afs_osi_cred, &resid);
|
AFS_UIOSYS, IO_UNIT, afs_osi_credp, &resid);
|
||||||
AFS_GLOCK();
|
AFS_GLOCK();
|
||||||
if (code == 0) {
|
if (code == 0) {
|
||||||
code = asize - resid;
|
code = asize - resid;
|
||||||
@ -191,11 +184,11 @@ afs_osi_Write(register struct osi_file *afile, afs_int32 offset, void *aptr,
|
|||||||
afile->offset = offset;
|
afile->offset = offset;
|
||||||
{
|
{
|
||||||
struct ucred *tmpcred = curproc->p_cred->pc_ucred;
|
struct ucred *tmpcred = curproc->p_cred->pc_ucred;
|
||||||
curproc->p_cred->pc_ucred = &afs_osi_cred;
|
curproc->p_cred->pc_ucred = afs_osi_credp;
|
||||||
AFS_GUNLOCK();
|
AFS_GUNLOCK();
|
||||||
code =
|
code =
|
||||||
gop_rdwr(UIO_WRITE, afile->vnode, (caddr_t) aptr, asize,
|
gop_rdwr(UIO_WRITE, afile->vnode, (caddr_t) aptr, asize,
|
||||||
afile->offset, AFS_UIOSYS, IO_UNIT, &afs_osi_cred,
|
afile->offset, AFS_UIOSYS, IO_UNIT, afs_osi_credp,
|
||||||
&resid);
|
&resid);
|
||||||
AFS_GLOCK();
|
AFS_GLOCK();
|
||||||
curproc->p_cred->pc_ucred = tmpcred;
|
curproc->p_cred->pc_ucred = tmpcred;
|
||||||
|
@ -60,7 +60,7 @@ afs_osi_Stat(struct osi_file *afile, struct osi_stat *astat)
|
|||||||
AFS_STATCNT(osi_Stat);
|
AFS_STATCNT(osi_Stat);
|
||||||
MObtainWriteLock(&afs_xosi, 320);
|
MObtainWriteLock(&afs_xosi, 320);
|
||||||
AFS_GUNLOCK();
|
AFS_GUNLOCK();
|
||||||
code = VOP_GETATTR(afile->vnode, &tvattr, &afs_osi_cred, curproc);
|
code = VOP_GETATTR(afile->vnode, &tvattr, afs_osi_credp, curproc);
|
||||||
AFS_GLOCK();
|
AFS_GLOCK();
|
||||||
if (code == 0) {
|
if (code == 0) {
|
||||||
astat->size = afile->size = tvattr.va_size;
|
astat->size = afile->size = tvattr.va_size;
|
||||||
@ -107,7 +107,7 @@ osi_UFSTruncate(struct osi_file *afile, afs_int32 asize)
|
|||||||
tvattr.va_size = asize;
|
tvattr.va_size = asize;
|
||||||
AFS_GUNLOCK();
|
AFS_GUNLOCK();
|
||||||
VOP_LOCK(afile->vnode, LK_EXCLUSIVE | LK_RETRY, curproc);
|
VOP_LOCK(afile->vnode, LK_EXCLUSIVE | LK_RETRY, curproc);
|
||||||
code = VOP_SETATTR(afile->vnode, &tvattr, &afs_osi_cred, curproc);
|
code = VOP_SETATTR(afile->vnode, &tvattr, afs_osi_credp, curproc);
|
||||||
VOP_UNLOCK(afile->vnode, 0, curproc);
|
VOP_UNLOCK(afile->vnode, 0, curproc);
|
||||||
AFS_GLOCK();
|
AFS_GLOCK();
|
||||||
if (code == 0)
|
if (code == 0)
|
||||||
@ -150,7 +150,7 @@ afs_osi_Read(struct osi_file *afile, int offset, void *aptr, afs_int32 asize)
|
|||||||
AFS_GUNLOCK();
|
AFS_GUNLOCK();
|
||||||
code =
|
code =
|
||||||
vn_rdwr(UIO_READ, afile->vnode, aptr, asize, afile->offset,
|
vn_rdwr(UIO_READ, afile->vnode, aptr, asize, afile->offset,
|
||||||
AFS_UIOSYS, IO_UNIT, &afs_osi_cred, &resid, curproc);
|
AFS_UIOSYS, IO_UNIT, afs_osi_credp, &resid, curproc);
|
||||||
AFS_GLOCK();
|
AFS_GLOCK();
|
||||||
if (code == 0) {
|
if (code == 0) {
|
||||||
code = asize - resid;
|
code = asize - resid;
|
||||||
@ -182,7 +182,7 @@ afs_osi_Write(struct osi_file *afile, afs_int32 offset, void *aptr,
|
|||||||
VOP_LOCK(afile->vnode, LK_EXCLUSIVE | LK_RETRY, curproc);
|
VOP_LOCK(afile->vnode, LK_EXCLUSIVE | LK_RETRY, curproc);
|
||||||
code =
|
code =
|
||||||
vn_rdwr(UIO_WRITE, afile->vnode, (caddr_t) aptr, asize, afile->offset,
|
vn_rdwr(UIO_WRITE, afile->vnode, (caddr_t) aptr, asize, afile->offset,
|
||||||
AFS_UIOSYS, IO_UNIT, &afs_osi_cred, &resid, curproc);
|
AFS_UIOSYS, IO_UNIT, afs_osi_credp, &resid, curproc);
|
||||||
VOP_UNLOCK(afile->vnode, 0, curproc);
|
VOP_UNLOCK(afile->vnode, 0, curproc);
|
||||||
AFS_GLOCK();
|
AFS_GLOCK();
|
||||||
|
|
||||||
|
@ -720,7 +720,7 @@ afs_UFSRead(register struct vcache *avc, struct uio *auio,
|
|||||||
AFS_GUNLOCK();
|
AFS_GUNLOCK();
|
||||||
code =
|
code =
|
||||||
VNOP_RDWR(tfile->vnode, UIO_READ, FREAD, &tuio, NULL, NULL,
|
VNOP_RDWR(tfile->vnode, UIO_READ, FREAD, &tuio, NULL, NULL,
|
||||||
NULL, &afs_osi_cred);
|
NULL, afs_osi_credp);
|
||||||
AFS_GLOCK();
|
AFS_GLOCK();
|
||||||
#elif defined(AFS_AIX32_ENV)
|
#elif defined(AFS_AIX32_ENV)
|
||||||
code =
|
code =
|
||||||
@ -756,26 +756,26 @@ afs_UFSRead(register struct vcache *avc, struct uio *auio,
|
|||||||
#elif defined(AFS_SUN5_ENV)
|
#elif defined(AFS_SUN5_ENV)
|
||||||
AFS_GUNLOCK();
|
AFS_GUNLOCK();
|
||||||
VOP_RWLOCK(tfile->vnode, 0);
|
VOP_RWLOCK(tfile->vnode, 0);
|
||||||
code = VOP_READ(tfile->vnode, &tuio, 0, &afs_osi_cred);
|
code = VOP_READ(tfile->vnode, &tuio, 0, afs_osi_credp);
|
||||||
VOP_RWUNLOCK(tfile->vnode, 0);
|
VOP_RWUNLOCK(tfile->vnode, 0);
|
||||||
AFS_GLOCK();
|
AFS_GLOCK();
|
||||||
#elif defined(AFS_SGI_ENV)
|
#elif defined(AFS_SGI_ENV)
|
||||||
AFS_GUNLOCK();
|
AFS_GUNLOCK();
|
||||||
AFS_VOP_RWLOCK(tfile->vnode, VRWLOCK_READ);
|
AFS_VOP_RWLOCK(tfile->vnode, VRWLOCK_READ);
|
||||||
AFS_VOP_READ(tfile->vnode, &tuio, IO_ISLOCKED, &afs_osi_cred,
|
AFS_VOP_READ(tfile->vnode, &tuio, IO_ISLOCKED, afs_osi_credp,
|
||||||
code);
|
code);
|
||||||
AFS_VOP_RWUNLOCK(tfile->vnode, VRWLOCK_READ);
|
AFS_VOP_RWUNLOCK(tfile->vnode, VRWLOCK_READ);
|
||||||
AFS_GLOCK();
|
AFS_GLOCK();
|
||||||
#elif defined(AFS_OSF_ENV)
|
#elif defined(AFS_OSF_ENV)
|
||||||
tuio.uio_rw = UIO_READ;
|
tuio.uio_rw = UIO_READ;
|
||||||
AFS_GUNLOCK();
|
AFS_GUNLOCK();
|
||||||
VOP_READ(tfile->vnode, &tuio, 0, &afs_osi_cred, code);
|
VOP_READ(tfile->vnode, &tuio, 0, afs_osi_credp, code);
|
||||||
AFS_GLOCK();
|
AFS_GLOCK();
|
||||||
#elif defined(AFS_SUN_ENV)
|
#elif defined(AFS_SUN_ENV)
|
||||||
code = VOP_RDWR(tfile->vnode, &tuio, UIO_READ, 0, &afs_osi_cred);
|
code = VOP_RDWR(tfile->vnode, &tuio, UIO_READ, 0, afs_osi_credp);
|
||||||
#elif defined(AFS_HPUX100_ENV)
|
#elif defined(AFS_HPUX100_ENV)
|
||||||
AFS_GUNLOCK();
|
AFS_GUNLOCK();
|
||||||
code = VOP_RDWR(tfile->vnode, &tuio, UIO_READ, 0, &afs_osi_cred);
|
code = VOP_RDWR(tfile->vnode, &tuio, UIO_READ, 0, afs_osi_credp);
|
||||||
AFS_GLOCK();
|
AFS_GLOCK();
|
||||||
#elif defined(AFS_LINUX20_ENV)
|
#elif defined(AFS_LINUX20_ENV)
|
||||||
AFS_GUNLOCK();
|
AFS_GUNLOCK();
|
||||||
@ -784,23 +784,23 @@ afs_UFSRead(register struct vcache *avc, struct uio *auio,
|
|||||||
#elif defined(AFS_DARWIN_ENV)
|
#elif defined(AFS_DARWIN_ENV)
|
||||||
AFS_GUNLOCK();
|
AFS_GUNLOCK();
|
||||||
VOP_LOCK(tfile->vnode, LK_EXCLUSIVE, current_proc());
|
VOP_LOCK(tfile->vnode, LK_EXCLUSIVE, current_proc());
|
||||||
code = VOP_READ(tfile->vnode, &tuio, 0, &afs_osi_cred);
|
code = VOP_READ(tfile->vnode, &tuio, 0, afs_osi_credp);
|
||||||
VOP_UNLOCK(tfile->vnode, 0, current_proc());
|
VOP_UNLOCK(tfile->vnode, 0, current_proc());
|
||||||
AFS_GLOCK();
|
AFS_GLOCK();
|
||||||
#elif defined(AFS_FBSD50_ENV)
|
#elif defined(AFS_FBSD50_ENV)
|
||||||
AFS_GUNLOCK();
|
AFS_GUNLOCK();
|
||||||
VOP_LOCK(tfile->vnode, LK_EXCLUSIVE, curthread);
|
VOP_LOCK(tfile->vnode, LK_EXCLUSIVE, curthread);
|
||||||
code = VOP_READ(tfile->vnode, &tuio, 0, &afs_osi_cred);
|
code = VOP_READ(tfile->vnode, &tuio, 0, afs_osi_credp);
|
||||||
VOP_UNLOCK(tfile->vnode, 0, curthread);
|
VOP_UNLOCK(tfile->vnode, 0, curthread);
|
||||||
AFS_GLOCK();
|
AFS_GLOCK();
|
||||||
#elif defined(AFS_XBSD_ENV)
|
#elif defined(AFS_XBSD_ENV)
|
||||||
AFS_GUNLOCK();
|
AFS_GUNLOCK();
|
||||||
VOP_LOCK(tfile->vnode, LK_EXCLUSIVE, curproc);
|
VOP_LOCK(tfile->vnode, LK_EXCLUSIVE, curproc);
|
||||||
code = VOP_READ(tfile->vnode, &tuio, 0, &afs_osi_cred);
|
code = VOP_READ(tfile->vnode, &tuio, 0, afs_osi_credp);
|
||||||
VOP_UNLOCK(tfile->vnode, 0, curproc);
|
VOP_UNLOCK(tfile->vnode, 0, curproc);
|
||||||
AFS_GLOCK();
|
AFS_GLOCK();
|
||||||
#else
|
#else
|
||||||
code = VOP_RDWR(tfile->vnode, &tuio, UIO_READ, 0, &afs_osi_cred);
|
code = VOP_RDWR(tfile->vnode, &tuio, UIO_READ, 0, afs_osi_credp);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifdef IHINT
|
#ifdef IHINT
|
||||||
|
@ -521,7 +521,7 @@ afs_UFSWrite(register struct vcache *avc, struct uio *auio, int aio,
|
|||||||
AFS_GUNLOCK();
|
AFS_GUNLOCK();
|
||||||
code =
|
code =
|
||||||
VNOP_RDWR(tfile->vnode, UIO_WRITE, FWRITE, &tuio, NULL, NULL,
|
VNOP_RDWR(tfile->vnode, UIO_WRITE, FWRITE, &tuio, NULL, NULL,
|
||||||
NULL, &afs_osi_cred);
|
NULL, afs_osi_credp);
|
||||||
AFS_GLOCK();
|
AFS_GLOCK();
|
||||||
#else
|
#else
|
||||||
#ifdef AFS_AIX32_ENV
|
#ifdef AFS_AIX32_ENV
|
||||||
@ -536,7 +536,7 @@ afs_UFSWrite(register struct vcache *avc, struct uio *auio, int aio,
|
|||||||
#ifdef AFS_SUN5_ENV
|
#ifdef AFS_SUN5_ENV
|
||||||
AFS_GUNLOCK();
|
AFS_GUNLOCK();
|
||||||
VOP_RWLOCK(tfile->vnode, 1);
|
VOP_RWLOCK(tfile->vnode, 1);
|
||||||
code = VOP_WRITE(tfile->vnode, &tuio, 0, &afs_osi_cred);
|
code = VOP_WRITE(tfile->vnode, &tuio, 0, afs_osi_credp);
|
||||||
VOP_RWUNLOCK(tfile->vnode, 1);
|
VOP_RWUNLOCK(tfile->vnode, 1);
|
||||||
AFS_GLOCK();
|
AFS_GLOCK();
|
||||||
if (code == ENOSPC)
|
if (code == ENOSPC)
|
||||||
@ -547,7 +547,7 @@ afs_UFSWrite(register struct vcache *avc, struct uio *auio, int aio,
|
|||||||
AFS_GUNLOCK();
|
AFS_GUNLOCK();
|
||||||
avc->states |= CWritingUFS;
|
avc->states |= CWritingUFS;
|
||||||
AFS_VOP_RWLOCK(tfile->vnode, VRWLOCK_WRITE);
|
AFS_VOP_RWLOCK(tfile->vnode, VRWLOCK_WRITE);
|
||||||
AFS_VOP_WRITE(tfile->vnode, &tuio, IO_ISLOCKED, &afs_osi_cred, code);
|
AFS_VOP_WRITE(tfile->vnode, &tuio, IO_ISLOCKED, afs_osi_credp, code);
|
||||||
AFS_VOP_RWUNLOCK(tfile->vnode, VRWLOCK_WRITE);
|
AFS_VOP_RWUNLOCK(tfile->vnode, VRWLOCK_WRITE);
|
||||||
avc->states &= ~CWritingUFS;
|
avc->states &= ~CWritingUFS;
|
||||||
AFS_GLOCK();
|
AFS_GLOCK();
|
||||||
@ -555,10 +555,10 @@ afs_UFSWrite(register struct vcache *avc, struct uio *auio, int aio,
|
|||||||
#ifdef AFS_OSF_ENV
|
#ifdef AFS_OSF_ENV
|
||||||
{
|
{
|
||||||
struct ucred *tmpcred = u.u_cred;
|
struct ucred *tmpcred = u.u_cred;
|
||||||
u.u_cred = &afs_osi_cred;
|
u.u_cred = afs_osi_credp;
|
||||||
tuio.uio_rw = UIO_WRITE;
|
tuio.uio_rw = UIO_WRITE;
|
||||||
AFS_GUNLOCK();
|
AFS_GUNLOCK();
|
||||||
VOP_WRITE(tfile->vnode, &tuio, 0, &afs_osi_cred, code);
|
VOP_WRITE(tfile->vnode, &tuio, 0, afs_osi_credp, code);
|
||||||
AFS_GLOCK();
|
AFS_GLOCK();
|
||||||
u.u_cred = tmpcred;
|
u.u_cred = tmpcred;
|
||||||
}
|
}
|
||||||
@ -566,7 +566,7 @@ afs_UFSWrite(register struct vcache *avc, struct uio *auio, int aio,
|
|||||||
#if defined(AFS_HPUX100_ENV)
|
#if defined(AFS_HPUX100_ENV)
|
||||||
{
|
{
|
||||||
AFS_GUNLOCK();
|
AFS_GUNLOCK();
|
||||||
code = VOP_RDWR(tfile->vnode, &tuio, UIO_WRITE, 0, &afs_osi_cred);
|
code = VOP_RDWR(tfile->vnode, &tuio, UIO_WRITE, 0, afs_osi_credp);
|
||||||
AFS_GLOCK();
|
AFS_GLOCK();
|
||||||
}
|
}
|
||||||
#else
|
#else
|
||||||
@ -581,18 +581,18 @@ afs_UFSWrite(register struct vcache *avc, struct uio *auio, int aio,
|
|||||||
#if defined(AFS_DARWIN_ENV)
|
#if defined(AFS_DARWIN_ENV)
|
||||||
AFS_GUNLOCK();
|
AFS_GUNLOCK();
|
||||||
VOP_LOCK(tfile->vnode, LK_EXCLUSIVE, current_proc());
|
VOP_LOCK(tfile->vnode, LK_EXCLUSIVE, current_proc());
|
||||||
code = VOP_WRITE(tfile->vnode, &tuio, 0, &afs_osi_cred);
|
code = VOP_WRITE(tfile->vnode, &tuio, 0, afs_osi_credp);
|
||||||
VOP_UNLOCK(tfile->vnode, 0, current_proc());
|
VOP_UNLOCK(tfile->vnode, 0, current_proc());
|
||||||
AFS_GLOCK();
|
AFS_GLOCK();
|
||||||
#else
|
#else
|
||||||
#if defined(AFS_XBSD_ENV)
|
#if defined(AFS_XBSD_ENV)
|
||||||
AFS_GUNLOCK();
|
AFS_GUNLOCK();
|
||||||
VOP_LOCK(tfile->vnode, LK_EXCLUSIVE, curproc);
|
VOP_LOCK(tfile->vnode, LK_EXCLUSIVE, curproc);
|
||||||
code = VOP_WRITE(tfile->vnode, &tuio, 0, &afs_osi_cred);
|
code = VOP_WRITE(tfile->vnode, &tuio, 0, afs_osi_credp);
|
||||||
VOP_UNLOCK(tfile->vnode, 0, curproc);
|
VOP_UNLOCK(tfile->vnode, 0, curproc);
|
||||||
AFS_GLOCK();
|
AFS_GLOCK();
|
||||||
#else
|
#else
|
||||||
code = VOP_RDWR(tfile->vnode, &tuio, UIO_WRITE, 0, &afs_osi_cred);
|
code = VOP_RDWR(tfile->vnode, &tuio, UIO_WRITE, 0, afs_osi_credp);
|
||||||
#endif /* AFS_XBSD_ENV */
|
#endif /* AFS_XBSD_ENV */
|
||||||
#endif /* AFS_DARWIN_ENV */
|
#endif /* AFS_DARWIN_ENV */
|
||||||
#endif /* AFS_LINUX20_ENV */
|
#endif /* AFS_LINUX20_ENV */
|
||||||
|
@ -323,7 +323,7 @@ VLDB_Same(struct VenusFid *afid, struct vrequest *areq)
|
|||||||
AFS_STATCNT(CheckVLDB);
|
AFS_STATCNT(CheckVLDB);
|
||||||
afs_FinalizeReq(areq);
|
afs_FinalizeReq(areq);
|
||||||
|
|
||||||
if ((i = afs_InitReq(&treq, &afs_osi_cred)))
|
if ((i = afs_InitReq(&treq, afs_osi_credp)))
|
||||||
return DUNNO;
|
return DUNNO;
|
||||||
v = afs_osi_Alloc(sizeof(*v));
|
v = afs_osi_Alloc(sizeof(*v));
|
||||||
tcell = afs_GetCell(afid->Cell, READ_LOCK);
|
tcell = afs_GetCell(afid->Cell, READ_LOCK);
|
||||||
|
@ -40,6 +40,8 @@ lock_t afs_event_lock;
|
|||||||
flid_t osi_flid;
|
flid_t osi_flid;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
struct AFS_UCRED *afs_osi_credp;
|
||||||
|
|
||||||
void
|
void
|
||||||
osi_Init(void)
|
osi_Init(void)
|
||||||
{
|
{
|
||||||
@ -70,17 +72,13 @@ osi_Init(void)
|
|||||||
#endif /* AFS_HPUX_ENV */
|
#endif /* AFS_HPUX_ENV */
|
||||||
|
|
||||||
if (!afs_osicred_initialized) {
|
if (!afs_osicred_initialized) {
|
||||||
memset(&afs_osi_cred, 0, sizeof(struct AFS_UCRED));
|
#ifdef AFS_XBSD_ENV
|
||||||
#ifdef AFS_FBSD50_ENV
|
/* Can't just invent one, must use crget() because of mutex */
|
||||||
/*
|
afs_osi_credp = crdup(osi_curcred());
|
||||||
* We don't init the mutex.
|
|
||||||
* This will be trouble if anyone tries to use change the refcount.
|
|
||||||
* Proper fix would be to make afs_osi_cred into a pointer,
|
|
||||||
* and crdup() it from curthread.
|
|
||||||
*/
|
|
||||||
afs_osi_cred.cr_ref = 1;
|
|
||||||
#else
|
#else
|
||||||
|
memset(&afs_osi_cred, 0, sizeof(struct AFS_UCRED));
|
||||||
crhold(&afs_osi_cred); /* don't let it evaporate */
|
crhold(&afs_osi_cred); /* don't let it evaporate */
|
||||||
|
afs_osi_credp = &afs_osi_cred;
|
||||||
#endif
|
#endif
|
||||||
afs_osicred_initialized = 1;
|
afs_osicred_initialized = 1;
|
||||||
}
|
}
|
||||||
|
@ -396,7 +396,7 @@ typedef struct timeval osi_timeval_t;
|
|||||||
/* Declare any structures which use these macros after the OSI implementation
|
/* Declare any structures which use these macros after the OSI implementation
|
||||||
* has had the opportunity to redefine them.
|
* has had the opportunity to redefine them.
|
||||||
*/
|
*/
|
||||||
extern struct AFS_UCRED afs_osi_cred;
|
extern struct AFS_UCRED afs_osi_cred, *afs_osi_credp;
|
||||||
|
|
||||||
#ifndef osi_curcred
|
#ifndef osi_curcred
|
||||||
#define osi_curcred() (u.u_cred)
|
#define osi_curcred() (u.u_cred)
|
||||||
|
@ -507,7 +507,7 @@ afs_CheckServers(int adown, struct cell *acellp)
|
|||||||
XSTATS_DECLS;
|
XSTATS_DECLS;
|
||||||
|
|
||||||
AFS_STATCNT(afs_CheckServers);
|
AFS_STATCNT(afs_CheckServers);
|
||||||
if ((code = afs_InitReq(&treq, &afs_osi_cred)))
|
if ((code = afs_InitReq(&treq, afs_osi_credp)))
|
||||||
return;
|
return;
|
||||||
ObtainReadLock(&afs_xserver); /* Necessary? */
|
ObtainReadLock(&afs_xserver); /* Necessary? */
|
||||||
ObtainReadLock(&afs_xsrvAddr);
|
ObtainReadLock(&afs_xsrvAddr);
|
||||||
|
@ -335,7 +335,7 @@ afs_FlushVCBs(afs_int32 lockit)
|
|||||||
struct vrequest treq;
|
struct vrequest treq;
|
||||||
struct conn *tc;
|
struct conn *tc;
|
||||||
int safety1, safety2, safety3;
|
int safety1, safety2, safety3;
|
||||||
XSTATS_DECLS if ((code = afs_InitReq(&treq, &afs_osi_cred)))
|
XSTATS_DECLS if ((code = afs_InitReq(&treq, afs_osi_credp)))
|
||||||
return code;
|
return code;
|
||||||
treq.flags |= O_NONBLOCK;
|
treq.flags |= O_NONBLOCK;
|
||||||
tfids = afs_osi_Alloc(sizeof(struct AFSFid) * AFS_MAXCBRSCALL);
|
tfids = afs_osi_Alloc(sizeof(struct AFSFid) * AFS_MAXCBRSCALL);
|
||||||
@ -1199,7 +1199,7 @@ afs_FlushActiveVcaches(register afs_int32 doflocks)
|
|||||||
ReleaseReadLock(&afs_xvcache);
|
ReleaseReadLock(&afs_xvcache);
|
||||||
ObtainWriteLock(&tvc->lock, 51);
|
ObtainWriteLock(&tvc->lock, 51);
|
||||||
do {
|
do {
|
||||||
afs_InitReq(&treq, &afs_osi_cred);
|
afs_InitReq(&treq, afs_osi_credp);
|
||||||
treq.flags |= O_NONBLOCK;
|
treq.flags |= O_NONBLOCK;
|
||||||
|
|
||||||
tc = afs_Conn(&tvc->fid, &treq, SHARED_LOCK);
|
tc = afs_Conn(&tvc->fid, &treq, SHARED_LOCK);
|
||||||
|
@ -603,7 +603,7 @@ afs_NewVolumeByName(char *aname, afs_int32 acell, int agood,
|
|||||||
tve = (struct vldbentry *)(tbuffer + 1024);
|
tve = (struct vldbentry *)(tbuffer + 1024);
|
||||||
ntve = (struct nvldbentry *)tve;
|
ntve = (struct nvldbentry *)tve;
|
||||||
utve = (struct uvldbentry *)tve;
|
utve = (struct uvldbentry *)tve;
|
||||||
afs_InitReq(&treq, &afs_osi_cred); /* *must* be unauth for vldb */
|
afs_InitReq(&treq, afs_osi_credp); /* *must* be unauth for vldb */
|
||||||
do {
|
do {
|
||||||
tconn =
|
tconn =
|
||||||
afs_ConnByMHosts(tcell->cellHosts, tcell->vlport, tcell->cellNum,
|
afs_ConnByMHosts(tcell->cellHosts, tcell->vlport, tcell->cellNum,
|
||||||
|
@ -786,9 +786,8 @@ rxk_NewSocket(short aport)
|
|||||||
#elif defined(AFS_SGI65_ENV) || defined(AFS_OBSD_ENV)
|
#elif defined(AFS_SGI65_ENV) || defined(AFS_OBSD_ENV)
|
||||||
code = socreate(AF_INET, &newSocket, SOCK_DGRAM, IPPROTO_UDP);
|
code = socreate(AF_INET, &newSocket, SOCK_DGRAM, IPPROTO_UDP);
|
||||||
#elif defined(AFS_FBSD50_ENV)
|
#elif defined(AFS_FBSD50_ENV)
|
||||||
code =
|
code = socreate(AF_INET, &newSocket, SOCK_DGRAM, IPPROTO_UDP,
|
||||||
socreate(AF_INET, &newSocket, SOCK_DGRAM, IPPROTO_UDP, &afs_osi_cred,
|
afs_osi_credp, curthread);
|
||||||
curthread);
|
|
||||||
#elif defined(AFS_FBSD40_ENV)
|
#elif defined(AFS_FBSD40_ENV)
|
||||||
code = socreate(AF_INET, &newSocket, SOCK_DGRAM, IPPROTO_UDP, curproc);
|
code = socreate(AF_INET, &newSocket, SOCK_DGRAM, IPPROTO_UDP, curproc);
|
||||||
#else
|
#else
|
||||||
|
Loading…
Reference in New Issue
Block a user