From 910db4047ead302aad84e8ff90c404381101c5e1 Mon Sep 17 00:00:00 2001 From: Niklas Edmundsson Date: Sat, 15 Oct 2005 15:24:24 +0000 Subject: [PATCH] STABLE14-aix-warning-cleanup-20051015 FIXES 21066 clean up aix warnings. hint that large file support works (cherry picked from commit 7c8cf708a06d810bba065e2a49d6ed80e754e1a9) --- src/afs/AIX/osi_inode.c | 2 +- src/afs/AIX/osi_vnodeops.c | 1029 +++++++++++++------------------ src/afs/VNOPS/afs_vnop_create.c | 4 +- src/afs/afs_daemons.c | 363 +---------- src/rx/AIX/rx_kmutex.h | 1 - src/rx/AIX/rx_knet.c | 43 +- src/rx/rx_kcommon.c | 17 +- src/rx/rx_prototypes.h | 9 +- src/sys/afs5.exp | 3 +- 9 files changed, 468 insertions(+), 1003 deletions(-) diff --git a/src/afs/AIX/osi_inode.c b/src/afs/AIX/osi_inode.c index 39bcdce691..b8377bce5e 100644 --- a/src/afs/AIX/osi_inode.c +++ b/src/afs/AIX/osi_inode.c @@ -144,7 +144,7 @@ devtovfs(dev_t dev) a.dev = dev; a.ans = NULL; - vfs_search(devtovfs_func, &a); + vfs_search(devtovfs_func, (caddr_t) &a); return a.ans; } diff --git a/src/afs/AIX/osi_vnodeops.c b/src/afs/AIX/osi_vnodeops.c index a6b9f966bf..5124ce5494 100644 --- a/src/afs/AIX/osi_vnodeops.c +++ b/src/afs/AIX/osi_vnodeops.c @@ -55,134 +55,11 @@ RCSID #include "afsincludes.h" -/* - * declare all the functions so they can be used to init the table - */ -/* creation/naming/deletion */ -int afs_gn_link(); -int afs_gn_mkdir(); -int afs_gn_mknod(); -int afs_gn_remove(); -int afs_gn_rename(); -int afs_gn_rmdir(); -/* lookup, file handle stuff */ -int afs_gn_lookup(); -int afs_gn_fid(); -/* access to files */ -int afs_gn_open(); -int afs_gn_create(); -int afs_gn_hold(); -int afs_gn_rele(); -int afs_gn_close(); -int afs_gn_map(); -int afs_gn_unmap(); -/* manipulate attributes of files */ -int afs_gn_access(); -int afs_gn_getattr(); -int afs_gn_setattr(); -/* data update operations */ -int afs_gn_fclear(); -int afs_gn_fsync(); -int afs_gn_ftrunc(); -int afs_gn_rdwr(); -int afs_gn_lockctl(); -/* extensions */ -int afs_gn_ioctl(); -int afs_gn_readlink(); -int afs_gn_select(); -int afs_gn_symlink(); -int afs_gn_readdir(); -/* buffer ops */ -int afs_gn_strategy(); -/* security things */ -int afs_gn_revoke(); -int afs_gn_getacl(); -int afs_gn_setacl(); -int afs_gn_getpcl(); -int afs_gn_setpcl(); -int afs_gn_enosys(); - - -/* - * declare a struct vnodeops and initialize it with ptrs to all functions - */ -struct vnodeops afs_gn_vnodeops = { - /* creation/naming/deletion */ - afs_gn_link, - afs_gn_mkdir, - afs_gn_mknod, - afs_gn_remove, - afs_gn_rename, - afs_gn_rmdir, - /* lookup, file handle stuff */ - afs_gn_lookup, - afs_gn_fid, - /* access to files */ - afs_gn_open, - afs_gn_create, - afs_gn_hold, - afs_gn_rele, - afs_gn_close, - afs_gn_map, - afs_gn_unmap, - /* manipulate attributes of files */ - afs_gn_access, - afs_gn_getattr, - afs_gn_setattr, - /* data update operations */ - afs_gn_fclear, - afs_gn_fsync, - afs_gn_ftrunc, - afs_gn_rdwr, - afs_gn_lockctl, - /* extensions */ - afs_gn_ioctl, - afs_gn_readlink, - afs_gn_select, - afs_gn_symlink, - afs_gn_readdir, - /* buffer ops */ - afs_gn_strategy, - /* security things */ - afs_gn_revoke, - afs_gn_getacl, - afs_gn_setacl, - afs_gn_getpcl, - afs_gn_setpcl, - afs_gn_enosys, /* vn_seek */ - afs_gn_enosys, /* vn_fsync_range */ - afs_gn_enosys, /* vn_create_attr */ - afs_gn_enosys, /* vn_finfo */ - afs_gn_enosys, /* vn_map_lloff */ - afs_gn_enosys, /* vn_readdir_eofp */ - afs_gn_enosys, /* vn_rdwr_attr */ - afs_gn_enosys, /* vn_memcntl */ - afs_gn_enosys, /* vn_spare7 */ - afs_gn_enosys, /* vn_spare8 */ - afs_gn_enosys, /* vn_spare9 */ - afs_gn_enosys, /* vn_spareA */ - afs_gn_enosys, /* vn_spareB */ - afs_gn_enosys, /* vn_spareC */ - afs_gn_enosys, /* vn_spareD */ - afs_gn_enosys, /* vn_spareE */ - afs_gn_enosys /* vn_spareF */ -#ifdef AFS_AIX51_ENV - , afs_gn_enosys, /* pagerBackRange */ - afs_gn_enosys, /* pagerGetFileSize */ - afs_gn_enosys, /* pagerReadAhead */ - afs_gn_enosys, /* pagerWriteBehind */ - afs_gn_enosys /* pagerEndCopy */ -#endif -}; -struct vnodeops *afs_ops = &afs_gn_vnodeops; - - int -afs_gn_link(vp, dp, name, cred) - struct vnode *vp; - struct vnode *dp; - char *name; - struct ucred *cred; +afs_gn_link(struct vnode *vp, + struct vnode *dp, + char *name, + struct ucred *cred) { int error; @@ -195,15 +72,10 @@ afs_gn_link(vp, dp, name, cred) int -afs_gn_mkdir(dp, name, Mode, cred) - struct vnode *dp; - char *name; -#ifdef AFS_AIX51_ENV - int32long64_t Mode; -#else - int Mode; -#endif - struct ucred *cred; +afs_gn_mkdir(struct vnode *dp, + char *name, + int32long64_t Mode, + struct ucred *cred) { struct vattr va; struct vnode *vp; @@ -226,16 +98,11 @@ afs_gn_mkdir(dp, name, Mode, cred) int -afs_gn_mknod(dp, name, Mode, dev, cred) - struct vnode *dp; - char *name; -#ifdef AFS_AIX51_ENV - int Mode; -#else - int Mode; -#endif - dev_t dev; - struct ucred *cred; +afs_gn_mknod(struct vnode *dp, + char *name, + int32long64_t Mode, + dev_t dev, + struct ucred *cred) { struct vattr va; struct vnode *vp; @@ -248,7 +115,7 @@ afs_gn_mknod(dp, name, Mode, dev, cred) va.va_mode = (mode & 07777) & ~get_umask(); /**** I'm not sure if suser() should stay here since it makes no sense in AFS; however the documentation says that one "should be super-user unless making a FIFO file. Others systems such as SUN do this checking in the early stages of mknod (before the abstraction), so it's equivalently the same! *****/ - if (va.va_type != VFIFO && !suser(&error)) + if (va.va_type != VFIFO && !suser((char *)&error)) return (EPERM); switch (va.va_type) { case VDIR: @@ -262,7 +129,7 @@ afs_gn_mknod(dp, name, Mode, dev, cred) case VBLK: va.va_rdev = dev; default: - error = afs_create(dp, name, &va, NONEXCL, mode, &vp, cred); + error = afs_create(VTOAFS(dp), name, &va, NONEXCL, mode, (struct vcache **)&vp, cred); } if (!error) { AFS_RELE(vp); @@ -275,11 +142,10 @@ afs_gn_mknod(dp, name, Mode, dev, cred) int -afs_gn_remove(vp, dp, name, cred) - struct vnode *vp; /* Ignored in AFS */ - struct vnode *dp; - char *name; - struct ucred *cred; +afs_gn_remove(struct vnode *vp, /* Ignored in AFS */ + struct vnode * dp, + char *name, + struct ucred *cred) { int error; @@ -292,14 +158,13 @@ afs_gn_remove(vp, dp, name, cred) int -afs_gn_rename(vp, dp, name, tp, tdp, tname, cred) - struct vnode *dp; - char *name; - struct vnode *vp; /* Ignored in AFS */ - struct vnode *tp; /* Ignored in AFS */ - struct vnode *tdp; - char *tname; - struct ucred *cred; +afs_gn_rename(struct vnode *vp, /* Ignored in AFS */ + struct vnode *dp, + char *name, + struct vnode *tp, /* Ignored in AFS */ + struct vnode *tdp, + char *tname, + struct ucred *cred) { int error; @@ -313,11 +178,10 @@ afs_gn_rename(vp, dp, name, tp, tdp, tname, cred) int -afs_gn_rmdir(vp, dp, name, cred) - struct vnode *vp; /* Ignored in AFS */ - struct vnode *dp; - char *name; - struct ucred *cred; +afs_gn_rmdir(struct vnode *vp, /* Ignored in AFS */ + struct vnode *dp, + char *name, + struct ucred *cred) { int error; @@ -334,17 +198,12 @@ afs_gn_rmdir(vp, dp, name, cred) int -afs_gn_lookup(dp, vpp, name, Flags, vattrp, cred) - struct vattr *vattrp; - struct vnode *dp; - struct vnode **vpp; - char *name; -#ifdef AFS_AIX51_ENV - int32long64_t Flags; /* includes FOLLOW... */ -#else - afs_uint32 Flags; /* includes FOLLOW... */ -#endif - struct ucred *cred; +afs_gn_lookup(struct vnode *dp, + struct vnode **vpp, + char *name, + int32long64_t Flags, /* includes FOLLOW... */ + struct vattr *vattrp, + struct ucred *cred) { int error; int flags = Flags; @@ -360,10 +219,9 @@ afs_gn_lookup(dp, vpp, name, Flags, vattrp, cred) int -afs_gn_fid(vp, fidp, cred) - struct vnode *vp; - struct fid *fidp; - struct ucred *cred; +afs_gn_fid(struct vnode *vp, + struct fid *fidp, + struct ucred *cred) { int error; @@ -376,17 +234,11 @@ afs_gn_fid(vp, fidp, cred) int -afs_gn_open(vp, Flags, ext, vinfop, cred) - struct vnode *vp; -#ifdef AFS_AIX51_ENV - int32long64_t Flags; - ext_t ext; /* Ignored in AFS */ -#else - int Flags; - int ext; /* Ignored in AFS */ -#endif - struct ucred **vinfop; /* return ptr for fp->f_vinfo, used as fp->f_cred */ - struct ucred *cred; +afs_gn_open(struct vnode *vp, + int32long64_t Flags, + ext_t ext, + struct ucred **vinfop, + struct ucred *cred) { int error; struct vattr va; @@ -411,17 +263,17 @@ afs_gn_open(vp, Flags, ext, vinfop, cred) afs_osi_Sleep(&tvp->opens); } - error = afs_access(vp, modes, cred); + error = afs_access(VTOAFS(vp), modes, cred); if (error) { goto abort; } - error = afs_open(&vp, flags, cred); + error = afs_open((struct vcache **) &vp, flags, cred); if (!error) { if (flags & FTRUNC) { VATTR_NULL(&va); va.va_size = 0; - error = afs_setattr(vp, &va, cred); + error = afs_setattr(VTOAFS(vp), &va, cred); } if (flags & FNSHARE) @@ -447,19 +299,14 @@ afs_gn_open(vp, Flags, ext, vinfop, cred) int -afs_gn_create(dp, vpp, Flags, name, Mode, vinfop, cred) - struct vnode *dp; - struct vnode **vpp; - char *name; -#ifdef AFS_AIX51_ENV - int32long64_t Flags; - int32long64_t Mode; -#else - int Flags; - int Mode; -#endif - struct ucred **vinfop; /* return ptr for fp->f_vinfo, used as fp->f_cred */ - struct ucred *cred; +afs_gn_create(struct vnode *dp, + struct vnode **vpp, + int32long64_t Flags, + char *name, + int32long64_t Mode, + struct ucred **vinfop, /* return ptr for fp->f_vinfo, used as fp->f_cred */ + struct ucred *cred) + { struct vattr va; enum vcexcl exclusive; @@ -481,7 +328,7 @@ afs_gn_create(dp, vpp, Flags, name, Mode, vinfop, cred) modes |= X_ACC; if ((flags & FWRITE) || (flags & FTRUNC)) modes |= W_ACC; - error = afs_create(dp, name, &va, exclusive, modes, vpp, cred); + error = afs_create(VTOAFS(dp), name, &va, exclusive, modes, (struct vcache **)vpp, cred); if (error) { return error; } @@ -502,7 +349,7 @@ afs_gn_create(dp, vpp, Flags, name, Mode, vinfop, cred) * execsOrWriters flag (else we'll be treated as the sun's "core" * case). */ *vinfop = cred; /* save user creds in fp->f_vinfo */ - error = afs_open(vpp, flags, cred); + error = afs_open((struct vcache **)vpp, flags, cred); } afs_Trace4(afs_iclSetp, CM_TRACE_GCREATE, ICL_TYPE_POINTER, dp, ICL_TYPE_STRING, name, ICL_TYPE_LONG, mode, ICL_TYPE_LONG, @@ -512,8 +359,7 @@ afs_gn_create(dp, vpp, Flags, name, Mode, vinfop, cred) int -afs_gn_hold(vp) - struct vnode *vp; +afs_gn_hold(struct vnode *vp) { AFS_STATCNT(afs_gn_hold); ++(vp->v_count); @@ -523,8 +369,7 @@ afs_gn_hold(vp) int vmPageHog = 0; int -afs_gn_rele(vp) - struct vnode *vp; +afs_gn_rele(struct vnode *vp) { struct vcache *vcp = VTOAFS(vp); int error = 0; @@ -544,15 +389,10 @@ afs_gn_rele(vp) int -afs_gn_close(vp, Flags, vinfo, cred) - struct vnode *vp; -#ifdef AFS_AIX51_ENV - int32long64_t Flags; -#else - int Flags; -#endif - caddr_t vinfo; /* Ignored in AFS */ - struct ucred *cred; +afs_gn_close(struct vnode *vp, + int32long64_t Flags, + caddr_t vinfo, /* Ignored in AFS */ + struct ucred *cred) { int error; struct vcache *tvp = VTOAFS(vp); @@ -573,15 +413,12 @@ afs_gn_close(vp, Flags, vinfo, cred) int -afs_gn_map(vp, addr, Len, Off, Flag, cred) - struct vnode *vp; - caddr_t addr; -#ifdef AFS_AIX51_ENV - uint32long64_t Len, Off, Flag; -#else - u_int Len, Off, Flag; -#endif - struct ucred *cred; +afs_gn_map(struct vnode *vp, + caddr_t addr, + uint32long64_t Len, + uint32long64_t Off, + uint32long64_t Flag, + struct ucred *cred) { struct vcache *vcp = VTOAFS(vp); struct vrequest treq; @@ -612,7 +449,7 @@ afs_gn_map(vp, addr, Len, Off, Flag, cred) #endif /* Consider V_INTRSEG too for interrupts */ if (error = - vms_create(&vcp->segid, V_CLIENT, vcp->v.v_gnode, tlen, 0, 0)) { + vms_create(&vcp->segid, V_CLIENT, (dev_t) vcp->v.v_gnode, tlen, 0, 0)) { ReleaseWriteLock(&vcp->lock); return (EOPNOTSUPP); } @@ -650,14 +487,9 @@ afs_gn_map(vp, addr, Len, Off, Flag, cred) int -afs_gn_unmap(vp, flag, cred) - struct vnode *vp; -#ifdef AFS_AIX51_ENV - int32long64_t flag; -#else - int flag; -#endif - struct ucred *cred; +afs_gn_unmap(struct vnode *vp, + int32long64_t flag, + struct ucred *cred) { struct vcache *vcp = VTOAFS(vp); AFS_STATCNT(afs_gn_unmap); @@ -679,16 +511,10 @@ afs_gn_unmap(vp, flag, cred) int -afs_gn_access(vp, Mode, Who, cred) - struct vnode *vp; -#ifdef AFS_AIX51_ENV - int32long64_t Mode; - int32long64_t Who; -#else - int Mode; - int Who; -#endif - struct ucred *cred; +afs_gn_access(struct vnode *vp, + int32long64_t Mode, + int32long64_t Who, + struct ucred *cred) { int error; struct vattr vattr; @@ -701,11 +527,11 @@ afs_gn_access(vp, Mode, Who, cred) goto out; } - error = afs_access(vp, mode, cred); + error = afs_access(VTOAFS(vp), mode, cred); if (!error) { /* Additional testing */ if (who == ACC_OTHERS || who == ACC_ANY) { - error = afs_getattr(vp, &vattr, cred); + error = afs_getattr(VTOAFS(vp), &vattr, cred); if (!error) { if (who == ACC_ANY) { if (((vattr.va_mode >> 6) & mode) == mode) { @@ -719,7 +545,7 @@ afs_gn_access(vp, Mode, Who, cred) error = EACCES; } } else if (who == ACC_ALL) { - error = afs_getattr(vp, &vattr, cred); + error = afs_getattr(VTOAFS(vp), &vattr, cred); if (!error) { if ((!((vattr.va_mode >> 6) & mode)) || (!((vattr.va_mode >> 3) & mode)) @@ -739,15 +565,14 @@ afs_gn_access(vp, Mode, Who, cred) int -afs_gn_getattr(vp, vattrp, cred) - struct vnode *vp; - struct vattr *vattrp; - struct ucred *cred; +afs_gn_getattr(struct vnode *vp, + struct vattr *vattrp, + struct ucred *cred) { int error; AFS_STATCNT(afs_gn_getattr); - error = afs_getattr(vp, vattrp, cred); + error = afs_getattr(VTOAFS(vp), vattrp, cred); afs_Trace2(afs_iclSetp, CM_TRACE_GGETATTR, ICL_TYPE_POINTER, vp, ICL_TYPE_LONG, error); return (error); @@ -755,20 +580,12 @@ afs_gn_getattr(vp, vattrp, cred) int -afs_gn_setattr(vp, op, arg1, arg2, arg3, cred) - struct vnode *vp; -#ifdef AFS_AIX51_ENV - int32long64_t op; - int32long64_t arg1; - int32long64_t arg2; - int32long64_t arg3; -#else - int op; - int arg1; - int arg2; - int arg3; -#endif - struct ucred *cred; +afs_gn_setattr(struct vnode *vp, + int32long64_t op, + int32long64_t arg1, + int32long64_t arg2, + int32long64_t arg3, + struct ucred *cred) { struct vattr va; int error = 0; @@ -805,7 +622,7 @@ afs_gn_setattr(vp, op, arg1, arg2, arg3, cred) goto out; } - error = afs_setattr(vp, &va, cred); + error = afs_setattr(VTOAFS(vp), &va, cred); out: afs_Trace2(afs_iclSetp, CM_TRACE_GSETATTR, ICL_TYPE_POINTER, vp, ICL_TYPE_LONG, error); @@ -815,23 +632,18 @@ afs_gn_setattr(vp, op, arg1, arg2, arg3, cred) char zero_buffer[PAGESIZE]; int -afs_gn_fclear(vp, flags, offset, length, vinfo, cred) - struct vnode *vp; -#ifdef AFS_AIX51_ENV - int32long64_t flags; -#else - int flags; -#endif - offset_t offset; - offset_t length; - caddr_t vinfo; - struct ucred *cred; +afs_gn_fclear(struct vnode *vp, + int32long64_t flags, + offset_t offset, + offset_t length, + caddr_t vinfo, + struct ucred *cred) { int i, len, error = 0; struct iovec iov; struct uio uio; static int fclear_init = 0; - register struct vcache *avc = VTOAFS(vp); + struct vcache *avc = VTOAFS(vp); AFS_STATCNT(afs_gn_fclear); if (!fclear_init) { @@ -860,7 +672,7 @@ afs_gn_fclear(vp, flags, offset, length, vinfo, cred) uio.afsio_iovcnt = 1; uio.afsio_seg = AFS_UIOSYS; uio.afsio_resid = iov.iov_len; - if (error = afs_rdwr(vp, &uio, UIO_WRITE, 0, cred)) + if (error = afs_rdwr(VTOAFS(vp), &uio, UIO_WRITE, 0, cred)) break; } afs_Trace4(afs_iclSetp, CM_TRACE_GFCLEAR, ICL_TYPE_POINTER, vp, @@ -871,16 +683,10 @@ afs_gn_fclear(vp, flags, offset, length, vinfo, cred) int -afs_gn_fsync(vp, flags, vinfo, cred) - struct vnode *vp; -#ifdef AFS_AIX51_ENV - int32long64_t flags; /* Not used by AFS */ - int32long64_t vinfo; /* Not used by AFS */ -#else - int flags; /* Not used by AFS */ - caddr_t vinfo; /* Not used by AFS */ -#endif - struct ucred *cred; +afs_gn_fsync(struct vnode *vp, + int32long64_t flags, /* Not used by AFS */ + int32long64_t vinfo, /* Not used by AFS */ + struct ucred *cred) { int error; @@ -893,16 +699,11 @@ afs_gn_fsync(vp, flags, vinfo, cred) int -afs_gn_ftrunc(vp, flags, length, vinfo, cred) - struct vnode *vp; -#ifdef AFS_AIX51_ENV - int32long64_t flags; /* Ignored in AFS */ -#else - int flags; /* Ignored in AFS */ -#endif - offset_t length; - caddr_t vinfo; /* Ignored in AFS */ - struct ucred *cred; +afs_gn_ftrunc(struct vnode *vp, + int32long64_t flags, + offset_t length, + caddr_t vinfo, + struct ucred *cred) { struct vattr va; int error; @@ -910,7 +711,7 @@ afs_gn_ftrunc(vp, flags, length, vinfo, cred) AFS_STATCNT(afs_gn_ftrunc); VATTR_NULL(&va); va.va_size = length; - error = afs_setattr(vp, &va, cred); + error = afs_setattr(VTOAFS(vp), &va, cred); afs_Trace4(afs_iclSetp, CM_TRACE_GFTRUNC, ICL_TYPE_POINTER, vp, ICL_TYPE_LONG, flags, ICL_TYPE_OFFSET, ICL_HANDLE_OFFSET(length), ICL_TYPE_LONG, error); @@ -921,22 +722,16 @@ afs_gn_ftrunc(vp, flags, length, vinfo, cred) #define MIN_PAGE_HOG_SIZE 8388608 int -afs_gn_rdwr(vp, op, Flags, ubuf, ext, vinfo, vattrp, cred) - struct vnode *vp; - enum uio_rw op; -#ifdef AFS_AIX51_ENV - int32long64_t Flags; - ext_t ext; /* Ignored in AFS */ -#else - int Flags; - int ext; /* Ignored in AFS */ -#endif - struct uio *ubuf; - caddr_t vinfo; /* Ignored in AFS */ - struct vattr *vattrp; - struct ucred *cred; +afs_gn_rdwr(struct vnode *vp, + enum uio_rw op, + int32long64_t Flags, + struct uio *ubuf, + ext_t ext, /* Ignored in AFS */ + caddr_t vinfo, /* Ignored in AFS */ + struct vattr *vattrp, + struct ucred *cred) { - register struct vcache *vcp = VTOAFS(vp); + struct vcache *vcp = VTOAFS(vp); struct vrequest treq; int error = 0; int free_cred = 0; @@ -1015,14 +810,14 @@ afs_gn_rdwr(vp, op, Flags, ubuf, ext, vinfo, vattrp, cred) if (op == UIO_WRITE) { #ifdef AFS_64BIT_CLIENT if (ubuf->afsio_offset < afs_vmMappingEnd) { -#endif /* AFS_64BIT_ENV */ +#endif /* AFS_64BIT_CLIENT */ ObtainWriteLock(&vcp->lock, 240); vcp->states |= CDirty; /* Set the dirty bit */ afs_FakeOpen(vcp); ReleaseWriteLock(&vcp->lock); #ifdef AFS_64BIT_CLIENT } -#endif /* AFS_64BIT_ENV */ +#endif /* AFS_64BIT_CLIENT */ } error = afs_vm_rdwr(vp, ubuf, op, flags, cred); @@ -1030,13 +825,13 @@ afs_gn_rdwr(vp, op, Flags, ubuf, ext, vinfo, vattrp, cred) if (op == UIO_WRITE) { #ifdef AFS_64BIT_CLIENT if (ubuf->afsio_offset < afs_vmMappingEnd) { -#endif /* AFS_64BIT_ENV */ +#endif /* AFS_64BIT_CLIENT */ ObtainWriteLock(&vcp->lock, 241); afs_FakeClose(vcp, cred); /* XXXX For nfs trans and cores XXXX */ ReleaseWriteLock(&vcp->lock); #ifdef AFS_64BIT_CLIENT } -#endif /* AFS_64BIT_ENV */ +#endif /* AFS_64BIT_CLIENT */ } if (vattrp != NULL && error == 0) afs_gn_getattr(vp, vattrp, cred); @@ -1050,15 +845,15 @@ afs_gn_rdwr(vp, op, Flags, ubuf, ext, vinfo, vattrp, cred) } #define AFS_MAX_VM_CHUNKS 10 -afs_vm_rdwr(vp, uiop, rw, ioflag, credp) - register struct vnode *vp; - struct uio *uiop; - enum uio_rw rw; - int ioflag; - struct ucred *credp; +static int +afs_vm_rdwr(struct vnode *vp, + struct uio *uiop, + enum uio_rw rw, + int ioflag, + struct ucred *credp) { - register afs_int32 code = 0; - register int i; + afs_int32 code = 0; + int i; afs_int32 blockSize; afs_size_t fileSize, xfrOffset, offset, old_offset, xfrSize; vmsize_t txfrSize; @@ -1068,7 +863,7 @@ afs_vm_rdwr(vp, uiop, rw, ioflag, credp) int mixed = 0; afs_size_t add2resid = 0; #endif /* AFS_64BIT_CLIENT */ - register struct vcache *vcp = VTOAFS(vp); + struct vcache *vcp = VTOAFS(vp); struct dcache *tdc; afs_size_t start_offset; afs_int32 save_resid = uiop->afsio_resid; @@ -1160,7 +955,7 @@ afs_vm_rdwr(vp, uiop, rw, ioflag, credp) #endif /* Consider V_INTRSEG too for interrupts */ if (code = - vms_create(&vcp->segid, V_CLIENT, vcp->v.v_gnode, tlen, 0, 0)) { + vms_create(&vcp->segid, V_CLIENT, (dev_t) vcp->v.v_gnode, tlen, 0, 0)) { goto fail; } #ifdef AFS_64BIT_KERNEL @@ -1376,14 +1171,14 @@ afs_vm_rdwr(vp, uiop, rw, ioflag, credp) } -afs_direct_rdwr(vp, uiop, rw, ioflag, credp) - register struct vnode *vp; - struct uio *uiop; - enum uio_rw rw; - int ioflag; - struct ucred *credp; +static int +afs_direct_rdwr(struct vnode *vp, + struct uio *uiop, + enum uio_rw rw, + int ioflag, + struct ucred *credp) { - register afs_int32 code = 0; + afs_int32 code = 0; afs_size_t fileSize, xfrOffset, offset, old_offset, xfrSize; struct vcache *vcp = VTOAFS(vp); afs_int32 save_resid = uiop->afsio_resid; @@ -1429,7 +1224,7 @@ afs_direct_rdwr(vp, uiop, rw, ioflag, credp) afs_Trace3(afs_iclSetp, CM_TRACE_DIRECTRDWR, ICL_TYPE_POINTER, vp, ICL_TYPE_OFFSET, ICL_HANDLE_OFFSET(uiop->afsio_offset), ICL_TYPE_LONG, uiop->afsio_resid); - code = afs_rdwr(vp, uiop, rw, ioflag, credp); + code = afs_rdwr(VTOAFS(vp), uiop, rw, ioflag, credp); if (code != 0) { uiop->afsio_resid = save_resid; } else { @@ -1456,11 +1251,10 @@ afs_direct_rdwr(vp, uiop, rw, ioflag, credp) static int -lock_normalize(vp, lckdat, offset, cred) - struct vnode *vp; - struct eflock *lckdat; - offset_t offset; - struct ucred *cred; +lock_normalize(struct vnode *vp, + struct flock *lckdat, + offset_t offset, + struct ucred *cred) { struct vattr vattr; int code; @@ -1472,7 +1266,7 @@ lock_normalize(vp, lckdat, offset, cred) lckdat->l_start += (off_t) offset; break; case 2: - code = afs_getattr(vp, &vattr, cred); + code = afs_getattr(VTOAFS(vp), &vattr, cred); if (code != 0) return code; lckdat->l_start += (off_t) vattr.va_size; @@ -1486,18 +1280,14 @@ lock_normalize(vp, lckdat, offset, cred) -afs_gn_lockctl(vp, offset, lckdat, cmd, ignored_fcn, ignored_id, cred) - void (*ignored_fcn) (); - void *ignored_id; - struct vnode *vp; - offset_t offset; - struct eflock *lckdat; - struct ucred *cred; -#ifdef AFS_AIX51_ENV - int32long64_t cmd; -#else - int cmd; -#endif +int +afs_gn_lockctl(struct vnode *vp, + offset_t offset, + struct eflock *lckdat, + int32long64_t cmd, + int (*ignored_fcn) (), + ulong * ignored_id, + struct ucred *cred) { int error, ncmd = 0; struct flock flkd; @@ -1538,17 +1328,12 @@ afs_gn_lockctl(vp, offset, lckdat, cmd, ignored_fcn, ignored_id, cred) /* NOTE: In the nfs glue routine (nfs_gn2sun.c) the order was wrong (vp, flags, cmd, arg, ext); was that another typo? */ int -afs_gn_ioctl(vp, Cmd, arg, flags, channel, ext) - struct vnode *vp; -#ifdef AFS_AIX51_ENV - int32long64_t Cmd; -#else - int Cmd; -#endif - int arg; - int flags; /* Ignored in AFS */ - int channel; /* Ignored in AFS */ - int ext; /* Ignored in AFS */ +afs_gn_ioctl(struct vnode *vp, + int32long64_t Cmd, + caddr_t arg, + size_t flags, /* Ignored in AFS */ + ext_t ext, /* Ignored in AFS */ + struct ucred *crp) /* Ignored in AFS */ { int error; int cmd = Cmd; @@ -1563,10 +1348,9 @@ afs_gn_ioctl(vp, Cmd, arg, flags, channel, ext) int -afs_gn_readlink(vp, uiop, cred) - struct vnode *vp; - struct uio *uiop; - struct ucred *cred; +afs_gn_readlink(struct vnode *vp, + struct uio *uiop, + struct ucred *cred) { int error; @@ -1579,11 +1363,13 @@ afs_gn_readlink(vp, uiop, cred) int -afs_gn_select(vp, which, vinfo, mpx) - struct vnode *vp; - int which; - caddr_t *vinfo; - caddr_t *mpx; +afs_gn_select(struct vnode *vp, + int32long64_t correl, + ushort e, + ushort *re, + void (* notify)(), + caddr_t vinfo, + struct ucred *crp) { AFS_STATCNT(afs_gn_select); /* NO SUPPORT for this in afs YET! */ @@ -1592,11 +1378,10 @@ afs_gn_select(vp, which, vinfo, mpx) int -afs_gn_symlink(vp, link, target, cred) - struct vnode *vp; - char *target; - char *link; - struct ucred *cred; +afs_gn_symlink(struct vnode *vp, + char *link, + char *target, + struct ucred *cred) { struct vattr va; int error; @@ -1613,10 +1398,9 @@ afs_gn_symlink(vp, link, target, cred) int -afs_gn_readdir(vp, uiop, cred) - struct vnode *vp; - struct uio *uiop; - struct ucred *cred; +afs_gn_readdir(struct vnode *vp, + struct uio *uiop, + struct ucred *cred) { int error; @@ -1629,16 +1413,17 @@ afs_gn_readdir(vp, uiop, cred) extern Simple_lock afs_asyncbuf_lock; +extern struct buf *afs_asyncbuf; +extern int afs_asyncbuf_cv; + /* * Buffers are ranked by age. A buffer's age is the value of afs_biotime - * when the buffer is processed by naix_vmstrategy. afs_biotime is + * when the buffer is processed by afs_gn_strategy. afs_biotime is * incremented for each buffer. A buffer's age is kept in its av_back field. * The age ranking is used by the daemons, which favor older buffers. */ afs_int32 afs_biotime = 0; -extern struct buf *afs_asyncbuf; -extern int afs_asyncbuf_cv; /* This function is called with a list of buffers, threaded through * the av_forw field. Our goal is to copy the list of buffers into the * afs_asyncbuf list, sorting buffers into sublists linked by the b_work field. @@ -1647,16 +1432,18 @@ extern int afs_asyncbuf_cv; * be increased to cover all of the buffers in the b_work queue. */ #define AIX_VM_BLKSIZE 8192 -afs_gn_strategy(abp, cred) - struct ucred *cred; - register struct buf *abp; +/* Note: This function seems to be called as ddstrategy entry point, ie + * has one argument. However, it also needs to be present as + * vn_strategy entry point which has three arguments, but it seems to never + * be called in that capacity (it would fail horribly due to the argument + * mismatch). I'm confused, but it obviously has to be this way, maybe + * some IBM people can shed som light on this + */ +int +afs_gn_strategy(struct buf *abp) { - register struct buf **lbp, *tbp; -#ifdef AFS_64BIT_KERNEL - afs_int64 *lwbp; /* last quy in work chain */ -#else - int *lwbp; /* last guy in work chain */ -#endif + struct buf **lbp, *tbp; + struct buf **lwbp; struct buf *nbp, *qbp, *qnbp, *firstComparable; int doMerge; int oldPriority; @@ -1710,6 +1497,7 @@ afs_gn_strategy(abp, cred) */ continue; } + /* we may have actually added the "new" firstComparable */ if (tbp->av_forw == firstComparable) firstComparable = tbp; @@ -1766,32 +1554,25 @@ afs_gn_strategy(abp, cred) doMerge = 1; /* both integral #s of blocks */ } if (doMerge) { - register struct buf *xbp; + struct buf *xbp; /* merge both of these blocks together */ /* first set age to the older of the two */ -#ifdef AFS_64BIT_KERNEL - if ((afs_int64) qnbp->av_back - (afs_int64) qbp->av_back < - 0) -#else - if ((int)qnbp->av_back - (int)qbp->av_back < 0) -#endif + if ((int32long64_t) qnbp->av_back - + (int32long64_t) qbp->av_back < 0) { qbp->av_back = qnbp->av_back; - lwbp = &qbp->b_work; + } + lwbp = (struct buf **) &qbp->b_work; /* find end of qbp's work queue */ - for (xbp = (struct buf *)(*lwbp); xbp; - lwbp = &xbp->b_work, xbp = (struct buf *)(*lwbp)); + for (xbp = *lwbp; xbp; + lwbp = (struct buf **) &xbp->b_work, xbp = *lwbp); /* * now setting *lwbp will change the last ptr in the qbp's * work chain */ qbp->av_forw = qnbp->av_forw; /* splice out qnbp */ qbp->b_bcount += qnbp->b_bcount; /* fix count */ -#ifdef AFS_64BIT_KERNEL - *lwbp = (afs_int64) qnbp; /* append qnbp to end */ -#else - *lwbp = (int)qnbp; /* append qnbp to end */ -#endif + *lwbp = qnbp; /* append qnbp to end */ /* * note that qnbp is bogus, but it doesn't matter because * we're going to restart the for loop now. @@ -1808,16 +1589,19 @@ afs_gn_strategy(abp, cred) } -afs_inactive(avc, acred) - register struct vcache *avc; - struct AFS_UCRED *acred; +int +afs_inactive(struct vcache *avc, + struct AFS_UCRED *acred) { afs_InactiveVCache(avc, acred); } int -afs_gn_revoke(vp) - struct vnode *vp; +afs_gn_revoke(struct vnode *vp, + int32long64_t cmd, + int32long64_t flag, + struct vattr *vinfop, + struct ucred *crp) { AFS_STATCNT(afs_gn_revoke); /* NO SUPPORT for this in afs YET! */ @@ -1825,51 +1609,159 @@ afs_gn_revoke(vp) } int -afs_gn_getacl(vp, uiop, cred) - struct vnode *vp; - struct uio *uiop; - struct ucred *cred; +afs_gn_getacl(struct vnode *vp, + struct uio *uiop, + struct ucred *cred) { return ENOSYS; }; int -afs_gn_setacl(vp, uiop, cred) - struct vnode *vp; - struct uio *uiop; - struct ucred *cred; +afs_gn_setacl(struct vnode *vp, + struct uio *uiop, + struct ucred *cred) { return ENOSYS; }; int -afs_gn_getpcl(vp, uiop, cred) - struct vnode *vp; - struct uio *uiop; - struct ucred *cred; +afs_gn_getpcl(struct vnode *vp, + struct uio *uiop, + struct ucred *cred) { return ENOSYS; }; int -afs_gn_setpcl(vp, uiop, cred) - struct vnode *vp; - struct uio *uiop; - struct ucred *cred; +afs_gn_setpcl(struct vnode *vp, + struct uio *uiop, + struct ucred *cred) { return ENOSYS; }; + + +int +afs_gn_seek(struct vnode* vp, offset_t * offp, struct ucred * crp) +{ +/* + * File systems which do not wish to do offset validation can simply + * return 0. File systems which do not provide the vn_seek entry point + * will have a maximum offset of OFF_MAX (2 gigabytes minus 1) enforced + * by the logical file system. + */ + return 0; +} + + int afs_gn_enosys() { return ENOSYS; } +/* + * declare a struct vnodeops and initialize it with ptrs to all functions + */ +struct vnodeops afs_gn_vnodeops = { + /* creation/naming/deletion */ + afs_gn_link, + afs_gn_mkdir, + afs_gn_mknod, + afs_gn_remove, + afs_gn_rename, + afs_gn_rmdir, + /* lookup, file handle stuff */ + afs_gn_lookup, + (int(*)(struct vnode*,struct fileid*,struct ucred*)) + afs_gn_fid, + /* access to files */ + (int(*)(struct vnode *, int32long64_t, ext_t, caddr_t *,struct ucred *)) + afs_gn_open, + (int(*)(struct vnode *, struct vnode **, int32long64_t,caddr_t, int32long64_t, caddr_t *, struct ucred *)) + afs_gn_create, + afs_gn_hold, + afs_gn_rele, + afs_gn_close, + afs_gn_map, + afs_gn_unmap, + /* manipulate attributes of files */ + afs_gn_access, + afs_gn_getattr, + afs_gn_setattr, + /* data update operations */ + afs_gn_fclear, + afs_gn_fsync, + afs_gn_ftrunc, + afs_gn_rdwr, + afs_gn_lockctl, + /* extensions */ + afs_gn_ioctl, + afs_gn_readlink, + afs_gn_select, + afs_gn_symlink, + afs_gn_readdir, + /* buffer ops */ + (int(*)(struct vnode*,struct buf*,struct ucred*)) + afs_gn_strategy, + /* security things */ + afs_gn_revoke, + afs_gn_getacl, + afs_gn_setacl, + afs_gn_getpcl, + afs_gn_setpcl, + afs_gn_seek, + (int(*)(struct vnode *, int32long64_t, int32long64_t, offset_t, offset_t, struct ucred *)) + afs_gn_enosys, /* vn_fsync_range */ + (int(*)(struct vnode *, struct vnode **, int32long64_t, char *, struct vattr *, int32long64_t, caddr_t *, struct ucred *)) + afs_gn_enosys, /* vn_create_attr */ + (int(*)(struct vnode *, int32long64_t, void *, size_t, struct ucred *)) + afs_gn_enosys, /* vn_finfo */ + (int(*)(struct vnode *, caddr_t, offset_t, offset_t, uint32long64_t, uint32long64_t, struct ucred *)) + afs_gn_enosys, /* vn_map_lloff */ + (int(*)(struct vnode*,struct uio*,int*,struct ucred*)) + afs_gn_enosys, /* vn_readdir_eofp */ + (int(*)(struct vnode *, enum uio_rw, int32long64_t, struct uio *, ext_t , caddr_t, struct vattr *, struct vattr *, struct ucred *)) + afs_gn_enosys, /* vn_rdwr_attr */ + (int(*)(struct vnode*,int,void*,struct ucred*)) + afs_gn_enosys, /* vn_memcntl */ + (int(*)(struct vnode*,const char*,struct uio*,struct ucred*)) + afs_gn_enosys, /* vn_getea */ + (int(*)(struct vnode*,const char*,struct uio*,int,struct ucred*)) + afs_gn_enosys, /* vn_setea */ + (int(*)(struct vnode *, struct uio *, struct ucred *)) + afs_gn_enosys, /* vn_listea */ + (int(*)(struct vnode *, const char *, struct ucred *)) + afs_gn_enosys, /* vn_removeea */ + (int(*)(struct vnode *, const char *, struct vattr *, struct ucred *)) + afs_gn_enosys, /* vn_statea */ + (int(*)(struct vnode *, uint64_t, acl_type_t *, struct uio *, size_t *, mode_t *, struct ucred *)) + afs_gn_enosys, /* vn_getxacl */ + (int(*)(struct vnode *, uint64_t, acl_type_t, struct uio *, mode_t, struct ucred *)) + afs_gn_enosys, /* vn_setxacl */ + afs_gn_enosys, /* vn_spareE */ + afs_gn_enosys /* vn_spareF */ +#ifdef AFS_AIX51_ENV + ,(int(*)(struct gnode*,long long,char*,unsigned long*, unsigned long*,unsigned int*)) + afs_gn_enosys, /* pagerBackRange */ + (int64_t(*)(struct gnode*)) + afs_gn_enosys, /* pagerGetFileSize */ + (void(*)(struct gnode *, vpn_t, vpn_t *, vpn_t *, vpn_t *, boolean_t)) + afs_gn_enosys, /* pagerReadAhead */ + (void(*)(struct gnode *, int64_t, int64_t, uint)) + afs_gn_enosys, /* pagerReadWriteBehind */ + (void(*)(struct gnode*,long long,unsigned long,unsigned long,unsigned int)) + afs_gn_enosys /* pagerEndCopy */ +#endif +}; +struct vnodeops *afs_ops = &afs_gn_vnodeops; + + + extern struct vfsops Afs_vfsops; -extern struct vnodeops afs_gn_vnodeops; extern int Afs_init(); #define AFS_CALLOUT_TBL_SIZE 256 @@ -1883,7 +1775,7 @@ extern int Afs_init(); static vfs_mount(struct vfs *a, struct ucred *b) { - register glockOwner, ret; + int glockOwner, ret; glockOwner = ISAFS_GLOCK(); if (!glockOwner) @@ -1898,7 +1790,7 @@ vfs_mount(struct vfs *a, struct ucred *b) static vfs_unmount(struct vfs *a, int b, struct ucred *c) { - register glockOwner, ret; + int glockOwner, ret; glockOwner = ISAFS_GLOCK(); if (!glockOwner) @@ -1913,7 +1805,7 @@ vfs_unmount(struct vfs *a, int b, struct ucred *c) static vfs_root(struct vfs *a, struct vnode **b, struct ucred *c) { - register glockOwner, ret; + int glockOwner, ret; glockOwner = ISAFS_GLOCK(); if (!glockOwner) @@ -1928,7 +1820,7 @@ vfs_root(struct vfs *a, struct vnode **b, struct ucred *c) static vfs_statfs(struct vfs *a, struct statfs *b, struct ucred *c) { - register glockOwner, ret; + int glockOwner, ret; glockOwner = ISAFS_GLOCK(); if (!glockOwner) @@ -1943,7 +1835,7 @@ vfs_statfs(struct vfs *a, struct statfs *b, struct ucred *c) static vfs_sync(struct gfs *a) { - register glockOwner, ret; + int glockOwner, ret; glockOwner = ISAFS_GLOCK(); if (!glockOwner) @@ -1957,7 +1849,7 @@ vfs_sync(struct gfs *a) static vfs_vget(struct vfs *a, struct vnode **b, struct fileid *c, struct ucred *d) { - register glockOwner, ret; + int glockOwner, ret; glockOwner = ISAFS_GLOCK(); if (!glockOwner) @@ -1972,7 +1864,7 @@ vfs_vget(struct vfs *a, struct vnode **b, struct fileid *c, struct ucred *d) static vfs_cntl(struct vfs *a, int b, caddr_t c, size_t d, struct ucred *e) { - register glockOwner, ret; + int glockOwner, ret; glockOwner = ISAFS_GLOCK(); if (!glockOwner) @@ -1987,7 +1879,7 @@ vfs_cntl(struct vfs *a, int b, caddr_t c, size_t d, struct ucred *e) static vfs_quotactl(struct vfs *a, int b, uid_t c, caddr_t d, struct ucred *e) { - register glockOwner, ret; + int glockOwner, ret; glockOwner = ISAFS_GLOCK(); if (!glockOwner) @@ -2003,7 +1895,7 @@ vfs_quotactl(struct vfs *a, int b, uid_t c, caddr_t d, struct ucred *e) static vfs_syncvfs(struct gfs *a, struct vfs *b, int c, struct ucred *d) { - register glockOwner, ret; + int glockOwner, ret; glockOwner = ISAFS_GLOCK(); if (!glockOwner) @@ -2034,7 +1926,7 @@ struct vfsops locked_Afs_vfsops = { static vn_link(struct vnode *a, struct vnode *b, char *c, struct ucred *d) { - register glockOwner, ret; + int glockOwner, ret; glockOwner = ISAFS_GLOCK(); if (!glockOwner) @@ -2047,14 +1939,9 @@ vn_link(struct vnode *a, struct vnode *b, char *c, struct ucred *d) } static -#ifdef AFS_AIX51_ENV vn_mkdir(struct vnode *a, char *b, int32long64_t c, struct ucred *d) { -#else -vn_mkdir(struct vnode *a, char *b, int c, struct ucred *d) -{ -#endif - register glockOwner, ret; + int glockOwner, ret; glockOwner = ISAFS_GLOCK(); if (!glockOwner) @@ -2067,15 +1954,10 @@ vn_mkdir(struct vnode *a, char *b, int c, struct ucred *d) } static -#ifdef AFS_AIX51_ENV vn_mknod(struct vnode *a, caddr_t b, int32long64_t c, dev_t d, struct ucred *e) { -#else -vn_mknod(struct vnode *a, caddr_t b, int c, dev_t d, struct ucred *e) -{ -#endif - register glockOwner, ret; + int glockOwner, ret; glockOwner = ISAFS_GLOCK(); if (!glockOwner) @@ -2090,7 +1972,7 @@ vn_mknod(struct vnode *a, caddr_t b, int c, dev_t d, struct ucred *e) static vn_remove(struct vnode *a, struct vnode *b, char *c, struct ucred *d) { - register glockOwner, ret; + int glockOwner, ret; glockOwner = ISAFS_GLOCK(); if (!glockOwner) @@ -2106,7 +1988,7 @@ static vn_rename(struct vnode *a, struct vnode *b, caddr_t c, struct vnode *d, struct vnode *e, caddr_t f, struct ucred *g) { - register glockOwner, ret; + int glockOwner, ret; glockOwner = ISAFS_GLOCK(); if (!glockOwner) @@ -2121,7 +2003,7 @@ vn_rename(struct vnode *a, struct vnode *b, caddr_t c, struct vnode *d, static vn_rmdir(struct vnode *a, struct vnode *b, char *c, struct ucred *d) { - register glockOwner, ret; + int glockOwner, ret; glockOwner = ISAFS_GLOCK(); if (!glockOwner) @@ -2134,14 +2016,10 @@ vn_rmdir(struct vnode *a, struct vnode *b, char *c, struct ucred *d) } static -#ifdef AFS_AIX51_ENV - vn_lookup(struct vnode *a, struct vnode **b, char *c, int32long64_t d, -#else -vn_lookup(struct vnode *a, struct vnode **b, char *c, int d, -#endif +vn_lookup(struct vnode *a, struct vnode **b, char *c, int32long64_t d, struct vattr *v, struct ucred *e) { - register glockOwner, ret; + int glockOwner, ret; glockOwner = ISAFS_GLOCK(); if (!glockOwner) @@ -2156,7 +2034,7 @@ vn_lookup(struct vnode *a, struct vnode **b, char *c, int d, static vn_fid(struct vnode *a, struct fileid *b, struct ucred *c) { - register glockOwner, ret; + int glockOwner, ret; glockOwner = ISAFS_GLOCK(); if (!glockOwner) @@ -2169,15 +2047,13 @@ vn_fid(struct vnode *a, struct fileid *b, struct ucred *c) } static -#ifdef AFS_AIX51_ENV -vn_open(struct vnode *a, int b, int c, caddr_t * d, struct ucred *e) -{ -#else -vn_open(struct vnode *a, int32long64_t b, ext_t c, caddr_t * d, +vn_open(struct vnode *a, + int32long64_t b, + ext_t c, + caddr_t * d, struct ucred *e) { -#endif - register glockOwner, ret; + int glockOwner, ret; glockOwner = ISAFS_GLOCK(); if (!glockOwner) @@ -2190,16 +2066,10 @@ vn_open(struct vnode *a, int32long64_t b, ext_t c, caddr_t * d, } static -#ifdef AFS_AIX51_ENV vn_create(struct vnode *a, struct vnode **b, int32long64_t c, caddr_t d, int32long64_t e, caddr_t * f, struct ucred *g) { -#else -vn_create(struct vnode *a, struct vnode **b, int c, caddr_t d, int e, - caddr_t * f, struct ucred *g) -{ -#endif - register glockOwner, ret; + int glockOwner, ret; glockOwner = ISAFS_GLOCK(); if (!glockOwner) @@ -2214,7 +2084,7 @@ vn_create(struct vnode *a, struct vnode **b, int c, caddr_t d, int e, static vn_hold(struct vnode *a) { - register glockOwner, ret; + int glockOwner, ret; glockOwner = ISAFS_GLOCK(); if (!glockOwner) @@ -2229,7 +2099,7 @@ vn_hold(struct vnode *a) static vn_rele(struct vnode *a) { - register glockOwner, ret; + int glockOwner, ret; glockOwner = ISAFS_GLOCK(); if (!glockOwner) @@ -2242,14 +2112,9 @@ vn_rele(struct vnode *a) } static -#ifdef AFS_AIX51_ENV vn_close(struct vnode *a, int32long64_t b, caddr_t c, struct ucred *d) { -#else -vn_close(struct vnode *a, int b, caddr_t c, struct ucred *d) -{ -#endif - register glockOwner, ret; + int glockOwner, ret; glockOwner = ISAFS_GLOCK(); if (!glockOwner) @@ -2262,15 +2127,10 @@ vn_close(struct vnode *a, int b, caddr_t c, struct ucred *d) } static -#ifdef AFS_AIX51_ENV vn_map(struct vnode *a, caddr_t b, uint32long64_t c, uint32long64_t d, uint32long64_t e, struct ucred *f) { -#else -vn_map(struct vnode *a, caddr_t b, uint c, uint d, uint e, struct ucred *f) -{ -#endif - register glockOwner, ret; + int glockOwner, ret; glockOwner = ISAFS_GLOCK(); if (!glockOwner) @@ -2283,14 +2143,9 @@ vn_map(struct vnode *a, caddr_t b, uint c, uint d, uint e, struct ucred *f) } static -#ifdef AFS_AIX51_ENV vn_unmap(struct vnode *a, int32long64_t b, struct ucred *c) { -#else -vn_unmap(struct vnode *a, int b, struct ucred *c) -{ -#endif - register glockOwner, ret; + int glockOwner, ret; glockOwner = ISAFS_GLOCK(); if (!glockOwner) @@ -2303,14 +2158,9 @@ vn_unmap(struct vnode *a, int b, struct ucred *c) } static -#ifdef AFS_AIX51_ENV vn_access(struct vnode *a, int32long64_t b, int32long64_t c, struct ucred *d) { -#else -vn_access(struct vnode *a, int b, int c, struct ucred *d) -{ -#endif - register glockOwner, ret; + int glockOwner, ret; glockOwner = ISAFS_GLOCK(); if (!glockOwner) @@ -2325,7 +2175,7 @@ vn_access(struct vnode *a, int b, int c, struct ucred *d) static vn_getattr(struct vnode *a, struct vattr *b, struct ucred *c) { - register glockOwner, ret; + int glockOwner, ret; glockOwner = ISAFS_GLOCK(); if (!glockOwner) @@ -2338,15 +2188,10 @@ vn_getattr(struct vnode *a, struct vattr *b, struct ucred *c) } static -#ifdef AFS_AIX51_ENV vn_setattr(struct vnode *a, int32long64_t b, int32long64_t c, int32long64_t d, int32long64_t e, struct ucred *f) { -#else -vn_setattr(struct vnode *a, int b, int c, int d, int e, struct ucred *f) -{ -#endif - register glockOwner, ret; + int glockOwner, ret; glockOwner = ISAFS_GLOCK(); if (!glockOwner) @@ -2359,14 +2204,10 @@ vn_setattr(struct vnode *a, int b, int c, int d, int e, struct ucred *f) } static -#ifdef AFS_AIX51_ENV - vn_fclear(struct vnode *a, int32long64_t b, offset_t c, offset_t d -#else -vn_fclear(struct vnode *a, int b, offset_t c, offset_t d -#endif +vn_fclear(struct vnode *a, int32long64_t b, offset_t c, offset_t d , caddr_t e, struct ucred *f) { - register glockOwner, ret; + int glockOwner, ret; glockOwner = ISAFS_GLOCK(); if (!glockOwner) @@ -2379,14 +2220,9 @@ vn_fclear(struct vnode *a, int b, offset_t c, offset_t d } static -#ifdef AFS_AIX51_ENV vn_fsync(struct vnode *a, int32long64_t b, int32long64_t c, struct ucred *d) { -#else -vn_fsync(struct vnode *a, int b, int c, struct ucred *d) -{ -#endif - register glockOwner, ret; + int glockOwner, ret; glockOwner = ISAFS_GLOCK(); if (!glockOwner) @@ -2399,15 +2235,10 @@ vn_fsync(struct vnode *a, int b, int c, struct ucred *d) } static -#ifdef AFS_AIX51_ENV vn_ftrunc(struct vnode *a, int32long64_t b, offset_t c, caddr_t d, struct ucred *e) { -#else -vn_ftrunc(struct vnode *a, int b, offset_t c, caddr_t d, struct ucred *e) -{ -#endif - register glockOwner, ret; + int glockOwner, ret; glockOwner = ISAFS_GLOCK(); if (!glockOwner) @@ -2420,16 +2251,10 @@ vn_ftrunc(struct vnode *a, int b, offset_t c, caddr_t d, struct ucred *e) } static -#ifdef AFS_AIX51_ENV vn_rdwr(struct vnode *a, enum uio_rw b, int32long64_t c, struct uio *d, ext_t e, caddr_t f, struct vattr *v, struct ucred *g) { -#else -vn_rdwr(struct vnode *a, enum uio_rw b, int c, struct uio *d, int e, - caddr_t f, struct vattr *v, struct ucred *g) -{ -#endif - register glockOwner, ret; + int glockOwner, ret; glockOwner = ISAFS_GLOCK(); if (!glockOwner) @@ -2442,16 +2267,10 @@ vn_rdwr(struct vnode *a, enum uio_rw b, int c, struct uio *d, int e, } static -#ifdef AFS_AIX51_ENV vn_lockctl(struct vnode *a, offset_t b, struct eflock *c, int32long64_t d, - int (*e) (), ulong32int64_t * f, struct ucred *g) + int (*e) (), ulong * f, struct ucred *g) { -#else -vn_lockctl(struct vnode *a, offset_t b, struct eflock *c, int d, int (*e) (), - ulong * f, struct ucred *g) -{ -#endif - register glockOwner, ret; + int glockOwner, ret; glockOwner = ISAFS_GLOCK(); if (!glockOwner) @@ -2464,15 +2283,10 @@ vn_lockctl(struct vnode *a, offset_t b, struct eflock *c, int d, int (*e) (), } static -#ifdef AFS_AIX51_ENV vn_ioctl(struct vnode *a, int32long64_t b, caddr_t c, size_t d, ext_t e, struct ucred *f) { -#else -vn_ioctl(struct vnode *a, int b, caddr_t c, size_t d, int e, struct ucred *f) -{ -#endif - register glockOwner, ret; + int glockOwner, ret; glockOwner = ISAFS_GLOCK(); if (!glockOwner) @@ -2487,7 +2301,7 @@ vn_ioctl(struct vnode *a, int b, caddr_t c, size_t d, int e, struct ucred *f) static vn_readlink(struct vnode *a, struct uio *b, struct ucred *c) { - register glockOwner, ret; + int glockOwner, ret; glockOwner = ISAFS_GLOCK(); if (!glockOwner) @@ -2500,15 +2314,10 @@ vn_readlink(struct vnode *a, struct uio *b, struct ucred *c) } static -#ifdef AFS_AIX51_ENV - vn_select(struct vnode *a, int32long64_t b, ushort c, ushort * d, - void (*e) () -#else -vn_select(struct vnode *a, int b, ushort c, ushort * d, void (*e) () -#endif - , caddr_t f, struct ucred *g) +vn_select(struct vnode *a, int32long64_t b, ushort c, ushort * d, + void (*e) (), caddr_t f, struct ucred *g) { - register glockOwner, ret; + int glockOwner, ret; glockOwner = ISAFS_GLOCK(); if (!glockOwner) @@ -2523,7 +2332,7 @@ vn_select(struct vnode *a, int b, ushort c, ushort * d, void (*e) () static vn_symlink(struct vnode *a, char *b, char *c, struct ucred *d) { - register glockOwner, ret; + int glockOwner, ret; glockOwner = ISAFS_GLOCK(); if (!glockOwner) @@ -2538,7 +2347,7 @@ vn_symlink(struct vnode *a, char *b, char *c, struct ucred *d) static vn_readdir(struct vnode *a, struct uio *b, struct ucred *c) { - register glockOwner, ret; + int glockOwner, ret; glockOwner = ISAFS_GLOCK(); if (!glockOwner) @@ -2551,15 +2360,10 @@ vn_readdir(struct vnode *a, struct uio *b, struct ucred *c) } static -#ifdef AFS_AIX51_ENV vn_revoke(struct vnode *a, int32long64_t b, int32long64_t c, struct vattr *d, struct ucred *e) { -#else -vn_revoke(struct vnode *a, int b, int c, struct vattr *d, struct ucred *e) -{ -#endif - register glockOwner, ret; + int glockOwner, ret; glockOwner = ISAFS_GLOCK(); if (!glockOwner) @@ -2574,7 +2378,7 @@ vn_revoke(struct vnode *a, int b, int c, struct vattr *d, struct ucred *e) static vn_getacl(struct vnode *a, struct uio *b, struct ucred *c) { - register glockOwner, ret; + int glockOwner, ret; glockOwner = ISAFS_GLOCK(); if (!glockOwner) @@ -2589,7 +2393,7 @@ vn_getacl(struct vnode *a, struct uio *b, struct ucred *c) static vn_setacl(struct vnode *a, struct uio *b, struct ucred *c) { - register glockOwner, ret; + int glockOwner, ret; glockOwner = ISAFS_GLOCK(); if (!glockOwner) @@ -2604,7 +2408,7 @@ vn_setacl(struct vnode *a, struct uio *b, struct ucred *c) static vn_getpcl(struct vnode *a, struct uio *b, struct ucred *c) { - register glockOwner, ret; + int glockOwner, ret; glockOwner = ISAFS_GLOCK(); if (!glockOwner) @@ -2619,7 +2423,7 @@ vn_getpcl(struct vnode *a, struct uio *b, struct ucred *c) static vn_setpcl(struct vnode *a, struct uio *b, struct ucred *c) { - register glockOwner, ret; + int glockOwner, ret; glockOwner = ISAFS_GLOCK(); if (!glockOwner) @@ -2631,7 +2435,6 @@ vn_setpcl(struct vnode *a, struct uio *b, struct ucred *c) return ret; } -extern int afs_gn_strategy(); struct vnodeops locked_afs_gn_vnodeops = { vn_link, @@ -2662,35 +2465,55 @@ struct vnodeops locked_afs_gn_vnodeops = { vn_select, vn_symlink, vn_readdir, - afs_gn_strategy, /* no locking!!! (discovered the hard way) */ + (int(*)(struct vnode*,struct buf*,struct ucred*)) + afs_gn_strategy, /* no locking!!! (discovered the hard way) */ vn_revoke, vn_getacl, vn_setacl, vn_getpcl, vn_setpcl, - afs_gn_enosys, /* vn_seek */ - afs_gn_enosys, /* vn_fsync_range */ - afs_gn_enosys, /* vn_create_attr */ - afs_gn_enosys, /* vn_finfo */ - afs_gn_enosys, /* vn_map_lloff */ - afs_gn_enosys, /* vn_readdir_eofp */ - afs_gn_enosys, /* vn_rdwr_attr */ - afs_gn_enosys, /* vn_memcntl */ - afs_gn_enosys, /* vn_spare7 */ - afs_gn_enosys, /* vn_spare8 */ - afs_gn_enosys, /* vn_spare9 */ - afs_gn_enosys, /* vn_spareA */ - afs_gn_enosys, /* vn_spareB */ - afs_gn_enosys, /* vn_spareC */ - afs_gn_enosys, /* vn_spareD */ + afs_gn_seek, + (int(*)(struct vnode *, int32long64_t, int32long64_t, offset_t, offset_t, struct ucred *)) + afs_gn_enosys, /* vn_fsync_range */ + (int(*)(struct vnode *, struct vnode **, int32long64_t, char *, struct vattr *, int32long64_t, caddr_t *, struct ucred *)) + afs_gn_enosys, /* vn_create_attr */ + (int(*)(struct vnode *, int32long64_t, void *, size_t, struct ucred *)) + afs_gn_enosys, /* vn_finfo */ + (int(*)(struct vnode *, caddr_t, offset_t, offset_t, uint32long64_t, uint32long64_t, struct ucred *)) + afs_gn_enosys, /* vn_map_lloff */ + (int(*)(struct vnode*,struct uio*,int*,struct ucred*)) + afs_gn_enosys, /* vn_readdir_eofp */ + (int(*)(struct vnode *, enum uio_rw, int32long64_t, struct uio *, ext_t , caddr_t, struct vattr *, struct vattr *, struct ucred *)) + afs_gn_enosys, /* vn_rdwr_attr */ + (int(*)(struct vnode*,int,void*,struct ucred*)) + afs_gn_enosys, /* vn_memcntl */ + (int(*)(struct vnode*,const char*,struct uio*,struct ucred*)) + afs_gn_enosys, /* vn_getea */ + (int(*)(struct vnode*,const char*,struct uio*,int,struct ucred*)) + afs_gn_enosys, /* vn_setea */ + (int(*)(struct vnode *, struct uio *, struct ucred *)) + afs_gn_enosys, /* vn_listea */ + (int(*)(struct vnode *, const char *, struct ucred *)) + afs_gn_enosys, /* vn_removeea */ + (int(*)(struct vnode *, const char *, struct vattr *, struct ucred *)) + afs_gn_enosys, /* vn_statea */ + (int(*)(struct vnode *, uint64_t, acl_type_t *, struct uio *, size_t *, mode_t *, struct ucred *)) + afs_gn_enosys, /* vn_getxacl */ + (int(*)(struct vnode *, uint64_t, acl_type_t, struct uio *, mode_t, struct ucred *)) + afs_gn_enosys, /* vn_setxacl */ afs_gn_enosys, /* vn_spareE */ afs_gn_enosys /* vn_spareF */ #ifdef AFS_AIX51_ENV - , afs_gn_enosys, /* pagerBackRange */ - afs_gn_enosys, /* pagerGetFileSize */ - afs_gn_enosys, /* pagerReadAhead */ - afs_gn_enosys, /* pagerWriteBehind */ - afs_gn_enosys /* pagerEndCopy */ + ,(int(*)(struct gnode*,long long,char*,unsigned long*, unsigned long*,unsigned int*)) + afs_gn_enosys, /* pagerBackRange */ + (int64_t(*)(struct gnode*)) + afs_gn_enosys, /* pagerGetFileSize */ + (void(*)(struct gnode *, vpn_t, vpn_t *, vpn_t *, vpn_t *, boolean_t)) + afs_gn_enosys, /* pagerReadAhead */ + (void(*)(struct gnode *, int64_t, int64_t, uint)) + afs_gn_enosys, /* pagerReadWriteBehind */ + (void(*)(struct gnode*,long long,unsigned long,unsigned long,unsigned int)) + afs_gn_enosys /* pagerEndCopy */ #endif }; @@ -2700,6 +2523,6 @@ struct gfs afs_gfs = { AFS_MOUNT_AFS, "afs", Afs_init, - GFS_VERSION4 | GFS_REMOTE, + GFS_VERSION4 | GFS_VERSION42 | GFS_REMOTE, NULL }; diff --git a/src/afs/VNOPS/afs_vnop_create.c b/src/afs/VNOPS/afs_vnop_create.c index 71ec4a935e..1997970440 100644 --- a/src/afs/VNOPS/afs_vnop_create.c +++ b/src/afs/VNOPS/afs_vnop_create.c @@ -500,9 +500,9 @@ afs_LocalHero(register struct vcache *avc, register struct dcache *adc, hset(avc->m.DataVersion, avers); #ifdef AFS_64BIT_CLIENT FillInt64(avc->m.Length, astat->Length_hi, astat->Length); -#else /* AFS_64BIT_ENV */ +#else /* AFS_64BIT_CLIENT */ avc->m.Length = astat->Length; -#endif /* AFS_64BIT_ENV */ +#endif /* AFS_64BIT_CLIENT */ avc->m.Date = astat->ClientModTime; } if (ok) { diff --git a/src/afs/afs_daemons.c b/src/afs/afs_daemons.c index 60a77c31d6..9f40c3a9c0 100644 --- a/src/afs/afs_daemons.c +++ b/src/afs/afs_daemons.c @@ -617,7 +617,6 @@ afs_BQueue(register short aopcode, register struct vcache *avc, } } -#ifdef AFS_AIX32_ENV #ifdef AFS_AIX41_ENV /* AIX 4.1 has a much different sleep/wakeup mechanism available for use. * The modifications here will work for either a UP or MP machine. @@ -641,9 +640,9 @@ afs_int32 afs_biodcnt = 0; * This function obtains, and returns, a pointer to a buffer for * processing by a daemon. It sleeps until such a buffer is available. * The source of buffers for it is the list afs_asyncbuf (see also - * naix_vm_strategy). This function may be invoked concurrently by + * afs_gn_strategy). This function may be invoked concurrently by * several processes, that is, several instances of the same daemon. - * naix_vm_strategy, which adds buffers to the list, runs at interrupt + * afs_gn_strategy, which adds buffers to the list, runs at interrupt * level, while get_bioreq runs at process level. * * Since AIX 4.1 can wake just one process at a time, the separate sleep @@ -653,7 +652,7 @@ afs_int32 afs_biodcnt = 0; * process and interrupts. */ Simple_lock afs_asyncbuf_lock; -/*static*/ struct buf * +struct buf * afs_get_bioreq() { struct buf *bp = NULL; @@ -869,7 +868,7 @@ afs_BioDaemon(afs_int32 nbiods) /* * buffer may be linked with other buffers via the b_work field. - * See also naix_vm_strategy. For each buffer in the chain (including + * See also afs_gn_strategy. For each buffer in the chain (including * bp) notify all users of the buffer that the daemon is finished * using it by calling iodone. * assumes iodone can modify the b_work field. @@ -891,355 +890,7 @@ afs_BioDaemon(afs_int32 nbiods) } /* infinite loop (unless we're interrupted) */ } /* end of afs_BioDaemon() */ -#else /* AFS_AIX41_ENV */ - - -#define squeue afs_q -struct afs_bioqueue { - struct squeue lruq; - int sleeper; - int cnt; -}; -struct afs_bioqueue afs_bioqueue; -struct buf *afs_busyq = NULL; -struct buf *afs_asyncbuf; -afs_int32 afs_biodcnt = 0; - -/* in implementing this, I assumed that all external linked lists were - * null-terminated. - * - * Several places in this code traverse a linked list. The algorithm - * used here is probably unfamiliar to most people. Careful examination - * will show that it eliminates an assignment inside the loop, as compared - * to the standard algorithm, at the cost of occasionally using an extra - * variable. - */ - -/* get_bioreq() - * - * This function obtains, and returns, a pointer to a buffer for - * processing by a daemon. It sleeps until such a buffer is available. - * The source of buffers for it is the list afs_asyncbuf (see also - * naix_vm_strategy). This function may be invoked concurrently by - * several processes, that is, several instances of the same daemon. - * naix_vm_strategy, which adds buffers to the list, runs at interrupt - * level, while get_bioreq runs at process level. - * - * The common kernel paradigm of sleeping and waking up, in which all the - * competing processes sleep waiting for wakeups on one address, is not - * followed here. Instead, the following paradigm is used: when a daemon - * goes to sleep, it checks for other sleeping daemons. If there aren't any, - * it sleeps on the address of variable afs_asyncbuf. But if there is - * already a daemon sleeping on that address, it threads its own unique - * address onto a list, and sleeps on that address. This way, every - * sleeper is sleeping on a different address, and every wakeup wakes up - * exactly one daemon. This prevents a whole bunch of daemons from waking - * up and then immediately having to go back to sleep. This provides a - * performance gain and makes the I/O scheduling a bit more deterministic. - * The list of sleepers is variable afs_bioqueue. The unique address - * on which to sleep is passed to get_bioreq as its parameter. - */ -/*static*/ struct buf * -afs_get_bioreq(self) - struct afs_bioqueue *self; /* address on which to sleep */ - -{ - struct buf *bp = NULL; - struct buf *bestbp; - struct buf **bestlbpP, **lbpP; - int bestage, stop; - struct buf *t1P, *t2P; /* temp pointers for list manipulation */ - int oldPriority; - afs_uint32 wait_ret; - struct afs_bioqueue *s; - - /* ??? Does the forward pointer of the returned buffer need to be NULL? - */ - - /* Disable interrupts from the strategy function, and save the - * prior priority level - */ - oldPriority = i_disable(INTMAX); - - /* Each iteration of following loop either pulls - * a buffer off afs_asyncbuf, or sleeps. - */ - while (1) { /* inner loop */ - if (afs_asyncbuf) { - /* look for oldest buffer */ - bp = bestbp = afs_asyncbuf; - bestage = (int)bestbp->av_back; - bestlbpP = &afs_asyncbuf; - while (1) { - lbpP = &bp->av_forw; - bp = *lbpP; - if (!bp) - break; - if ((int)bp->av_back - bestage < 0) { - bestbp = bp; - bestlbpP = lbpP; - bestage = (int)bp->av_back; - } - } - bp = bestbp; - *bestlbpP = bp->av_forw; - break; - } else { - int interrupted; - - /* If afs_asyncbuf is null, it is necessary to go to sleep. - * There are two possibilities: either there is already a - * daemon that is sleeping on the address of afs_asyncbuf, - * or there isn't. - */ - if (afs_bioqueue.sleeper) { - /* enqueue */ - QAdd(&(afs_bioqueue.lruq), &(self->lruq)); - interrupted = sleep((caddr_t) self, PCATCH | (PZERO + 1)); - if (self->lruq.next != &self->lruq) { /* XXX ##3 XXX */ - QRemove(&(self->lruq)); /* dequeue */ - } - self->cnt++; - afs_bioqueue.sleeper = FALSE; - if (interrupted) { - /* re-enable interrupts from strategy */ - i_enable(oldPriority); - return (NULL); - } - continue; - } else { - afs_bioqueue.sleeper = TRUE; - interrupted = - sleep((caddr_t) & afs_asyncbuf, PCATCH | (PZERO + 1)); - afs_bioqueue.sleeper = FALSE; - if (interrupted) { - /* - * We need to wakeup another daemon if present - * since we were waiting on afs_asyncbuf. - */ -#ifdef notdef /* The following doesn't work as advertised */ - if (afs_bioqueue.lruq.next != &afs_bioqueue.lruq) { - struct squeue *bq = afs_bioqueue.lruq.next; - QRemove(bq); - wakeup(bq); - } -#endif - /* re-enable interrupts from strategy */ - i_enable(oldPriority); - return (NULL); - } - continue; - } - - } /* end of "else asyncbuf is empty" */ - } /* end of "inner loop" */ - - /*assert (bp); */ - - i_enable(oldPriority); /* re-enable interrupts from strategy */ - - /* For the convenience of other code, replace the gnodes in - * the b_vp field of bp and the other buffers on the b_work - * chain with the corresponding vnodes. - * - * ??? what happens to the gnodes? They're not just cut loose, - * are they? - */ - for (t1P = bp;;) { - t2P = (struct buf *)t1P->b_work; - t1P->b_vp = ((struct gnode *)t1P->b_vp)->gn_vnode; - if (!t2P) - break; - - t1P = (struct buf *)t2P->b_work; - t2P->b_vp = ((struct gnode *)t2P->b_vp)->gn_vnode; - if (!t1P) - break; - } - - /* If the buffer does not specify I/O, it may immediately - * be returned to the caller. This condition is detected - * by examining the buffer's flags (the b_flags field). If - * the B_PFPROT bit is set, the buffer represents a protection - * violation, rather than a request for I/O. The remainder - * of the outer loop handles the case where the B_PFPROT bit is clear. - */ - if (bp->b_flags & B_PFPROT) { - return (bp); - } - - /* wake up another process to handle the next buffer, and return - * bp to the caller. - */ - oldPriority = i_disable(INTMAX); - - /* determine where to find the sleeping process. - * There are two cases: either it is sleeping on - * afs_asyncbuf, or it is sleeping on its own unique - * address. These cases are distinguished by examining - * the sleeper field of afs_bioqueue. - */ - if (afs_bioqueue.sleeper) { - wakeup(&afs_asyncbuf); - } else { - if (afs_bioqueue.lruq.next == &afs_bioqueue.lruq) { - /* queue is empty, what now? ??? */ - /* Should this be impossible, or does */ - /* it just mean that nobody is sleeping? */ ; - } else { - struct squeue *bq = afs_bioqueue.lruq.next; - QRemove(bq); - QInit(bq); - wakeup(bq); - afs_bioqueue.sleeper = TRUE; - } - } - i_enable(oldPriority); /* re-enable interrupts from strategy */ - return (bp); - -} /* end of function get_bioreq() */ - - -/* afs_BioDaemon - * - * This function is the daemon. It is called from the syscall - * interface. Ordinarily, a script or an administrator will run a - * daemon startup utility, specifying the number of I/O daemons to - * run. The utility will fork off that number of processes, - * each making the appropriate syscall, which will cause this - * function to be invoked. - */ -static int afs_initbiod = 0; /* this is self-initializing code */ -int DOvmlock = 0; -afs_BioDaemon(nbiods) - afs_int32 nbiods; -{ - struct afs_bioqueue *self; - afs_int32 code, s, pflg = 0; - label_t jmpbuf; - struct buf *bp, *bp1, *tbp1, *tbp2; /* temp pointers only */ - caddr_t tmpaddr; - struct vnode *vp; - struct vcache *vcp; - char tmperr; - if (!afs_initbiod) { - /* XXX ###1 XXX */ - afs_initbiod = 1; - /* Initialize the queue of waiting processes, afs_bioqueue. */ - QInit(&(afs_bioqueue.lruq)); - } - - /* establish ourself as a kernel process so shutdown won't kill us */ -/* u.u_procp->p_flag |= SKPROC;*/ - - /* Initialize a token (self) to use in the queue of sleeping processes. */ - self = (struct afs_bioqueue *)afs_osi_Alloc(sizeof(struct afs_bioqueue)); - pin(self, sizeof(struct afs_bioqueue)); /* fix in memory */ - memset(self, 0, sizeof(*self)); - QInit(&(self->lruq)); /* initialize queue entry pointers */ - - - /* Ignore HUP signals... */ - SIGDELSET(u.u_procp->p_sig, SIGHUP); - SIGADDSET(u.u_procp->p_sigignore, SIGHUP); - SIGDELSET(u.u_procp->p_sigcatch, SIGHUP); - /* Main body starts here -- this is an intentional infinite loop, and - * should NEVER exit - * - * Now, the loop will exit if get_bioreq() returns NULL, indicating - * that we've been interrupted. - */ - while (1) { - bp = afs_get_bioreq(self); - if (!bp) - break; /* we were interrupted */ - if (code = setjmpx(&jmpbuf)) { - /* This should not have happend, maybe a lack of resources */ - s = splimp(); - for (bp1 = bp; bp; bp = bp1) { - if (bp1) - bp1 = bp1->b_work; - bp->b_actf = 0; - bp->b_error = code; - bp->b_flags |= B_ERROR; - iodone(bp); - } - splx(s); - continue; - } - vcp = VTOAFS(bp->b_vp); - if (bp->b_flags & B_PFSTORE) { - ObtainWriteLock(&vcp->lock, 210); - if (vcp->v.v_gnode->gn_mwrcnt) { - afs_offs_t newlength = - (afs_offs_t) dbtob(bp->b_blkno) + bp->b_bcount; - if (vcp->m.Length < newlength) { - afs_Trace4(afs_iclSetp, CM_TRACE_SETLENGTH, - ICL_TYPE_STRING, __FILE__, ICL_TYPE_LONG, - __LINE__, ICL_TYPE_OFFSET, - ICL_HANDLE_OFFSET(vcp->m.Length), - ICL_TYPE_OFFSET, ICL_HANDLE_OFFSET(newlength)); - vcp->m.Length = newlength; - } - } - ReleaseWriteLock(&vcp->lock); - } - /* If the buffer represents a protection violation, rather than - * an actual request for I/O, no special action need be taken. - */ - if (bp->b_flags & B_PFPROT) { - iodone(bp); /* Notify all users of the buffer that we're done */ - continue; - } - if (DOvmlock) - ObtainWriteLock(&vcp->pvmlock, 558); - /* - * First map its data area to a region in the current address space - * by calling vm_att with the subspace identifier, and a pointer to - * the data area. vm_att returns a new data area pointer, but we - * also want to hang onto the old one. - */ - tmpaddr = bp->b_baddr; - bp->b_baddr = vm_att(bp->b_xmemd.subspace_id, tmpaddr); - tmperr = afs_ustrategy(bp); /* temp variable saves offset calculation */ - if (tmperr) { /* in non-error case */ - bp->b_flags |= B_ERROR; /* should other flags remain set ??? */ - bp->b_error = tmperr; - } - - /* Unmap the buffer's data area by calling vm_det. Reset data area - * to the value that we saved above. - */ - vm_det(bp->b_un.b_addr); - bp->b_baddr = tmpaddr; - - /* - * buffer may be linked with other buffers via the b_work field. - * See also naix_vm_strategy. For each buffer in the chain (including - * bp) notify all users of the buffer that the daemon is finished - * using it by calling iodone. - * assumes iodone can modify the b_work field. - */ - for (tbp1 = bp;;) { - tbp2 = (struct buf *)tbp1->b_work; - iodone(tbp1); - if (!tbp2) - break; - - tbp1 = (struct buf *)tbp2->b_work; - iodone(tbp2); - if (!tbp1) - break; - } - if (DOvmlock) - ReleaseWriteLock(&vcp->pvmlock); /* Unlock the vnode. */ - clrjmpx(&jmpbuf); - } /* infinite loop (unless we're interrupted) */ - unpin(self, sizeof(struct afs_bioqueue)); - afs_osi_Free(self, sizeof(struct afs_bioqueue)); -} /* end of afs_BioDaemon() */ #endif /* AFS_AIX41_ENV */ -#endif /* AFS_AIX32_ENV */ int afs_nbrs = 0; @@ -1341,16 +992,10 @@ shutdown_daemons(void) memset((char *)afs_brs, 0, sizeof(afs_brs)); memset((char *)&afs_xbrs, 0, sizeof(afs_lock_t)); afs_brsWaiters = 0; -#ifdef AFS_AIX32_ENV #ifdef AFS_AIX41_ENV lock_free(&afs_asyncbuf_lock); unpin(&afs_asyncbuf, sizeof(struct buf *)); unpin(&afs_asyncbuf_cv, sizeof(afs_int32)); -#else /* AFS_AIX41_ENV */ - afs_busyq = NULL; - afs_biodcnt = 0; - memset((char *)&afs_bioqueue, 0, sizeof(struct afs_bioqueue)); -#endif afs_initbiod = 0; #endif } diff --git a/src/rx/AIX/rx_kmutex.h b/src/rx/AIX/rx_kmutex.h index ed8f5513dc..6b028fec3c 100644 --- a/src/rx/AIX/rx_kmutex.h +++ b/src/rx/AIX/rx_kmutex.h @@ -45,7 +45,6 @@ #define CV_BROADCAST(_cv) e_wakeup(_cv) typedef simple_lock_data afs_kmutex_t; typedef tid_t afs_kcondvar_t; -#define osi_rxWakeup(cv) e_wakeup(cv) #define LOCK_INIT(a, b) lock_alloc((void*)(a), LOCK_ALLOC_PIN, 1, 1), \ diff --git a/src/rx/AIX/rx_knet.c b/src/rx/AIX/rx_knet.c index 6ccd1e30c9..d3634c9809 100644 --- a/src/rx/AIX/rx_knet.c +++ b/src/rx/AIX/rx_knet.c @@ -19,15 +19,14 @@ RCSID static struct protosw parent_proto; /* udp proto switch */ static void -rxk_input(am, hlen) - register struct mbuf *am; +rxk_input(struct mbuf *am, int hlen) { - register unsigned short *tsp; + unsigned short *tsp; int hdr; struct udphdr *tu; - register struct ip *ti; + struct ip *ti; struct udpiphdr *tvu; - register int i; + int i; char *phandle; long code; struct sockaddr_in taddr; @@ -80,8 +79,7 @@ static struct ifqueue rxk_q; /* RXKluge queue */ static struct arpcom rxk_bogosity; /* rxk_kpork - send pkt over to netwerk kporc for processing */ -rxk_kpork(m) - register struct mbuf *m; +rxk_kpork(struct mbuf *m) { find_input_type(0xdead, m, &rxk_bogosity, 0); } @@ -108,8 +106,8 @@ void ip_stripoptions(struct mbuf *m, STRIP_ARG2_TYPE mopt) { struct ip *ip = mtod(m, struct ip *); - register int i; - register caddr_t opts; + int i; + caddr_t opts; int olen; olen = (ip->ip_hl << 2) - sizeof(struct ip); @@ -123,16 +121,15 @@ ip_stripoptions(struct mbuf *m, STRIP_ARG2_TYPE mopt) } /* rxk_RX_input - RX pkt input process */ -rxk_RX_input(am) - register struct mbuf *am; +rxk_RX_input(struct mbuf *am) { - register unsigned short *tsp; + unsigned short *tsp; int hdr; struct udphdr *tu; - register struct ip *ti; + struct ip *ti; struct udpiphdr *tvu; - register int i; - char *phandle; + int i; + struct rx_packet *phandle; long code; struct sockaddr_in taddr; int tlen; @@ -245,7 +242,7 @@ rxk_RX_input(am) static rxk_isr() { - register struct mbuf *m; + struct mbuf *m; IFQ_LOCK_DECL(); /* silly macro has trailing ';'. Sigh. */ while (1) { IF_DEQUEUE(&rxk_q, m); @@ -263,7 +260,7 @@ rxk_isr() static void rxk_fasttimo(void) { - int (*tproc) (); + void (*tproc) (void); struct clock temp; /* do rx fasttimo processing here */ @@ -276,7 +273,7 @@ rxk_fasttimo(void) void rxk_init(void) { - register struct protosw *pr; + struct protosw *pr; extern struct protosw *pffindproto(); if (!rxk_initDone && (pr = pffindproto(AF_INET, IPPROTO_UDP, SOCK_DGRAM))) { @@ -307,8 +304,8 @@ rxk_init(void) void shutdown_rxkernel(void) { - register struct protosw *pr; - register int i; + struct protosw *pr; + int i; extern struct protosw *pffindproto(); if (rxk_initDone && (pr = pffindproto(AF_INET, IPPROTO_UDP, SOCK_DGRAM))) { @@ -347,10 +344,10 @@ int osi_NetSend(osi_socket asocket, struct sockaddr_in *addr, struct iovec *dvec, int nvec, afs_int32 asize, int istack) { - register struct mbuf *tm, *um; - register afs_int32 code; + struct mbuf *tm, *um; + afs_int32 code; struct mbuf *top = 0; - register struct mbuf *m, **mp; + struct mbuf *m, **mp; int len, mlen; char *tdata; caddr_t tpa; diff --git a/src/rx/rx_kcommon.c b/src/rx/rx_kcommon.c index d37d93d6f6..2247ee72ff 100644 --- a/src/rx/rx_kcommon.c +++ b/src/rx/rx_kcommon.c @@ -26,8 +26,8 @@ RCSID #include "afsint.h" #ifndef RXK_LISTENER_ENV -int (*rxk_PacketArrivalProc) (register struct rx_packet * ahandle, register struct sockaddr_in * afrom, char *arock, afs_int32 asize); /* set to packet allocation procedure */ -int (*rxk_GetPacketProc) (char **ahandle, int asize); +int (*rxk_PacketArrivalProc) (struct rx_packet * ahandle, struct sockaddr_in * afrom, struct socket *arock, afs_int32 asize); /* set to packet allocation procedure */ +int (*rxk_GetPacketProc) (struct rx_packet **ahandle, int asize); #endif osi_socket *rxk_NewSocketHost(afs_uint32 ahost, short aport); @@ -289,9 +289,9 @@ rx_ServerProc(void) #ifndef RXK_LISTENER_ENV /* asize includes the Rx header */ static int -MyPacketProc(char **ahandle, int asize) +MyPacketProc(struct rx_packet **ahandle, int asize) { - register struct rx_packet *tp; + struct rx_packet *tp; /* If this is larger than we expected, increase rx_maxReceiveDataSize */ /* If we can't scrounge enough cbufs, then we have to drop the packet, @@ -328,20 +328,21 @@ MyPacketProc(char **ahandle, int asize) if (!tp) return -1; /* otherwise we have a packet, set appropriate values */ - *ahandle = (char *)tp; + *ahandle = tp; return 0; } static int -MyArrivalProc(register struct rx_packet *ahandle, - register struct sockaddr_in *afrom, char *arock, +MyArrivalProc(struct rx_packet *ahandle, + struct sockaddr_in *afrom, + struct socket *arock, afs_int32 asize) { /* handle basic rx packet */ ahandle->length = asize - RX_HEADER_SIZE; rxi_DecodePacketHeader(ahandle); ahandle = - rxi_ReceivePacket(ahandle, (struct socket *)arock, + rxi_ReceivePacket(ahandle, arock, afrom->sin_addr.s_addr, afrom->sin_port, NULL, NULL); diff --git a/src/rx/rx_prototypes.h b/src/rx/rx_prototypes.h index f76b15714c..baccb55956 100644 --- a/src/rx/rx_prototypes.h +++ b/src/rx/rx_prototypes.h @@ -309,10 +309,11 @@ extern afs_int32 rxi_getaddr(void); /* rx_kcommon.c */ -extern int (*rxk_PacketArrivalProc) (register struct rx_packet * ahandle, - register struct sockaddr_in * afrom, - char *arock, afs_int32 asize); -extern int (*rxk_GetPacketProc) (char **ahandle, int asize); +extern int (*rxk_PacketArrivalProc) (struct rx_packet * ahandle, + struct sockaddr_in * afrom, + struct socket *arock, + afs_int32 asize); +extern int (*rxk_GetPacketProc) (struct rx_packet **ahandle, int asize); extern afs_int32 afs_termState; extern int rxk_initDone; diff --git a/src/sys/afs5.exp b/src/sys/afs5.exp index 0ebc341ca5..7b1509e46f 100644 --- a/src/sys/afs5.exp +++ b/src/sys/afs5.exp @@ -3,7 +3,7 @@ * $Locker$ * * -* Exports for the AFS kernel extension for AIX 3.1 +* Exports for the AFS kernel extension for AIX 5 * icreate syscall syscall syscall @@ -54,7 +54,6 @@ afs_marinerHost * afs_marinerPort afs_mariner cacheInfoModTime -freeVCList afs_freeDCList afs_freeDCCount afs_freeDSList