From 741e7005daf323cf8890f26aa92e8d78baefb43c Mon Sep 17 00:00:00 2001 From: Jim Rees Date: Fri, 29 Aug 2003 23:00:04 +0000 Subject: [PATCH] freebsd50-20030829 pass thread, not proc, to VOP_[UN]LOCK in afs_write pass correct bio arg to biodone in afs_strategy fix some warnings reformat some #ifdefs for clarity --- src/afs/VNOPS/afs_vnop_dirops.c | 2 ++ src/afs/VNOPS/afs_vnop_link.c | 1 + src/afs/VNOPS/afs_vnop_readdir.c | 3 ++ src/afs/VNOPS/afs_vnop_rename.c | 1 + src/afs/VNOPS/afs_vnop_strategy.c | 2 ++ src/afs/VNOPS/afs_vnop_write.c | 52 ++++++++++++------------------- src/afs/afs.h | 6 ++-- src/afs/afs_osi.h | 6 ++-- 8 files changed, 34 insertions(+), 39 deletions(-) diff --git a/src/afs/VNOPS/afs_vnop_dirops.c b/src/afs/VNOPS/afs_vnop_dirops.c index f82a6e1c1..f96e7ffaf 100644 --- a/src/afs/VNOPS/afs_vnop_dirops.c +++ b/src/afs/VNOPS/afs_vnop_dirops.c @@ -35,6 +35,7 @@ extern afs_rwlock_t afs_xcbhash; /* don't set CDirty in here because RPC is called synchronously */ +int #ifdef AFS_OSF_ENV afs_mkdir(ndp, attrs) struct nameidata *ndp; @@ -177,6 +178,7 @@ afs_mkdir(OSI_VC_ARG(adp), aname, attrs, avcp, acred) } +int #ifdef AFS_OSF_ENV afs_rmdir(ndp) struct nameidata *ndp; diff --git a/src/afs/VNOPS/afs_vnop_link.c b/src/afs/VNOPS/afs_vnop_link.c index 40937f74a..8f9146d13 100644 --- a/src/afs/VNOPS/afs_vnop_link.c +++ b/src/afs/VNOPS/afs_vnop_link.c @@ -31,6 +31,7 @@ extern afs_rwlock_t afs_xcbhash; /* Note that we don't set CDirty here, this is OK because the link * RPC is called synchronously. */ +int #ifdef AFS_OSF_ENV afs_link(avc, ndp) struct vcache *avc; diff --git a/src/afs/VNOPS/afs_vnop_readdir.c b/src/afs/VNOPS/afs_vnop_readdir.c index e1e194468..22980f453 100644 --- a/src/afs/VNOPS/afs_vnop_readdir.c +++ b/src/afs/VNOPS/afs_vnop_readdir.c @@ -288,6 +288,8 @@ afs_readdir_type(avc, ade) #define AFS_MOVE_UNLOCK() #endif char bufofzeros[64]; /* gotta fill with something */ + +int afs_readdir_move(de, vc, auio, slen, rlen, off) struct DirEntry *de; struct vcache *vc; @@ -491,6 +493,7 @@ afs_bulkstat_send(avc, req) * It has to do with 'offset' (seek locations). */ +int #if defined(AFS_SUN5_ENV) || defined(AFS_SGI_ENV) || defined(AFS_OSF_ENV) || defined(AFS_DARWIN_ENV) || defined(AFS_XBSD_ENV) afs_readdir(OSI_VC_ARG(avc), auio, acred, eofp) int *eofp; diff --git a/src/afs/VNOPS/afs_vnop_rename.c b/src/afs/VNOPS/afs_vnop_rename.c index ba3ef8798..3fa86a72f 100644 --- a/src/afs/VNOPS/afs_vnop_rename.c +++ b/src/afs/VNOPS/afs_vnop_rename.c @@ -357,6 +357,7 @@ afsrename(struct vcache *aodp, char *aname1, struct vcache *andp, return code; } +int #ifdef AFS_OSF_ENV afs_rename(fndp, tndp) struct nameidata *fndp, *tndp; diff --git a/src/afs/VNOPS/afs_vnop_strategy.c b/src/afs/VNOPS/afs_vnop_strategy.c index 896add74f..c6f589091 100644 --- a/src/afs/VNOPS/afs_vnop_strategy.c +++ b/src/afs/VNOPS/afs_vnop_strategy.c @@ -202,6 +202,8 @@ afs_ustrategy(abp) AFS_GLOCK(); } #endif +#elif defined(AFS_FBSD50_ENV) + biodone(&abp->b_io); #else /* AFS_DUX40_ENV */ iodone(abp); #endif /* AFS_DUX40_ENV */ diff --git a/src/afs/VNOPS/afs_vnop_write.c b/src/afs/VNOPS/afs_vnop_write.c index 6dabf8a41..762f5c715 100644 --- a/src/afs/VNOPS/afs_vnop_write.c +++ b/src/afs/VNOPS/afs_vnop_write.c @@ -516,24 +516,19 @@ afs_UFSWrite(register struct vcache *avc, struct uio *auio, int aio, trimlen = len; afsio_trim(&tuio, trimlen); tuio.afsio_offset = offset; -#ifdef AFS_AIX_ENV -#ifdef AFS_AIX41_ENV +#if defined(AFS_AIX41_ENV) AFS_GUNLOCK(); code = VNOP_RDWR(tfile->vnode, UIO_WRITE, FWRITE, &tuio, NULL, NULL, NULL, afs_osi_credp); AFS_GLOCK(); -#else -#ifdef AFS_AIX32_ENV +#elif defined(AFS_AIX32_ENV) code = VNOP_RDWR(tfile->vnode, UIO_WRITE, FWRITE, &tuio, NULL, NULL); -#else +#elif defined(AFS_AIX_ENV) code = VNOP_RDWR(tfile->vnode, UIO_WRITE, FWRITE, (off_t) & offset, &tuio, NULL, NULL, -1); -#endif -#endif /* AFS_AIX41_ENV */ -#else /* AFS_AIX_ENV */ -#ifdef AFS_SUN5_ENV +#elif defined(AFS_SUN5_ENV) AFS_GUNLOCK(); VOP_RWLOCK(tfile->vnode, 1); code = VOP_WRITE(tfile->vnode, &tuio, 0, afs_osi_credp); @@ -542,8 +537,7 @@ afs_UFSWrite(register struct vcache *avc, struct uio *auio, int aio, if (code == ENOSPC) afs_warnuser ("\n\n\n*** Cache partition is full - decrease cachesize!!! ***\n\n\n"); -#else -#if defined(AFS_SGI_ENV) +#elif defined(AFS_SGI_ENV) AFS_GUNLOCK(); avc->states |= CWritingUFS; AFS_VOP_RWLOCK(tfile->vnode, VRWLOCK_WRITE); @@ -551,8 +545,7 @@ afs_UFSWrite(register struct vcache *avc, struct uio *auio, int aio, AFS_VOP_RWUNLOCK(tfile->vnode, VRWLOCK_WRITE); avc->states &= ~CWritingUFS; AFS_GLOCK(); -#else -#ifdef AFS_OSF_ENV +#elif defined(AFS_OSF_ENV) { struct ucred *tmpcred = u.u_cred; u.u_cred = afs_osi_credp; @@ -562,45 +555,40 @@ afs_UFSWrite(register struct vcache *avc, struct uio *auio, int aio, AFS_GLOCK(); u.u_cred = tmpcred; } -#else /* AFS_OSF_ENV */ -#if defined(AFS_HPUX100_ENV) +#elif defined(AFS_HPUX100_ENV) { AFS_GUNLOCK(); code = VOP_RDWR(tfile->vnode, &tuio, UIO_WRITE, 0, afs_osi_credp); AFS_GLOCK(); } -#else -#ifdef AFS_HPUX_ENV - tuio.uio_fpflags &= ~FSYNCIO; /* don't do sync io */ -#endif -#if defined(AFS_LINUX20_ENV) +#elif defined(AFS_LINUX20_ENV) AFS_GUNLOCK(); code = osi_file_uio_rdwr(tfile, &tuio, UIO_WRITE); AFS_GLOCK(); -#else -#if defined(AFS_DARWIN_ENV) +#elif defined(AFS_DARWIN_ENV) AFS_GUNLOCK(); VOP_LOCK(tfile->vnode, LK_EXCLUSIVE, current_proc()); code = VOP_WRITE(tfile->vnode, &tuio, 0, afs_osi_credp); VOP_UNLOCK(tfile->vnode, 0, current_proc()); AFS_GLOCK(); -#else -#if defined(AFS_XBSD_ENV) +#elif defined(AFS_FBSD50_ENV) + AFS_GUNLOCK(); + VOP_LOCK(tfile->vnode, LK_EXCLUSIVE, curthread); + code = VOP_WRITE(tfile->vnode, &tuio, 0, afs_osi_credp); + VOP_UNLOCK(tfile->vnode, 0, curthread); + AFS_GLOCK(); +#elif defined(AFS_XBSD_ENV) AFS_GUNLOCK(); VOP_LOCK(tfile->vnode, LK_EXCLUSIVE, curproc); code = VOP_WRITE(tfile->vnode, &tuio, 0, afs_osi_credp); VOP_UNLOCK(tfile->vnode, 0, curproc); AFS_GLOCK(); #else +#ifdef AFS_HPUX_ENV + tuio.uio_fpflags &= ~FSYNCIO; /* don't do sync io */ +#endif code = VOP_RDWR(tfile->vnode, &tuio, UIO_WRITE, 0, afs_osi_credp); -#endif /* AFS_XBSD_ENV */ -#endif /* AFS_DARWIN_ENV */ -#endif /* AFS_LINUX20_ENV */ -#endif /* AFS_HPUX100_ENV */ -#endif /* AFS_OSF_ENV */ -#endif /* AFS_SGI_ENV */ -#endif /* AFS_SUN5_ENV */ -#endif /* AFS_AIX41_ENV */ +#endif if (code) { error = code; ZapDCE(tdc); /* bad data */ diff --git a/src/afs/afs.h b/src/afs/afs.h index 2569b00c6..a99ec50e6 100644 --- a/src/afs/afs.h +++ b/src/afs/afs.h @@ -1156,13 +1156,11 @@ extern struct brequest afs_brs[NBRS]; /* request structures */ #ifndef afs_vnodeToDev #if defined(AFS_SGI62_ENV) || defined(AFS_HAVE_VXFS) || defined(AFS_DARWIN_ENV) #define afs_vnodeToDev(V) VnodeToDev(V) -#else -#ifdef AFS_DECOSF_ENV +#elif defined(AFS_DECOSF_ENV) #define afs_vnodeToDev(V) osi_vnodeToDev(V) #else #define afs_vnodeToDev(V) (VTOI(V)->i_dev) -#endif /* AFS_DECOSF_ENV */ -#endif /* AFS_SGI62_ENV */ +#endif #endif diff --git a/src/afs/afs_osi.h b/src/afs/afs_osi.h index 0d4f0d775..2374a9c93 100644 --- a/src/afs/afs_osi.h +++ b/src/afs/afs_osi.h @@ -71,13 +71,13 @@ struct osi_dev { #ifdef AFS_OBSD_ENV struct mount *mp; struct vnode *held_vnode; -#else -#ifdef AFS_AIX42_ENV +#elif defined(AFS_FBSD50_ENV) + struct cdev *dev; +#elif defined(AFS_AIX42_ENV) dev_t dev; #else afs_int32 dev; #endif -#endif }; struct afs_osi_WaitHandle { -- 2.39.5