From f43c2f4412d670ce1131dc429cb43302352df3e4 Mon Sep 17 00:00:00 2001 From: Hartmut Reuter Date: Tue, 1 Jul 2003 23:02:58 +0000 Subject: [PATCH] aix-51-support-20030701 FIXES 1661 make afs work for aix5.1 64 bit. some code cleanup --- src/afs/AIX/osi_assem32.s | 43 +++++ src/afs/AIX/osi_assem64.s | 43 +++++ src/afs/AIX/osi_config.c | 19 ++ src/afs/AIX/osi_file.c | 19 ++ src/afs/AIX/osi_groups.c | 2 +- src/afs/AIX/osi_inode.c | 9 + src/afs/AIX/osi_misc.c | 10 ++ src/afs/AIX/osi_sleep.c | 2 +- src/afs/AIX/osi_vm.c | 12 +- src/afs/AIX/osi_vnodeops.c | 106 ++++++----- src/afs/UKERNEL/afs_usrops.c | 2 +- src/afs/UKERNEL/sysincludes.h | 3 + src/afs/VNOPS/afs_vnop_attrs.c | 11 +- src/afs/VNOPS/afs_vnop_read.c | 203 +++------------------- src/afs/VNOPS/afs_vnop_readdir.c | 12 +- src/afs/VNOPS/afs_vnop_strategy.c | 2 +- src/afs/VNOPS/afs_vnop_write.c | 6 +- src/afs/afs_call.c | 33 ++-- src/afs/afs_cell.c | 2 +- src/afs/afs_daemons.c | 19 +- src/afs/afs_dcache.c | 6 + src/afs/afs_lock.c | 6 +- src/afs/afs_memcache.c | 8 +- src/afs/afs_osi.c | 8 +- src/afs/afs_osi.h | 8 + src/afs/afs_pioctl.c | 11 ++ src/afs/afs_segments.c | 14 +- src/afs/afs_trace.et | 45 ++--- src/afs/afs_vcache.c | 2 +- src/afsd/rc.afs.rs_aix | 20 ++- src/afsd/rc.dkload.client.rs_aix | 18 +- src/export/Makefile.in | 4 +- src/export/export.c | 6 +- src/export/{export.exp => export4-64.exp} | 0 src/export/export4.exp | 16 ++ src/export/export5-64.exp | 15 ++ src/export/export5.exp | 3 +- src/libafs/MakefileProto.AIX.in | 118 +++++++++---- src/rx/AIX/rx_kmutex.h | 2 +- src/rx/AIX/rx_knet.c | 38 ++++ src/rx/rx.c | 45 +++++ src/rx/rx.h | 4 + src/rx/rx_clock.h | 10 ++ src/rx/rx_kcommon.c | 4 + src/rx/rx_kcommon.h | 2 +- src/rx/rx_packet.c | 39 +++++ src/rx/rx_rdwr.c | 17 ++ src/rx/xdr_int64.c | 8 +- src/sys/Makefile.in | 40 ++++- src/sys/{afs.exp => afs4.exp} | 0 src/sys/afs5.exp | 140 +++++++++++++++ src/sys/{afsl.exp => afsl4.exp} | 0 src/sys/afsl5.exp | 27 +++ src/tsm41/aix41_auth.c | 79 ++++++--- src/venus/fstrace.c | 17 +- src/vol/vnode.h | 4 +- src/volser/dumpstuff.c | 8 +- 57 files changed, 966 insertions(+), 384 deletions(-) create mode 100644 src/afs/AIX/osi_assem32.s create mode 100644 src/afs/AIX/osi_assem64.s rename src/export/{export.exp => export4-64.exp} (100%) create mode 100644 src/export/export4.exp create mode 100644 src/export/export5-64.exp rename src/sys/{afs.exp => afs4.exp} (100%) create mode 100644 src/sys/afs5.exp rename src/sys/{afsl.exp => afsl4.exp} (100%) create mode 100644 src/sys/afsl5.exp diff --git a/src/afs/AIX/osi_assem32.s b/src/afs/AIX/osi_assem32.s new file mode 100644 index 000000000..882a0e5f2 --- /dev/null +++ b/src/afs/AIX/osi_assem32.s @@ -0,0 +1,43 @@ +# Copyright 2000, International Business Machines Corporation and others. +# All Rights Reserved. +# +# This software has been released under the terms of the IBM Public +# License. For details, see the LICENSE file in the top-level source +# directory or online at http://www.openafs.org/dl/license10.html + +# $Locker$ +# +# misc.s - miscellaneous assembler routines for the rs/6000 +# + +# +# get_toc - return the current TOC +# + .csect .get_toc[PR] + .globl .get_toc[PR] + mr 3,2 # get TOC + br + .align 2 + .tbtag 0x0,0xc,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0 + + .toc + .csect get_toc[DS] + .globl get_toc[DS] + .long .get_toc[PR] + .long TOC[t0] + +# +# get_ret_addr - return the caller's return address +# + .csect .get_ret_addr[PR] + .globl .get_ret_addr[PR] + l 3, 0(1) # caller's saved stack pointer + l 3, 8(3) # caller's saved link register + br + .align 2 + .tbtag 0x0,0xc,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0 + .toc + .csect get_ret_addr[DS] + .globl get_ret_addr[DS] + .long .get_ret_addr[PR] + .long TOC[t0] diff --git a/src/afs/AIX/osi_assem64.s b/src/afs/AIX/osi_assem64.s new file mode 100644 index 000000000..57220a5f9 --- /dev/null +++ b/src/afs/AIX/osi_assem64.s @@ -0,0 +1,43 @@ +# Copyright 2000, International Business Machines Corporation and others. +# All Rights Reserved. +# +# This software has been released under the terms of the IBM Public +# License. For details, see the LICENSE file in the top-level source +# directory or online at http://www.openafs.org/dl/license10.html + +# $Locker$ +# +# misc.s - miscellaneous assembler routines for the rs/6000 +# + +# +# get_toc - return the current TOC +# + .csect .get_toc[PR] + .globl .get_toc[PR] + mr 3,2 # get TOC + br + .align 2 + .tbtag 0x0,0xc,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0 + + .toc + .csect get_toc[DS] + .globl get_toc[DS] + .llong .get_toc[PR] + .llong TOC[t0] + +# +# get_ret_addr - return the caller's return address +# + .csect .get_ret_addr[PR] + .globl .get_ret_addr[PR] + l 3, 0(1) # caller's saved stack pointer + l 3, 8(3) # caller's saved link register + br + .align 2 + .tbtag 0x0,0xc,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0 + .toc + .csect get_ret_addr[DS] + .globl get_ret_addr[DS] + .llong .get_ret_addr[PR] + .llong TOC[t0] diff --git a/src/afs/AIX/osi_config.c b/src/afs/AIX/osi_config.c index 12416ec88..4fd353361 100644 --- a/src/afs/AIX/osi_config.c +++ b/src/afs/AIX/osi_config.c @@ -75,6 +75,12 @@ long db_tflags = 0; extern struct gfs afs_gfs; extern struct vnodeops locked_afs_gn_vnodeops; +#ifdef __64BIT__ +afs_uint64 get_toc(); +#else +afs_uint32 get_toc(); +#endif + #define AFS_CALLOUT_TBL_SIZE 256 #include @@ -272,7 +278,11 @@ struct k_var kvars[] = { kluge_init() { register struct k_func *kf; register struct k_var *kv; +#ifdef __64BIT__ + register afs_uint64 toc; +#else register afs_uint32 toc; +#endif register err = 0; toc = get_toc(); @@ -334,10 +344,19 @@ struct inode **ipp; { iget(dev, ino, ipp, doscan, vfsp) dev_t dev; ino_t ino; +#ifdef __64BIT__ +afs_size_t doscan; +#endif struct vfs *vfsp; struct inode **ipp; { +#ifdef __64BIT__ + afs_int64 dummy[10]; + dummy[0] = doscan; + return (*kluge_iget)(dev, ino, ipp, (afs_size_t) doscan, vfsp, &dummy); +#else return (*kluge_iget)(dev, ino, ipp, doscan, vfsp); +#endif } iput(ip, vfsp) diff --git a/src/afs/AIX/osi_file.c b/src/afs/AIX/osi_file.c index f898f40f2..63f29e105 100644 --- a/src/afs/AIX/osi_file.c +++ b/src/afs/AIX/osi_file.c @@ -166,8 +166,13 @@ int afs_osi_Read(register struct osi_file *afile, int offset, void *aptr, afs_in retry_IO: /* Note the difference in the way the afile->offset is passed (see comments in gop_rdwr() in afs_aix_subr.c for comments) */ AFS_GUNLOCK(); +#ifdef AFS_64BIT_KERNEL + code = gop_rdwr(UIO_READ, afile->vnode, (caddr_t) aptr, asize, + &afile->offset, AFS_UIOSYS, NULL, &resid); +#else code = gop_rdwr(UIO_READ, afile->vnode, (caddr_t) aptr, asize, (off_t)&afile->offset, AFS_UIOSYS, NULL, &resid); +#endif AFS_GLOCK(); if (code == 0) { code = asize - resid; @@ -203,14 +208,28 @@ int afs_osi_Write(register struct osi_file *afile, afs_int32 offset, void *aptr, if (offset != -1) afile->offset = offset; /* Note the difference in the way the afile->offset is passed (see comments in gop_rdwr() in afs_aix_subr.c for comments) */ AFS_GUNLOCK(); +#ifdef AFS_64BIT_KERNEL + code = gop_rdwr(UIO_WRITE, afile->vnode, (caddr_t) aptr, asize, + &afile->offset, AFS_UIOSYS, NULL, &resid); +#else code = gop_rdwr(UIO_WRITE, afile->vnode, (caddr_t) aptr, asize, (off_t)&afile->offset, AFS_UIOSYS, NULL, &resid); +#endif AFS_GLOCK(); if (code == 0) { + if (resid) + afs_Trace3(afs_iclSetp, CM_TRACE_WRITEFAILED, + ICL_TYPE_INT32, asize, + ICL_TYPE_INT32, resid, + ICL_TYPE_INT32, code); code = asize - resid; afile->offset += code; } else { + afs_Trace3(afs_iclSetp, CM_TRACE_WRITEFAILED, + ICL_TYPE_INT32, asize, + ICL_TYPE_INT32, resid, + ICL_TYPE_INT32, code); if (code == ENOSPC) afs_warnuser("\n\n\n*** Cache partition is FULL - Decrease cachesize!!! ***\n\n"); setuerror(code); code = -1; diff --git a/src/afs/AIX/osi_groups.c b/src/afs/AIX/osi_groups.c index a9f3fa67c..3fd8539d1 100644 --- a/src/afs/AIX/osi_groups.c +++ b/src/afs/AIX/osi_groups.c @@ -36,7 +36,7 @@ afs_setgroups( gid_t *gidset, int change_parent); -#ifndef AFS_AIX5_ENV +#ifndef AFS_AIX51_ENV int setgroups(ngroups, gidset) int ngroups; diff --git a/src/afs/AIX/osi_inode.c b/src/afs/AIX/osi_inode.c index 44c383bd4..6236e5c08 100644 --- a/src/afs/AIX/osi_inode.c +++ b/src/afs/AIX/osi_inode.c @@ -156,6 +156,7 @@ int IGI_mode; /* get an existing inode. Common code for iopen, iread/write, iinc/dec. */ /* Also used by rmt_remote to support passing of inode number from venus */ extern int iget(); +extern struct vnode *filevp; struct inode * igetinode(dev, vfsp, inode, vpp,perror) struct vfs *vfsp; @@ -178,7 +179,11 @@ igetinode(dev, vfsp, inode, vpp,perror) * If it isn't, then we need to reexamine our code to make * sure that it is still okay. */ +#ifdef __64BIT__ +/* osi_Assert(offsetof(struct inode, afs_inode_lock) == 208); */ +#else osi_Assert(offsetof(struct inode, afs_inode_lock) == 128); +#endif if (!vfsp && !(vfsp = devtovfs((dev_t)dev))) { afs_warn("Dev=%d not mounted!!; quitting\n", dev); @@ -201,7 +206,11 @@ igetinode(dev, vfsp, inode, vpp,perror) } ICACHE_LOCK(); +#ifdef __64BIT__ + if ((code = iget(dev, inode, &ip, (afs_size_t) 1, nvfsp))) { +#else if ((code = iget(dev, inode, &ip, 1, nvfsp))) { +#endif IGI_error = code; IGI_inode = inode; *perror = BAD_IGET; diff --git a/src/afs/AIX/osi_misc.c b/src/afs/AIX/osi_misc.c index bb3b99eca..9e86a7f60 100644 --- a/src/afs/AIX/osi_misc.c +++ b/src/afs/AIX/osi_misc.c @@ -85,7 +85,11 @@ gop_rdwr(rw, vp, base, len, offset, segflg, unit, aresid) enum uio_rw rw; struct vnode *vp; caddr_t base; +#ifdef AFS_64BIT_KERNEL +offset_t *offset; +#else off_t *offset; +#endif int len, segflg; int *aresid; int unit; /* Ignored */ @@ -106,8 +110,14 @@ int unit; /* Ignored */ uio_struct.uio_resid = len; uio_struct.uio_fmode = (rw == UIO_READ ? FREAD : FWRITE); +#ifdef AFS_64BIT_KERNEL + code = VNOP_RDWR(vp, rw, + (int32long64_t)(rw == UIO_READ ? FREAD : FWRITE), &uio_struct, + (ext_t) 0, (caddr_t) 0, (struct vattr *)0, &afs_osi_cred); +#else code = VNOP_RDWR(vp, rw, (rw == UIO_READ ? FREAD : FWRITE), &uio_struct, NULL, NULL, NULL, &afs_osi_cred); +#endif *aresid = uio_struct.uio_resid; return code; } diff --git a/src/afs/AIX/osi_sleep.c b/src/afs/AIX/osi_sleep.c index d43632eec..337947897 100644 --- a/src/afs/AIX/osi_sleep.c +++ b/src/afs/AIX/osi_sleep.c @@ -85,7 +85,7 @@ typedef struct afs_event { int seq; /* Sequence number: this is incremented by wakeup calls; wait will not return until it changes */ - int cond; + tid_t cond; } afs_event_t; #define HASHSIZE 128 diff --git a/src/afs/AIX/osi_vm.c b/src/afs/AIX/osi_vm.c index 8a9cc0a20..d4b616950 100644 --- a/src/afs/AIX/osi_vm.c +++ b/src/afs/AIX/osi_vm.c @@ -68,7 +68,7 @@ int osi_VM_FlushVCache(struct vcache *avc, int *slept) */ void osi_VM_StoreAllSegments(struct vcache *avc) { - if (avc->vmh) { + if (avc->segid) { /* * The execsOrWriters test is done so that we don't thrash on * the vm_writep call below. We only initiate a pageout of the @@ -82,8 +82,8 @@ void osi_VM_StoreAllSegments(struct vcache *avc) */ ReleaseWriteLock(&avc->lock); /* XXX */ AFS_GUNLOCK(); - vm_writep(avc->vmh, 0, MAXFSIZE/PAGESIZE -1 ); - vms_iowait(avc->vmh); + vm_writep(avc->segid, 0, MAXFSIZE/PAGESIZE -1 ); + vms_iowait(avc->segid); AFS_GLOCK(); ObtainWriteLock(&avc->lock,93); /* XXX */ /* @@ -125,7 +125,7 @@ void osi_VM_TryToSmush(struct vcache *avc, struct AFS_UCRED *acred, ReleaseWriteLock(&avc->lock); AFS_GUNLOCK(); vm_flushp(avc->segid, 0, MAXFSIZE/PAGESIZE - 1); - vms_iowait(avc->vmh); /* XXX Wait?? XXX */ + vms_iowait(avc->segid); /* XXX Wait?? XXX */ AFS_GLOCK(); ObtainWriteLock(&avc->lock,60); } @@ -142,7 +142,7 @@ void osi_VM_FlushPages(struct vcache *avc, struct AFS_UCRED *credp) /* * XXX We probably don't need to wait but better be safe XXX */ - vms_iowait(avc->vmh); + vms_iowait(avc->segid); } } @@ -157,6 +157,6 @@ void osi_VM_Truncate(struct vcache *avc, int alen, struct AFS_UCRED *acred) if (avc->segid) { int firstpage = (alen + PAGESIZE-1)/PAGESIZE; vm_releasep(avc->segid, firstpage, MAXFSIZE/PAGESIZE - firstpage); - vms_iowait(avc->vmh); /* Do we need this? */ + vms_iowait(avc->segid); /* Do we need this? */ } } diff --git a/src/afs/AIX/osi_vnodeops.c b/src/afs/AIX/osi_vnodeops.c index fa1314307..1952cf6e2 100644 --- a/src/afs/AIX/osi_vnodeops.c +++ b/src/afs/AIX/osi_vnodeops.c @@ -187,7 +187,7 @@ struct ucred *cred; AFS_STATCNT(afs_gn_link); error = afs_link(vp, dp, name, cred); - afs_Trace3(afs_iclSetp, CM_TRACE_GNLINK, ICL_TYPE_POINTER, (afs_int32)vp, + afs_Trace3(afs_iclSetp, CM_TRACE_GNLINK, ICL_TYPE_POINTER, vp, ICL_TYPE_STRING, name, ICL_TYPE_LONG, error); return(error); } @@ -217,7 +217,7 @@ struct ucred *cred; if (! error) { AFS_RELE(vp); } - afs_Trace4(afs_iclSetp, CM_TRACE_GMKDIR, ICL_TYPE_POINTER, (afs_int32)vp, + afs_Trace4(afs_iclSetp, CM_TRACE_GMKDIR, ICL_TYPE_POINTER, vp, ICL_TYPE_STRING, name, ICL_TYPE_LONG, mode, ICL_TYPE_LONG, error); return(error); } @@ -282,7 +282,7 @@ struct ucred *cred; AFS_STATCNT(afs_gn_remove); error = afs_remove(dp, name, cred); - afs_Trace3(afs_iclSetp, CM_TRACE_GREMOVE, ICL_TYPE_POINTER, (afs_int32)dp, + afs_Trace3(afs_iclSetp, CM_TRACE_GREMOVE, ICL_TYPE_POINTER, dp, ICL_TYPE_STRING, name, ICL_TYPE_LONG, error); return(error); } @@ -302,7 +302,7 @@ struct ucred *cred; AFS_STATCNT(afs_gn_rename); error = afs_rename(dp, name, tdp, tname, cred); - afs_Trace4(afs_iclSetp, CM_TRACE_GRENAME, ICL_TYPE_POINTER, (afs_int32)dp, + afs_Trace4(afs_iclSetp, CM_TRACE_GRENAME, ICL_TYPE_POINTER, dp, ICL_TYPE_STRING, name, ICL_TYPE_STRING, tname, ICL_TYPE_LONG, error); return(error); } @@ -323,7 +323,7 @@ struct ucred *cred; if (error == 66 /* 4.3's ENOTEMPTY */) error = EEXIST; /* AIX returns EEXIST where 4.3 used ENOTEMPTY */ } - afs_Trace3(afs_iclSetp, CM_TRACE_GRMDIR, ICL_TYPE_POINTER, (afs_int32)dp, + afs_Trace3(afs_iclSetp, CM_TRACE_GRMDIR, ICL_TYPE_POINTER, dp, ICL_TYPE_STRING, name, ICL_TYPE_LONG, error); return(error); } @@ -347,7 +347,7 @@ struct ucred *cred; AFS_STATCNT(afs_gn_lookup); error = afs_lookup(dp, name, vpp, cred); - afs_Trace3(afs_iclSetp, CM_TRACE_GLOOKUP, ICL_TYPE_POINTER, (afs_int32)dp, + afs_Trace3(afs_iclSetp, CM_TRACE_GLOOKUP, ICL_TYPE_POINTER, dp, ICL_TYPE_STRING, name, ICL_TYPE_LONG, error); if (vattrp != NULL && error == 0) afs_gn_getattr(*vpp, vattrp, cred); @@ -365,7 +365,7 @@ struct ucred *cred; AFS_STATCNT(afs_gn_fid); error = afs_fid(vp, fidp); - afs_Trace3(afs_iclSetp, CM_TRACE_GFID, ICL_TYPE_POINTER, (afs_int32)vp, + afs_Trace3(afs_iclSetp, CM_TRACE_GFID, ICL_TYPE_POINTER, vp, ICL_TYPE_LONG, (afs_int32)fidp, ICL_TYPE_LONG, error); return(error); } @@ -434,7 +434,7 @@ struct ucred *cred; } abort: - afs_Trace3(afs_iclSetp, CM_TRACE_GOPEN, ICL_TYPE_POINTER, (afs_int32)vp, + afs_Trace3(afs_iclSetp, CM_TRACE_GOPEN, ICL_TYPE_POINTER, vp, ICL_TYPE_LONG, flags, ICL_TYPE_LONG, error); return(error); } @@ -495,7 +495,7 @@ struct ucred *cred; *vinfop = cred; /* save user creds in fp->f_vinfo */ error = afs_open(vpp, flags, cred); } - afs_Trace4(afs_iclSetp, CM_TRACE_GCREATE, ICL_TYPE_POINTER, (afs_int32)dp, + afs_Trace4(afs_iclSetp, CM_TRACE_GCREATE, ICL_TYPE_POINTER, dp, ICL_TYPE_STRING, name, ICL_TYPE_LONG, mode, ICL_TYPE_LONG, error); return error; } @@ -593,7 +593,7 @@ struct ucred *cred; /* * We map the segment into our address space using the handle returned by vm_create. */ - if (!vcp->vmh) { + if (!vcp->segid) { afs_uint32 tlen = vcp->m.Length; #ifdef AFS_64BIT_CLIENT if (vcp->m.Length > afs_vmMappingEnd) @@ -604,7 +604,11 @@ struct ucred *cred; ReleaseWriteLock(&vcp->lock); return(EOPNOTSUPP); } +#ifdef AFS_64BIT_KERNEL + vcp->vmh = vm_handle(vcp->segid, (int32long64_t) 0); +#else vcp->vmh = SRVAL(vcp->segid, 0, 0); +#endif } vcp->v.v_gnode->gn_seg = vcp->segid; /* XXX Important XXX */ if (flag & SHM_RDONLY) { @@ -628,7 +632,7 @@ struct ucred *cred; } ReleaseWriteLock(&vcp->lock); VN_HOLD(vp); - afs_Trace4(afs_iclSetp, CM_TRACE_GMAP, ICL_TYPE_POINTER, (afs_int32)vp, + afs_Trace4(afs_iclSetp, CM_TRACE_GMAP, ICL_TYPE_POINTER, vp, ICL_TYPE_LONG, addr, ICL_TYPE_LONG, len, ICL_TYPE_LONG, off); return(0); } @@ -715,7 +719,7 @@ struct ucred *cred; } out: - afs_Trace3(afs_iclSetp, CM_TRACE_GACCESS, ICL_TYPE_POINTER, (afs_int32)vp, + afs_Trace3(afs_iclSetp, CM_TRACE_GACCESS, ICL_TYPE_POINTER, vp, ICL_TYPE_LONG, mode, ICL_TYPE_LONG, error); return(error); } @@ -731,34 +735,30 @@ struct ucred *cred; AFS_STATCNT(afs_gn_getattr); error = afs_getattr(vp, vattrp, cred); - afs_Trace2(afs_iclSetp, CM_TRACE_GGETATTR, ICL_TYPE_POINTER, (afs_int32)vp, + afs_Trace2(afs_iclSetp, CM_TRACE_GGETATTR, ICL_TYPE_POINTER, vp, ICL_TYPE_LONG, error); return(error); } int -afs_gn_setattr(vp, Op, Arg1, Arg2, Arg3, cred) +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; +int32long64_t op; +int32long64_t arg1; +int32long64_t arg2; +int32long64_t arg3; #else -int Op; -int Arg1; -int Arg2; -int Arg3; +int op; +int arg1; +int arg2; +int arg3; #endif struct ucred *cred; { struct vattr va; int error = 0; - int op = Op; - int arg1 = Arg1; - int arg2 = Arg2; - int arg3 = Arg3; AFS_STATCNT(afs_gn_setattr); VATTR_NULL(&va); @@ -794,7 +794,7 @@ struct ucred *cred; error = afs_setattr(vp, &va, cred); out: - afs_Trace2(afs_iclSetp, CM_TRACE_GSETATTR, ICL_TYPE_POINTER, (afs_int32)vp, + afs_Trace2(afs_iclSetp, CM_TRACE_GSETATTR, ICL_TYPE_POINTER, vp, ICL_TYPE_LONG, error); return(error); } @@ -835,7 +835,7 @@ struct ucred *cred; if (avc->segid) { AFS_GUNLOCK(); vm_flushp(avc->segid, 0, MAXFSIZE/PAGESIZE - 1); - vms_iowait(avc->vmh); + vms_iowait(avc->segid); AFS_GLOCK(); } uio.afsio_offset = offset; @@ -850,7 +850,7 @@ struct ucred *cred; if (error = afs_rdwr(vp, &uio, UIO_WRITE, 0, cred)) break; } - afs_Trace4(afs_iclSetp, CM_TRACE_GFCLEAR, ICL_TYPE_POINTER, (afs_int32)vp, + afs_Trace4(afs_iclSetp, CM_TRACE_GFCLEAR, ICL_TYPE_POINTER, vp, ICL_TYPE_LONG, offset, ICL_TYPE_LONG, length, ICL_TYPE_LONG, error); return (error); } @@ -872,7 +872,7 @@ struct ucred *cred; AFS_STATCNT(afs_gn_fsync); error = afs_fsync(vp, cred); - afs_Trace3(afs_iclSetp, CM_TRACE_GFSYNC, ICL_TYPE_POINTER, (afs_int32)vp, + afs_Trace3(afs_iclSetp, CM_TRACE_GFSYNC, ICL_TYPE_POINTER, vp, ICL_TYPE_LONG, flags, ICL_TYPE_LONG, error); return(error); } @@ -897,7 +897,7 @@ struct ucred *cred; VATTR_NULL(&va); va.va_size = length; error = afs_setattr(vp, &va, cred); - afs_Trace4(afs_iclSetp, CM_TRACE_GFTRUNC, ICL_TYPE_POINTER, (afs_int32)vp, + 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); @@ -933,7 +933,7 @@ struct ucred *cred; if (vcp->vc_error) { if (op == UIO_WRITE) { afs_Trace2(afs_iclSetp, CM_TRACE_GRDWR1, - ICL_TYPE_POINTER, (afs_int32)vp, + ICL_TYPE_POINTER, vp, ICL_TYPE_LONG, vcp->vc_error); return vcp->vc_error; } else @@ -1026,7 +1026,7 @@ struct ucred *cred; if (vattrp != NULL && error == 0) afs_gn_getattr(vp, vattrp, cred); - afs_Trace4(afs_iclSetp, CM_TRACE_GRDWR, ICL_TYPE_POINTER, (afs_int32)vp, + afs_Trace4(afs_iclSetp, CM_TRACE_GRDWR, ICL_TYPE_POINTER, vp, ICL_TYPE_LONG, flags, ICL_TYPE_LONG, op, ICL_TYPE_LONG, error); if (free_cred) @@ -1046,10 +1046,10 @@ afs_vm_rdwr(vp, uiop, rw, ioflag, credp) register int i; afs_int32 blockSize; afs_size_t fileSize, xfrOffset, offset, old_offset, xfrSize; - afs_int32 txfrSize; + vmsize_t txfrSize; #ifdef AFS_64BIT_CLIENT afs_size_t finalOffset; - afs_int32 toffset; + off_t toffset; int mixed = 0; #endif /* AFS_64BIT_CLIENT */ register struct vcache *vcp = VTOAFS(vp); @@ -1123,7 +1123,7 @@ afs_vm_rdwr(vp, uiop, rw, ioflag, credp) } #endif /* AFS_64BIT_CLIENT */ - if (!vcp->vmh) { + if (!vcp->segid) { afs_uint32 tlen = vcp->m.Length; #ifdef AFS_64BIT_CLIENT if (vcp->m.Length > afs_vmMappingEnd) @@ -1134,7 +1134,11 @@ afs_vm_rdwr(vp, uiop, rw, ioflag, credp) tlen, 0, 0)) { goto fail; } +#ifdef AFS_64BIT_KERNEL + vcp->vmh = vm_handle(vcp->segid, (int32long64_t) 0); +#else vcp->vmh = SRVAL(vcp->segid, 0, 0); +#endif } vcp->v.v_gnode->gn_seg = vcp->segid; if (rw == UIO_READ) { @@ -1197,7 +1201,7 @@ afs_vm_rdwr(vp, uiop, rw, ioflag, credp) if (vcp->m.Length > afs_vmMappingEnd) last_page = afs_vmMappingEnd/PAGESIZE; #endif - vm_protectp(vcp->vmh, last_page, 1, FILEKEY); + vm_protectp(vcp->segid, last_page, 1, FILEKEY); if (xfrSize + xfrOffset > fileSize) { vcp->m.Length = xfrSize+xfrOffset; } @@ -1287,7 +1291,7 @@ afs_vm_rdwr(vp, uiop, rw, ioflag, credp) first_page = (afs_size_t)old_offset >> PGSHIFT; pages = 1 + (((afs_size_t)old_offset + (len - 1)) >> PGSHIFT) - first_page; afs_Trace3(afs_iclSetp, CM_TRACE_VMWRITE2, - ICL_TYPE_POINTER, (afs_int32) vcp, + ICL_TYPE_POINTER, vcp, ICL_TYPE_INT32, first_page, ICL_TYPE_INT32, pages); AFS_GUNLOCK(); @@ -1310,7 +1314,7 @@ afs_vm_rdwr(vp, uiop, rw, ioflag, credp) if (code == 0 && (vcp->states & CDirty)) { code = afs_DoPartialWrite(vcp, &treq); } - vm_protectp(vcp->vmh, last_page, 1, RDONLY); + vm_protectp(vcp->segid, last_page, 1, RDONLY); ReleaseWriteLock(&vcp->lock); /* If requested, fsync the file after every write */ @@ -1393,7 +1397,7 @@ afs_direct_rdwr(vp, uiop, rw, ioflag, credp) ReleaseWriteLock(&vcp->lock); } afs_Trace3(afs_iclSetp, CM_TRACE_DIRECTRDWR, - ICL_TYPE_POINTER, (afs_int32)vp, + 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); @@ -1495,7 +1499,7 @@ int cmd; lckdat->l_len = flkd.l_len; lckdat->l_pid = flkd.l_pid; lckdat->l_sysid = flkd.l_sysid; - afs_Trace3(afs_iclSetp, CM_TRACE_GLOCKCTL, ICL_TYPE_POINTER, (afs_int32)vp, + afs_Trace3(afs_iclSetp, CM_TRACE_GLOCKCTL, ICL_TYPE_POINTER, vp, ICL_TYPE_LONG, ncmd, ICL_TYPE_LONG, error); return(error); } @@ -1520,7 +1524,7 @@ int ext; /* Ignored in AFS */ AFS_STATCNT(afs_gn_ioctl); /* This seems to be a perfect fit for our ioctl redirection (afs_xioctl hack); thus the ioctl(2) entry in sysent.c is unaffected in the aix/afs port. */ error = afs_ioctl(vp, cmd, arg); - afs_Trace3(afs_iclSetp, CM_TRACE_GIOCTL, ICL_TYPE_POINTER, (afs_int32)vp, + afs_Trace3(afs_iclSetp, CM_TRACE_GIOCTL, ICL_TYPE_POINTER, vp, ICL_TYPE_LONG, cmd, ICL_TYPE_LONG, error); return(error); } @@ -1536,7 +1540,7 @@ struct ucred *cred; AFS_STATCNT(afs_gn_readlink); error = afs_readlink(vp, uiop, cred); - afs_Trace2(afs_iclSetp, CM_TRACE_GREADLINK, ICL_TYPE_POINTER, (afs_int32)vp, + afs_Trace2(afs_iclSetp, CM_TRACE_GREADLINK, ICL_TYPE_POINTER, vp, ICL_TYPE_LONG, error); return(error); } @@ -1569,7 +1573,7 @@ struct ucred *cred; VATTR_NULL(&va); va.va_mode = 0777; error = afs_symlink(vp, link, &va, target, cred); - afs_Trace4(afs_iclSetp, CM_TRACE_GSYMLINK, ICL_TYPE_POINTER, (afs_int32)vp, + afs_Trace4(afs_iclSetp, CM_TRACE_GSYMLINK, ICL_TYPE_POINTER, vp, ICL_TYPE_STRING, link, ICL_TYPE_STRING, target, ICL_TYPE_LONG, error); return(error); } @@ -1585,7 +1589,7 @@ struct ucred *cred; AFS_STATCNT(afs_gn_readdir); error = afs_readdir(vp, uiop, cred); - afs_Trace2(afs_iclSetp, CM_TRACE_GREADDIR, ICL_TYPE_POINTER, (afs_int32)vp, + afs_Trace2(afs_iclSetp, CM_TRACE_GREADDIR, ICL_TYPE_POINTER, vp, ICL_TYPE_LONG, error); return(error); } @@ -1615,7 +1619,11 @@ struct ucred *cred; register 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 *nbp, *qbp, *qnbp, *firstComparable; int doMerge; int oldPriority; @@ -1725,7 +1733,11 @@ register struct buf *abp; /* 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 qbp->av_back = qnbp->av_back; lwbp = &qbp->b_work; /* find end of qbp's work queue */ @@ -1737,7 +1749,11 @@ register struct buf *abp; */ 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 /* * note that qnbp is bogus, but it doesn't matter because * we're going to restart the for loop now. diff --git a/src/afs/UKERNEL/afs_usrops.c b/src/afs/UKERNEL/afs_usrops.c index 5c5367692..61995c0ff 100644 --- a/src/afs/UKERNEL/afs_usrops.c +++ b/src/afs/UKERNEL/afs_usrops.c @@ -1587,7 +1587,7 @@ void uafs_Init( /* * Set the primary cell name. */ - call_syscall(AFSOP_SET_THISCELL, afs_LclCellName, 0, 0, 0, 0); + call_syscall(AFSOP_SET_THISCELL, (long) afs_LclCellName, 0, 0, 0, 0); if ((logfd = fopen(fullpn_AFSLogFile,"r+")) == 0) { if (afsd_verbose) printf("%s: Creating '%s'\n", rn, fullpn_AFSLogFile); diff --git a/src/afs/UKERNEL/sysincludes.h b/src/afs/UKERNEL/sysincludes.h index 5b3c1eea8..b4ab7daf0 100644 --- a/src/afs/UKERNEL/sysincludes.h +++ b/src/afs/UKERNEL/sysincludes.h @@ -973,6 +973,9 @@ extern pthread_cond_t usr_sleep_cond; #define uprintf printf #define usr_getpid() (int)(usr_thread_self()) +#ifdef ISAFS_GLOCK +#undef ISAFS_GLOCK +#endif #define ISAFS_GLOCK() (usr_thread_self() == afs_global_owner) #endif /* NETSCAPE_NSAPI */ diff --git a/src/afs/VNOPS/afs_vnop_attrs.c b/src/afs/VNOPS/afs_vnop_attrs.c index 1dced2649..c75384b33 100644 --- a/src/afs/VNOPS/afs_vnop_attrs.c +++ b/src/afs/VNOPS/afs_vnop_attrs.c @@ -450,8 +450,17 @@ int afs_setattr(OSI_VC_DECL(avc), register struct vattr *attrs, struct AFS_UCRED OSI_VC_CONVERT(avc) AFS_STATCNT(afs_setattr); - afs_Trace2(afs_iclSetp, CM_TRACE_SETATTR, ICL_TYPE_POINTER, avc, +#if defined(AFS_SUN5_ENV) || defined(AFS_SGI_ENV) || defined(AFS_LINUX22_ENV) + afs_Trace4(afs_iclSetp, CM_TRACE_SETATTR, ICL_TYPE_POINTER, avc, + ICL_TYPE_INT32, attrs->va_mask, + ICL_TYPE_OFFSET, ICL_HANDLE_OFFSET(attrs->va_size), + ICL_TYPE_OFFSET, ICL_HANDLE_OFFSET(avc->m.Length)); +#else + afs_Trace4(afs_iclSetp, CM_TRACE_SETATTR, ICL_TYPE_POINTER, avc, + ICL_TYPE_INT32, attrs->va_mode, + ICL_TYPE_OFFSET, ICL_HANDLE_OFFSET(attrs->va_size), ICL_TYPE_OFFSET, ICL_HANDLE_OFFSET(avc->m.Length)); +#endif if ((code = afs_InitReq(&treq, acred))) return code; afs_InitFakeStat(&fakestate); diff --git a/src/afs/VNOPS/afs_vnop_read.c b/src/afs/VNOPS/afs_vnop_read.c index cb2c55f86..a28f8a0f6 100644 --- a/src/afs/VNOPS/afs_vnop_read.c +++ b/src/afs/VNOPS/afs_vnop_read.c @@ -11,7 +11,6 @@ * Implements: * afs_MemRead * afs_PrefetchChunk - * afs_UFSReadFast * afs_UFSRead * */ @@ -233,17 +232,20 @@ tagain: error = code; break; } - /* fetching flag gone, data is here, or we never tried (BBusy for instance) */ + /* fetching flag gone, data is here, or we never tried + * (BBusy for instance) */ if (tdc->dflags & DFFetching) { - /* still fetching, some new data is here: compute length and offset */ + /* still fetching, some new data is here: + * compute length and offset */ offset = filePos - AFS_CHUNKTOBASE(tdc->f.chunk); len = tdc->validPos - filePos; } else { - /* no longer fetching, verify data version (avoid new GetDCache call) */ - if (hsame(avc->m.DataVersion, tdc->f.versionNo)) { + /* no longer fetching, verify data version + * (avoid new GetDCache call) */ + if (hsame(avc->m.DataVersion, tdc->f.versionNo) + && ((len = tdc->validPos - filePos) > 0)) { offset = filePos - AFS_CHUNKTOBASE(tdc->f.chunk); - len = tdc->f.chunkBytes - offset; } else { /* don't have current data, so get it below */ @@ -258,6 +260,10 @@ tagain: } if (!tdc) { + /* If we get, it was not possible to start the + * background daemon. With flag == 1 afs_GetDCache + * does the FetchData rpc synchronously. + */ ReleaseReadLock(&avc->lock); tdc = afs_GetDCache(avc, filePos, &treq, &offset, &len, 1); ObtainReadLock(&avc->lock); @@ -265,6 +271,10 @@ tagain: } } + afs_Trace3(afs_iclSetp, CM_TRACE_VNODEREAD, + ICL_TYPE_POINTER, tdc, + ICL_TYPE_OFFSET, ICL_HANDLE_OFFSET(offset), + ICL_TYPE_OFFSET, ICL_HANDLE_OFFSET(len)); if (!tdc) { error = EIO; break; @@ -418,170 +428,6 @@ void afs_PrefetchChunk(struct vcache *avc, struct dcache *adc, } } - -/* if the vcache is up-to-date, and the request fits entirely into the chunk - * that the hint here references, then we just use it quickly, otherwise we - * have to call the slow read. - * - * This could be generalized in several ways to take advantage of partial - * state even when all the chips don't fall the right way. For instance, - * if the hint is good and the first part of the read request can be - * satisfied from the chunk, then just do the read. After the read has - * completed, check to see if there's more. (Chances are there won't be.) - * If there is more, then just call afs_UFSReadSlow and let it do the rest. - * - * For the time being, I'm ignoring quick.f, but it should be used at - * some future date. - * do this in the future avc->quick.f = tfile; but I think it - * has to be done under a write lock, but don't want to wait on the - * write lock - */ - /* everywhere that a dcache can be freed (look for NULLIDX) - * probably does it under a write lock on xdcache. Need to invalidate - * stamp there, too. - * Also need to worry about DFFetching, and IFFree, I think. */ -static struct dcache *savedc = 0; - -int afs_UFSReadFast(register struct vcache *avc, struct uio *auio, - struct AFS_UCRED *acred, daddr_t albn, struct buf **abpp, int noLock) -{ - struct vrequest treq; - int offDiff; - struct dcache *tdc; - struct osi_file *tfile; - afs_int32 code = 0; - - if (!noLock) - ObtainReadLock(&avc->lock); - ObtainReadLock(&afs_xdcache); - - if ((avc->states & CStatd) /* up to date */ - && (tdc = avc->quick.dc) && (tdc->index != NULLIDX) - && !(afs_indexFlags[tdc->index] & (IFFree | IFDiscarded))) { - - int readLocked = 0; - - afs_RefDCache(tdc); - ReleaseReadLock(&afs_xdcache); - if (tdc->stamp == avc->quick.stamp) { - readLocked = 1; - ObtainReadLock(&tdc->lock); - } - - if ((tdc->stamp == avc->quick.stamp) /* hint matches */ - && ((offDiff = (afs_size_t)(auio->afsio_offset - avc->quick.minLoc)) >= 0) - && (tdc->f.chunkBytes >= auio->afsio_resid + offDiff) - && !(tdc->dflags & DFFetching)) { /* fits in chunk */ - - auio->afsio_offset -= avc->quick.minLoc; - - afs_Trace4(afs_iclSetp, CM_TRACE_READFAST, ICL_TYPE_POINTER, avc, - ICL_TYPE_OFFSET, ICL_HANDLE_OFFSET(auio->afsio_offset), - ICL_TYPE_INT32, auio->afsio_resid, - ICL_TYPE_OFFSET, ICL_HANDLE_OFFSET(avc->m.Length)); - - tfile = (struct osi_file *)osi_UFSOpen(tdc->f.inode); - -#ifdef AFS_AIX_ENV -#ifdef AFS_AIX41_ENV - AFS_GUNLOCK(); - code = VNOP_RDWR(tfile->vnode, UIO_READ, FREAD, auio, NULL, NULL, NULL, &afs_osi_cred); - AFS_GLOCK(); -#else -#ifdef AFS_AIX32_ENV - code = VNOP_RDWR(tfile->vnode, UIO_READ, FREAD, auio, NULL, NULL); -#else - code = VNOP_RDWR(tfile->vnode, UIO_READ, FREAD, (off_t)&auio->afsio_offset, auio, NULL, NULL, -1); -#endif -#endif -#else -#ifdef AFS_SUN5_ENV - AFS_GUNLOCK(); - VOP_RWLOCK(tfile->vnode, 0); - code = VOP_READ(tfile->vnode, auio, 0, &afs_osi_cred); - VOP_RWUNLOCK(tfile->vnode, 0); - AFS_GLOCK(); -#else -#if defined(AFS_SGI_ENV) - AFS_GUNLOCK(); - AFS_VOP_RWLOCK(tfile->vnode, VRWLOCK_READ); - AFS_VOP_READ(tfile->vnode, auio, IO_ISLOCKED, &afs_osi_cred, code); - AFS_VOP_RWUNLOCK(tfile->vnode, VRWLOCK_READ); - AFS_GLOCK(); -#else -#ifdef AFS_OSF_ENV - auio->uio_rw = UIO_READ; - AFS_GUNLOCK(); - VOP_READ(tfile->vnode, auio, 0, &afs_osi_cred, code); - AFS_GLOCK(); -#else /* AFS_OSF_ENV */ -#if defined(AFS_HPUX100_ENV) - AFS_GUNLOCK(); - code = VOP_RDWR(tfile->vnode, auio, UIO_READ, 0, &afs_osi_cred); - AFS_GLOCK(); -#else -#if defined(AFS_LINUX20_ENV) - AFS_GUNLOCK(); - code = osi_file_uio_rdwr(tfile, auio, UIO_READ); - AFS_GLOCK(); -#else -#if defined(AFS_DARWIN_ENV) - AFS_GUNLOCK(); - VOP_LOCK(tfile->vnode, LK_EXCLUSIVE, current_proc()); - code = VOP_READ(tfile->vnode, auio, 0, &afs_osi_cred); - VOP_UNLOCK(tfile->vnode, 0, current_proc()); - AFS_GLOCK(); -#else -#if defined(AFS_XBSD_ENV) - AFS_GUNLOCK(); - VOP_LOCK(tfile->vnode, LK_EXCLUSIVE, curproc); - code = VOP_READ(tfile->vnode, auio, 0, &afs_osi_cred); - VOP_UNLOCK(tfile->vnode, 0, curproc); - AFS_GLOCK(); -#else - code = VOP_RDWR(tfile->vnode, auio, UIO_READ, 0, &afs_osi_cred); -#endif -#endif -#endif -#endif -#endif -#endif -#endif -#endif - auio->afsio_offset += avc->quick.minLoc; - osi_UFSClose(tfile); - /* Fix up LRU info */ - hset(afs_indexTimes[tdc->index], afs_indexCounter); - hadd32(afs_indexCounter, 1); - - if (!noLock) { - ReleaseReadLock(&avc->lock); -#if !defined(AFS_VM_RDWR_ENV) - if (!(code = afs_InitReq(&treq, acred))) { - if (!(tdc->mflags & DFNextStarted)) - afs_PrefetchChunk(avc, tdc, acred, &treq); - } -#endif - } - if (readLocked) ReleaseReadLock(&tdc->lock); - afs_PutDCache(tdc); - return (code); - } - if (!tdc->f.chunkBytes) { /* debugging f.chunkBytes == 0 problem */ - savedc = tdc; - } - if (readLocked) ReleaseReadLock(&tdc->lock); - afs_PutDCache(tdc); - } else { - ReleaseReadLock(&afs_xdcache); - } - - /* come here if fast path doesn't work for some reason or other */ - if (!noLock) - ReleaseReadLock(&avc->lock); - return afs_UFSRead(avc, auio, acred, albn, abpp, noLock); -} - int afs_UFSRead(register struct vcache *avc, struct uio *auio, struct AFS_UCRED *acred, daddr_t albn, struct buf **abpp, int noLock) { @@ -655,7 +501,7 @@ int afs_UFSRead(register struct vcache *avc, struct uio *auio, if (tdc) { ObtainReadLock(&tdc->lock); offset = filePos - AFS_CHUNKTOBASE(tdc->f.chunk); - len = tdc->f.chunkBytes - offset; + len = tdc->validPos - filePos; } } else { /* a tricky question: does the presence of the DFFetching flag @@ -694,9 +540,6 @@ int afs_UFSRead(register struct vcache *avc, struct uio *auio, } tdc = afs_GetDCache(avc, filePos, &treq, &offset, &len, 2); ObtainReadLock(&tdc->lock); - if (tdc == savedc) { - savedc = 0; - } /* now, first try to start transfer, if we'll need the data. If * data already coming, we don't need to do this, obviously. Type * 2 requests never return a null dcache entry, btw. */ @@ -782,9 +625,8 @@ tagain: /* no longer fetching, verify data version (avoid new * GetDCache call) */ if (hsame(avc->m.DataVersion, tdc->f.versionNo) - && tdc->f.chunkBytes) { + && ((len = tdc->validPos - filePos) > 0)) { offset = filePos - AFS_CHUNKTOBASE(tdc->f.chunk); - len = tdc->f.chunkBytes - offset; } else { /* don't have current data, so get it below */ @@ -810,14 +652,15 @@ tagain: } } - afs_Trace3(afs_iclSetp, CM_TRACE_VNODEREAD, - ICL_TYPE_POINTER, tdc, - ICL_TYPE_OFFSET, ICL_HANDLE_OFFSET(offset), - ICL_TYPE_OFFSET, ICL_HANDLE_OFFSET(len)); if (!tdc) { error = EIO; break; } + len = tdc->validPos - filePos; + afs_Trace3(afs_iclSetp, CM_TRACE_VNODEREAD, + ICL_TYPE_POINTER, tdc, + ICL_TYPE_OFFSET, ICL_HANDLE_OFFSET(offset), + ICL_TYPE_OFFSET, ICL_HANDLE_OFFSET(len)); if (len > totalLength) len = totalLength; /* will read len bytes */ if (len <= 0) { /* shouldn't get here if DFFetching is on */ afs_Trace4(afs_iclSetp, CM_TRACE_VNODEREAD2, diff --git a/src/afs/VNOPS/afs_vnop_readdir.c b/src/afs/VNOPS/afs_vnop_readdir.c index 96db7faff..58b38722f 100644 --- a/src/afs/VNOPS/afs_vnop_readdir.c +++ b/src/afs/VNOPS/afs_vnop_readdir.c @@ -158,11 +158,12 @@ struct min_direct { /* miniature direct structure */ #else #if defined(AFS_SUN_ENV) || defined(AFS_AIX32_ENV) afs_int32 d_off; + afs_uint32 d_fileno; #endif #if defined(AFS_HPUX100_ENV) unsigned long long d_off; -#endif afs_uint32 d_fileno; +#endif u_short d_reclen; u_short d_namlen; #endif @@ -295,7 +296,7 @@ afs_size_t off; #if defined(AFS_SUN56_ENV) struct dirent64 *direntp; #else -#ifdef AFS_SUN5_ENV +#if defined(AFS_SUN5_ENV) || (defined(AFS_AIX51_ENV) && defined(AFS_64BIT_KERNEL)) struct dirent *direntp; #endif #endif /* AFS_SUN56_ENV */ @@ -367,7 +368,7 @@ afs_size_t off; } } #else /* AFS_SGI53_ENV */ -#ifdef AFS_SUN5_ENV +#if defined(AFS_SUN5_ENV) || (defined(AFS_AIX51_ENV) && defined(AFS_64BIT_KERNEL)) #if defined(AFS_SUN56_ENV) direntp = (struct dirent64 *) osi_AllocLargeSpace(AFS_LRALLOCSIZ); #else @@ -375,7 +376,12 @@ afs_size_t off; #endif direntp->d_ino = (vc->fid.Fid.Volume << 16) + ntohl(de->fid.vnode); FIXUPSTUPIDINODE(direntp->d_ino); +#if defined(AFS_AIX51_ENV) && defined(AFS_64BIT_KERNEL) + direntp->d_offset = off; + direntp->d_namlen = slen; +#else direntp->d_off = off; +#endif direntp->d_reclen = rlen; strcpy(direntp->d_name, de->name); AFS_UIOMOVE((caddr_t)direntp, rlen, UIO_READ, auio, code); diff --git a/src/afs/VNOPS/afs_vnop_strategy.c b/src/afs/VNOPS/afs_vnop_strategy.c index 6ee577891..554f16384 100644 --- a/src/afs/VNOPS/afs_vnop_strategy.c +++ b/src/afs/VNOPS/afs_vnop_strategy.c @@ -122,7 +122,7 @@ afs_ustrategy(abp) if (dbtob(abp->b_blkno) + abp->b_bcount > tvc->m.Length) { if ((abp->b_flags & B_PFSTORE) == 0) { AFS_GUNLOCK(); - vm_protectp(tvc->vmh, dbtob(abp->b_blkno)/PAGESIZE, + vm_protectp(tvc->segid, dbtob(abp->b_blkno)/PAGESIZE, abp->b_bcount/PAGESIZE, RDONLY); AFS_GLOCK(); } diff --git a/src/afs/VNOPS/afs_vnop_write.c b/src/afs/VNOPS/afs_vnop_write.c index 9ce73190f..e943fd44c 100644 --- a/src/afs/VNOPS/afs_vnop_write.c +++ b/src/afs/VNOPS/afs_vnop_write.c @@ -274,6 +274,8 @@ int afs_MemWrite(register struct vcache *avc, struct uio *auio, int aio, if (offset + len > tdc->f.chunkBytes) { afs_int32 tlength = offset+len; afs_AdjustSize(tdc, tlength); + if (tdc->validPos < filePos + len) + tdc->validPos = filePos + len; } totalLength -= len; transferLength += len; @@ -426,7 +428,7 @@ int afs_UFSWrite(register struct vcache *avc, struct uio *auio, tvec = (struct iovec *) osi_AllocSmallSpace(sizeof(struct iovec)); while (totalLength > 0) { /* - * The following lines are necessary because afs_GetDCache with + * The following line is necessary because afs_GetDCache with * flag == 4 expects the length field to be filled. It decides * from this whether it's necessary to fetch data into the chunk * before writing or not (when the whole chunk is overwritten!). @@ -595,6 +597,8 @@ int afs_UFSWrite(register struct vcache *avc, struct uio *auio, if (offset + len > tdc->f.chunkBytes) { afs_int32 tlength = offset+len; afs_AdjustSize(tdc, tlength); + if (tdc->validPos < filePos + len) + tdc->validPos = filePos + len; } totalLength -= len; transferLength += len; diff --git a/src/afs/afs_call.c b/src/afs/afs_call.c index 660374086..101c5662a 100644 --- a/src/afs/afs_call.c +++ b/src/afs/afs_call.c @@ -1556,8 +1556,12 @@ int afs_icl_sizeofLong = 1; int afs_icl_sizeofLong = 2; #endif /* SGI62 */ #else +#if defined(AFS_AIX51_ENV) && defined(AFS_64BIT_KERNEL) +int afs_icl_sizeofLong = 2; +#else int afs_icl_sizeofLong = 1; #endif +#endif int afs_icl_inited = 0; @@ -1582,7 +1586,11 @@ Afscall_icl(long opcode, long p1, long p2, long p3, long p4, long *retval) #if defined(AFS_SGI61_ENV) || defined(AFS_SUN57_ENV) || defined(AFS_DARWIN_ENV) || defined(AFS_XBSD_ENV) size_t temp; #else /* AFS_SGI61_ENV */ +#if defined(AFS_AIX51_ENV) && defined(AFS_64BIT_KERNEL) + afs_uint64 temp; +#else afs_uint32 temp; +#endif #endif /* AFS_SGI61_ENV */ char tname[65]; afs_int32 startCookie; @@ -1632,6 +1640,11 @@ Afscall_icl(long opcode, long p1, long p2, long p3, long p4, long *retval) if (code) goto done; AFS_COPYOUT((char *) &startCookie, (char *)p4, sizeof(afs_int32), code); if (code) goto done; +#if defined(AFS_AIX51_ENV) && defined(AFS_64BIT_KERNEL) + if (!(IS64U)) + *retval = ((long) ((flags<<24) | (elts & 0xffffff))) << 32; + else +#endif *retval = (flags<<24) | (elts & 0xffffff); done: afs_icl_LogRele(logp); @@ -1913,7 +1926,6 @@ static void afs_icl_AppendString(struct afs_icl_log *logp, char *astr) } /* add a long to the log, ignoring overflow (checked already) */ -#if defined(AFS_ALPHA_ENV) || (defined(AFS_SGI61_ENV) && (_MIPS_SZLONG==64)) #define ICL_APPENDINT32(lp, x) \ MACRO_BEGIN \ (lp)->datap[(lp)->firstFree] = (x); \ @@ -1923,6 +1935,7 @@ static void afs_icl_AppendString(struct afs_icl_log *logp, char *astr) (lp)->logElements++; \ MACRO_END +#if defined(AFS_ALPHA_ENV) || (defined(AFS_SGI61_ENV) && (_MIPS_SZLONG==64)) || (defined(AFS_AIX51_ENV) && defined(AFS_64BIT_KERNEL)) #define ICL_APPENDLONG(lp, x) \ MACRO_BEGIN \ ICL_APPENDINT32((lp), ((x) >> 32) & 0xffffffffL); \ @@ -1930,15 +1943,7 @@ static void afs_icl_AppendString(struct afs_icl_log *logp, char *astr) MACRO_END #else /* AFS_ALPHA_ENV */ -#define ICL_APPENDLONG(lp, x) \ - MACRO_BEGIN \ - (lp)->datap[(lp)->firstFree] = (x); \ - if (++((lp)->firstFree) >= (lp)->logSize) { \ - (lp)->firstFree = 0; \ - } \ - (lp)->logElements++; \ - MACRO_END -#define ICL_APPENDINT32(lp, x) ICL_APPENDLONG((lp), (x)) +#define ICL_APPENDLONG(lp, x) ICL_APPENDINT32((lp), (x)) #endif /* AFS_ALPHA_ENV */ /* routine to tell whether we're dealing with the address or the @@ -2080,7 +2085,7 @@ void afs_icl_AppendRecord(register struct afs_icl_log *logp, afs_int32 op, ICL_APPENDINT32(logp, (afs_int32)((afs_int32 *)p1)[2]); ICL_APPENDINT32(logp, (afs_int32)((afs_int32 *)p1)[3]); } -#if defined(AFS_ALPHA_ENV) || (defined(AFS_SGI61_ENV) && (_MIPS_SZLONG==64)) +#if defined(AFS_ALPHA_ENV) || (defined(AFS_SGI61_ENV) && (_MIPS_SZLONG==64)) || (defined(AFS_AIX51_ENV) && defined(AFS_64BIT_KERNEL)) else if (t1 == ICL_TYPE_INT32) ICL_APPENDINT32(logp, (afs_int32)p1); #endif /* AFS_ALPHA_ENV */ @@ -2118,7 +2123,7 @@ void afs_icl_AppendRecord(register struct afs_icl_log *logp, afs_int32 op, ICL_APPENDINT32(logp, (afs_int32)((afs_int32 *)p2)[2]); ICL_APPENDINT32(logp, (afs_int32)((afs_int32 *)p2)[3]); } -#if defined(AFS_ALPHA_ENV) || (defined(AFS_SGI61_ENV) && (_MIPS_SZLONG==64)) +#if defined(AFS_ALPHA_ENV) || (defined(AFS_SGI61_ENV) && (_MIPS_SZLONG==64)) || (defined(AFS_AIX51_ENV) && defined(AFS_64BIT_KERNEL)) else if (t2 == ICL_TYPE_INT32) ICL_APPENDINT32(logp, (afs_int32)p2); #endif /* AFS_ALPHA_ENV */ @@ -2156,7 +2161,7 @@ void afs_icl_AppendRecord(register struct afs_icl_log *logp, afs_int32 op, ICL_APPENDINT32(logp, (afs_int32)((afs_int32 *)p3)[2]); ICL_APPENDINT32(logp, (afs_int32)((afs_int32 *)p3)[3]); } -#if defined(AFS_ALPHA_ENV) || (defined(AFS_SGI61_ENV) && (_MIPS_SZLONG==64)) +#if defined(AFS_ALPHA_ENV) || (defined(AFS_SGI61_ENV) && (_MIPS_SZLONG==64)) || (defined(AFS_AIX51_ENV) && defined(AFS_64BIT_KERNEL)) else if (t3 == ICL_TYPE_INT32) ICL_APPENDINT32(logp, (afs_int32)p3); #endif /* AFS_ALPHA_ENV */ @@ -2194,7 +2199,7 @@ void afs_icl_AppendRecord(register struct afs_icl_log *logp, afs_int32 op, ICL_APPENDINT32(logp, (afs_int32)((afs_int32 *)p4)[2]); ICL_APPENDINT32(logp, (afs_int32)((afs_int32 *)p4)[3]); } -#if defined(AFS_ALPHA_ENV) || (defined(AFS_SGI61_ENV) && (_MIPS_SZLONG==64)) +#if defined(AFS_ALPHA_ENV) || (defined(AFS_SGI61_ENV) && (_MIPS_SZLONG==64)) || (defined(AFS_AIX51_ENV) && defined(AFS_64BIT_KERNEL)) else if (t4 == ICL_TYPE_INT32) ICL_APPENDINT32(logp, (afs_int32)p4); #endif /* AFS_ALPHA_ENV */ diff --git a/src/afs/afs_cell.c b/src/afs/afs_cell.c index 595d4b546..bd8bd0087 100644 --- a/src/afs/afs_cell.c +++ b/src/afs/afs_cell.c @@ -463,7 +463,7 @@ afs_int32 afs_NewCellAlias(char *alias, char *cell) struct afs_q CellLRU; /* Export for kdump */ static char *afs_thiscell; -static afs_int32 afs_cellindex; +afs_int32 afs_cellindex; /* Export for kdump */ static void afs_UpdateCellLRU(struct cell *c) { diff --git a/src/afs/afs_daemons.c b/src/afs/afs_daemons.c index 31f5decb0..322255207 100644 --- a/src/afs/afs_daemons.c +++ b/src/afs/afs_daemons.c @@ -12,6 +12,11 @@ RCSID("$Header$"); +#ifdef AFS_AIX51_ENV +#define __FULL_PROTO +#include +#endif + #include "afs/sysincludes.h" /* Standard vendor system headers */ #include "afsincludes.h" /* Afs-based standard headers */ #include "afs/afs_stats.h" /* statistics gathering code */ @@ -585,7 +590,7 @@ struct brequest *afs_BQueue(register short aopcode, register struct vcache *avc, * The modifications here will work for either a UP or MP machine. */ struct buf *afs_asyncbuf = (struct buf*)0; -afs_int32 afs_asyncbuf_cv = EVENT_NULL; +tid_t afs_asyncbuf_cv = EVENT_NULL; afs_int32 afs_biodcnt = 0; /* in implementing this, I assumed that all external linked lists were @@ -620,7 +625,7 @@ Simple_lock afs_asyncbuf_lock; struct buf *bp = NULL; struct buf *bestbp; struct buf **bestlbpP, **lbpP; - int bestage, stop; + long bestage, stop; struct buf *t1P, *t2P; /* temp pointers for list manipulation */ int oldPriority; afs_uint32 wait_ret; @@ -639,16 +644,16 @@ Simple_lock afs_asyncbuf_lock; if (afs_asyncbuf) { /* look for oldest buffer */ bp = bestbp = afs_asyncbuf; - bestage = (int) bestbp->av_back; + bestage = (long) bestbp->av_back; bestlbpP = &afs_asyncbuf; while (1) { lbpP = &bp->av_forw; bp = *lbpP; if (!bp) break; - if ((int) bp->av_back - bestage < 0) { + if ((long) bp->av_back - bestage < 0) { bestbp = bp; bestlbpP = lbpP; - bestage = (int) bp->av_back; + bestage = (long) bp->av_back; } } bp = bestbp; @@ -814,7 +819,7 @@ if (DOvmlock) * also want to hang onto the old one. */ tmpaddr = bp->b_baddr; - bp->b_baddr = vm_att (bp->b_xmemd.subspace_id, tmpaddr); + bp->b_baddr = (caddr_t) 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 ??? */ @@ -824,7 +829,7 @@ if (DOvmlock) /* 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); + vm_det(bp->b_baddr); bp->b_baddr = tmpaddr; /* diff --git a/src/afs/afs_dcache.c b/src/afs/afs_dcache.c index 2769a4524..1261fbf11 100644 --- a/src/afs/afs_dcache.c +++ b/src/afs/afs_dcache.c @@ -331,6 +331,8 @@ void afs_AdjustSize(register struct dcache *adc, register afs_int32 newSize) adc->dflags |= DFEntryMod; oldSize = ((adc->f.chunkBytes + afs_fsfragsize)^afs_fsfragsize)>>10;/* round up */ adc->f.chunkBytes = newSize; + if (!newSize) + adc->validPos = 0; newSize = ((newSize + afs_fsfragsize)^afs_fsfragsize)>>10;/* round up */ if (newSize > oldSize) { /* We're growing the file, wakeup the daemon */ @@ -2759,6 +2761,10 @@ struct dcache *afs_UFSGetDSlot(register afs_int32 aslot, register struct dcache } tdc->refCount = 1; tdc->index = aslot; + if (tdc->f.chunk >= 0) + tdc->validPos = AFS_CHUNKTOBASE(tdc->f.chunk) + tdc->f.chunkBytes; + else + tdc->validPos = 0; if (existing) { osi_Assert(0 == NBObtainWriteLock(&tdc->lock, 674)); diff --git a/src/afs/afs_lock.c b/src/afs/afs_lock.c index 9e666fa71..53e8d560d 100644 --- a/src/afs/afs_lock.c +++ b/src/afs/afs_lock.c @@ -120,6 +120,7 @@ void ReleaseLock(register struct afs_lock *lock, int how) void Afs_Lock_Obtain(register struct afs_lock *lock, int how) { osi_timeval_t tt1, tt2, et; + afs_uint32 us; AFS_STATCNT(Lock_Obtain); @@ -170,9 +171,12 @@ void Afs_Lock_Obtain(register struct afs_lock *lock, int how) osi_GetuTime(&tt2); afs_stats_GetDiff(et, tt1, tt2); afs_stats_AddTo((lock->time_waiting), et); + us = (et.tv_sec << 20) + et.tv_usec; if (afs_trclock) { - afs_Trace2(afs_iclSetp, CM_TRACE_LOCKSLEPT, ICL_TYPE_POINTER, lock, + afs_Trace3(afs_iclSetp, CM_TRACE_LOCKSLEPT, + ICL_TYPE_INT32, us, + ICL_TYPE_POINTER, lock, ICL_TYPE_INT32, how); } } diff --git a/src/afs/afs_memcache.c b/src/afs/afs_memcache.c index bbde69d91..73102d2a2 100644 --- a/src/afs/afs_memcache.c +++ b/src/afs/afs_memcache.c @@ -416,6 +416,7 @@ int afs_MemCacheFetchProc(register struct rx_call *acall, register struct memCac if(!tiov) { osi_Panic("afs_MemCacheFetchProc: osi_AllocSmallSpace for iovecs returned NULL\n"); } + adc->validPos = abase; do { if (moredata) { RX_AFS_GUNLOCK(); @@ -467,7 +468,12 @@ int afs_MemCacheFetchProc(register struct rx_call *acall, register struct memCac abase += tlen; length -= tlen; adc->validPos = abase; - afs_osi_Wakeup(&adc->validPos); + if (afs_osi_Wakeup(&adc->validPos) == 0) + afs_Trace4(afs_iclSetp, CM_TRACE_DCACHEWAKE, + ICL_TYPE_STRING, __FILE__, + ICL_TYPE_INT32, __LINE__, + ICL_TYPE_POINTER, adc, + ICL_TYPE_INT32, adc->dflags); } } while (moredata); /* max of two sizes */ diff --git a/src/afs/afs_osi.c b/src/afs/afs_osi.c index 51c39d6c3..aadf18fcc 100644 --- a/src/afs/afs_osi.c +++ b/src/afs/afs_osi.c @@ -489,10 +489,10 @@ int osi_VMDirty_p(struct vcache *avc) ^ ((((handle) & ~vmker.stoinio) & vmker.stoimask) << vmker.stoihash) \ ) & 0x000fffff) - if (avc->vmh) { + if (avc->segid) { unsigned int pagef, pri, index, next; - index = VMHASH(avc->vmh); + index = VMHASH(avc->segid); if (scb_valid(index)) { /* could almost be an ASSERT */ pri = disable_ints(); @@ -871,7 +871,11 @@ const struct AFS_UCRED *afs_osi_proc2cred(AFS_PROC *pproc) xmem_userp = NULL; xm = XMEM_FAIL; /* simple_lock(&proc_tbl_lock); */ +#ifdef __64BIT__ + if (pproc->p_adspace != vm_handle(NULLSEGID, (int32long64_t) 0)) { +#else if (pproc->p_adspace != NULLSEGVAL) { +#endif #ifdef AFS_AIX51_ENV simple_lock(&pproc->p_pvprocp->pv_lock); diff --git a/src/afs/afs_osi.h b/src/afs/afs_osi.h index b29f9cd8c..a0233f05a 100644 --- a/src/afs/afs_osi.h +++ b/src/afs/afs_osi.h @@ -50,8 +50,12 @@ struct osi_file { #endif #if defined(AFS_HPUX102_ENV) k_off_t offset; +#else +#if defined(AFS_AIX51_ENV) && defined(AFS_64BIT_KERNEL) + afs_offs_t offset; #else afs_int32 offset; +#endif #endif int (*proc)(struct osi_file *afile, afs_int32 code); /* proc, which, if not null, is called on writes */ char *rock; /* rock passed to proc */ @@ -65,9 +69,13 @@ struct osi_dev { #ifdef AFS_OBSD_ENV struct mount *mp; struct vnode *held_vnode; +#else +#ifdef AFS_AIX42_ENV + dev_t dev; #else afs_int32 dev; #endif +#endif }; struct afs_osi_WaitHandle { diff --git a/src/afs/afs_pioctl.c b/src/afs/afs_pioctl.c index b9b9395a8..01cc42aad 100644 --- a/src/afs/afs_pioctl.c +++ b/src/afs/afs_pioctl.c @@ -203,6 +203,17 @@ static int copyin_afs_ioctl(caddr_t cmarg, struct afs_ioctl *dst) { int code; +#if defined(AFS_AIX51_ENV) && defined(AFS_64BIT_KERNEL) + struct afs_ioctl32 dst32; + + if (!(IS64U)) { + AFS_COPYIN(cmarg, (caddr_t) &dst32, sizeof dst32, code); + if (!code) + afs_ioctl32_to_afs_ioctl(&dst32, dst); + return code; + } +#endif /* defined(AFS_AIX51_ENV) && defined(AFS_64BIT_KERNEL) */ + #if defined(AFS_HPUX_64BIT_ENV) struct afs_ioctl32 dst32; diff --git a/src/afs/afs_segments.c b/src/afs/afs_segments.c index f34d5ebe2..6b8e075a0 100644 --- a/src/afs/afs_segments.c +++ b/src/afs/afs_segments.c @@ -44,7 +44,7 @@ int afs_StoreMini(register struct vcache *avc, struct vrequest *areq) struct AFSVolSync tsync; register afs_int32 code; register struct rx_call *tcall; - afs_size_t tlen, base = 0; + afs_size_t tlen, xlen = 0; XSTATS_DECLS AFS_STATCNT(afs_StoreMini); @@ -75,16 +75,16 @@ retry: XSTATS_START_TIME(AFS_STATS_FS_RPCIDX_STOREDATA); afs_Trace4(afs_iclSetp, CM_TRACE_STOREDATA64, ICL_TYPE_FID, &avc->fid.Fid, - ICL_TYPE_OFFSET, ICL_HANDLE_OFFSET(base), - ICL_TYPE_OFFSET, ICL_HANDLE_OFFSET(tlen), - ICL_TYPE_OFFSET, ICL_HANDLE_OFFSET(avc->m.Length)); + ICL_TYPE_OFFSET, ICL_HANDLE_OFFSET(avc->m.Length), + ICL_TYPE_OFFSET, ICL_HANDLE_OFFSET(xlen), + ICL_TYPE_OFFSET, ICL_HANDLE_OFFSET(tlen)); RX_AFS_GUNLOCK(); #ifdef AFS_64BIT_CLIENT if (!afs_serverHasNo64Bit(tc)) { code = StartRXAFS_StoreData64(tcall, (struct AFSFid *)&avc->fid.Fid, &InStatus, avc->m.Length, - base, tlen); + (afs_size_t) 0, tlen); } else { afs_int32 l1, l2; l1 = avc->m.Length; @@ -523,9 +523,11 @@ restart: if (!code) doProcessFS = 1; /* Flag to run afs_ProcessFS() later on */ } if (tcall) { + afs_int32 code2; RX_AFS_GUNLOCK(); - code = rx_EndCall(tcall, code); + code2 = rx_EndCall(tcall, code); RX_AFS_GLOCK(); + if (code2) code = code2; } } while (afs_Analyze(tc, code, &avc->fid, areq, AFS_STATS_FS_RPCIDX_STOREDATA, diff --git a/src/afs/afs_trace.et b/src/afs/afs_trace.et index 21c564925..6291c8230 100644 --- a/src/afs/afs_trace.et +++ b/src/afs/afs_trace.et @@ -56,7 +56,7 @@ error_table 2 ZCM ec CM_TRACE_GETDCACHE1, "Getdcache vp 0x%lx failed to find chunk 0x%x" ec CM_TRACE_GETDCACHE2, "GetdCache vp 0x%lx dcache 0x%lx dcache low-version 0x%x, vcache low-version 0x%x" ec CM_TRACE_GETDCACHE3, "GetdCache tlen 0x%x flags 0x%x abyte (0x%x, 0x%x) Position (0x%x, 0x%x)" - ec CM_TRACE_STOREMINI, "storemini vp 0x%lx length 0x%x" + ec CM_TRACE_STOREMINI, "storemini vp 0x%lx length (0x%x, 0x%x)" ec CM_TRACE_STOREDCACHE, "StoreDCache vp 0x%lx chunk 0x%x length 0x%x at position 0x%x" ec CM_TRACE_STOREDCACHEDONE, "StoreDCache Done for vp 0x%lx (returns 0x%x)" ec CM_TRACE_STOREALLDONE, "StoreAll Done vp 0x%lx length 0x%x (returns 0x%x)" @@ -71,7 +71,7 @@ error_table 2 ZCM ec CM_TRACE_NFSOUT, "NfsOut op 0x%x vp 0x%lx fid (%x:%d.%d.%d)" ec CM_TRACE_NFSIN, "NfsIn op 0x%x" ec CM_TRACE_NFSIN1, "Nfs Root fid client 0x%lx fid (%x:%d.%d.%d)" - ec CM_TRACE_FLUSHPAGES, "flushpages vp 0x%x data version low 0x%x length 0x%x" + ec CM_TRACE_FLUSHPAGES, "flushpages vp 0x%lx data version low 0x%x length 0x%x" ec CM_TRACE_SYNCVM, "SyncVM vp 0x%lx length 0x%x" ec CM_TRACE_PIOCTL, "Pioctl command 0x%x for vp 0x%lx, follow=%d" ec CM_TRACE_CHECKCODE, "Returning code %d from %d" @@ -85,13 +85,13 @@ error_table 2 ZCM ec CM_TRACE_READ, "Read vp 0x%lx off (0x%x, 0x%x) resid 0x%x file length (0x%x, 0x%x)" ec CM_TRACE_PARTIALWRITE, "Partial write vp 0x%lx length (0x%x, 0x%x)" ec CM_TRACE_GETATTR, "Getattr vp 0x%lx len (0x%x, 0x%x)" - ec CM_TRACE_SETATTR, "Setattr vp 0x%lx len (0x%x, 0x%x)" + ec CM_TRACE_SETATTR, "Setattr vp 0x%lx mask 0x%x newlen (0x%x, 0x%x) oldlen (0x%x, 0x%x)" ec CM_TRACE_ACCESS, "Access vp 0x%lx mode 0x%x len (0x%x, 0x%x)" ec CM_TRACE_LOOKUP, "Lookup adp 0x%lx name %s fid (%d:%d.%d.%d), code=%d" ec CM_TRACE_LOOKUP1, "Mount point is to vp 0x%lx fid (%d:%d.%d.%d)" ec CM_TRACE_CREATE, "create file in vp 0x%lx name %s mode 0x%x" ec CM_TRACE_REMOVE, "remove dir 0x%lx name %s" - ec CM_TRACE_LINK, "hard link dir 0x%lx vp %lx name %s" + ec CM_TRACE_LINK, "hard link dir 0x%lx vp 0x%lx name %s" ec CM_TRACE_RENAME, "Rename d1 0x%lx name %s to d2 0x%lx name %s" ec CM_TRACE_MKDIR, "Mkdir parent 0x%lx entry %s" ec CM_TRACE_RMDIR, "Rmdir parent 0x%lx entry %s" @@ -102,7 +102,7 @@ error_table 2 ZCM ec CM_TRACE_LOCKDONE, "%s line %d: Released lock 0x%lx level %d" ec CM_TRACE_LOCKDOWN, "%s line %d: Downgraded lock 0x%lx to %d" ec CM_TRACE_LOCKOBTAIN,"%s line %d: Obtained lock 0x%lx level %d" - ec CM_TRACE_LOCKSLEPT, "%s line %d: Slept for lock 0x%lx level %d" + ec CM_TRACE_LOCKSLEPT, "Slept %lu us for lock 0x%lx level %d" ec CM_TRACE_PAGE_READ, "0x%lx called page_read (returned %d) states 0x%x" ec CM_TRACE_PAGE_WRITE, "0x%lx called page_write (returned %d) states 0x%x" @@ -128,23 +128,23 @@ error_table 2 ZCM ec CM_TRACE_UPDATEPAGE, "Iupdatepage ip 0x%lx pp 0x%x count 0x%x code %d" ec CM_TRACE_VM_CLOSE, "VMclose ip 0x%lx mapcnt %d opens %d XoW %d" ec CM_TRACE_FETCH64, "FetchProc for vp = 0x%lx oldserver was %d, found length (0x%x, 0x%x)" - ec CM_TRACE_UFSLINK, "UFSHandleLink: vp = 0x%lx, tdc 0 0x%lx, len (0x%x, 0x%x)" + ec CM_TRACE_UFSLINK, "UFSHandleLink: vp = 0x%lx, tdc 0x%lx, len (0x%x, 0x%x)" ec CM_TRACE_VMRDWR, "afs_vm_rdwr: vp = 0x%lx, xfrSize 0x%lx, toffset 0x%x" ec CM_TRACE_READFAST, "ReadFast vp 0x%lx off (0x%x, 0x%x) resid 0x%x file length (0x%x, 0x%x)" - ec CM_TRACE_FETCH64CODE, "StartRX_FetchData64 for vp 0x%x returned %d" - ec CM_TRACE_FETCH64LENG, "FetchData64 for vp 0x%x code = %d, length = (0x%x, 0x%x)" - ec CM_TRACE_FETCH64READ, "FetchData64 for vp 0x%x code = %d, length = 0x%x" - ec CM_TRACE_VMWRITE, "afs_vm_rdwr: vp 0x%x offset (0x%x, 0x%x) length (0x%x, 0x%x)" - ec CM_TRACE_VMWRITE2, "afs_vm_rdwr: vp 0x%x first page 0x%x pages %d" - ec CM_TRACE_VMSTOREALL, "osi_VM_StoreAllSegments for vp 0x%x call %d" + ec CM_TRACE_FETCH64CODE, "StartRX_FetchData64 for vp 0x%lx returned %d" + ec CM_TRACE_FETCH64LENG, "FetchData64 for vp 0xl%x code = %d, length = (0x%x, 0x%x)" + ec CM_TRACE_FETCH64READ, "FetchData64 for vp 0xl%x code = %d, length = 0x%x" + ec CM_TRACE_VMWRITE, "afs_vm_rdwr: vp 0x%lx offset (0x%x, 0x%x) length (0x%x, 0x%x)" + ec CM_TRACE_VMWRITE2, "afs_vm_rdwr: vp 0x%lx first page 0x%x pages %d" + ec CM_TRACE_VMSTOREALL, "osi_VM_StoreAllSegments for vp 0x%lx call %d" ec CM_TRACE_PARTIALWRITE0, "Partial write currDirty %d maxDirty %d" - ec CM_TRACE_DIRECTRDWR, "direct_rdwr: vp 0x%x offset (0x%x, 0x%x) resid 0x%x" + ec CM_TRACE_DIRECTRDWR, "direct_rdwr: vp 0x%lx offset (0x%x, 0x%x) resid 0x%x" ec CM_TRACE_GOPRDWR, "gop_rdwr: offset (0x%x, 0x%x) len 0x%x resid 0x%x code %d" ec CM_TRACE_GRDWR1, "Gn_rdwr error vp 0x%lx returns %d" - ec CM_TRACE_READTDC, "UFSRead: vp 0x%lx tdc 0x%x at %d refcount 0x%x" - ec CM_TRACE_MEMFETCH, "MemFetch: vp 0x%x mceP 0x%x offset (0x%x, 0x%x) length 0x%x" - ec CM_TRACE_VMWRITE3, "afs_vm_rdwr: vp 0x%x code %d" - ec CM_TRACE_STOREALL2, "StoreAll 2 vp 0x%x chunk 0x%x index %d inode %d" + ec CM_TRACE_READTDC, "UFSRead: vp 0x%lx tdc 0x%lx at %d refcount 0x%x" + ec CM_TRACE_MEMFETCH, "MemFetch: vp 0x%lx mceP 0x%lx offset (0x%x, 0x%x) length 0x%x" + ec CM_TRACE_VMWRITE3, "afs_vm_rdwr: vp 0x%lx code %d" + ec CM_TRACE_STOREALL2, "StoreAll 2 vp 0x%lx chunk 0x%x index %d inode %d" ec CM_TRACE_MEMOPEN, "MemOpen blkno %d mceP 0x%x data 0x%x = %s" ec CM_TRACE_VCACHE2INODE, "vcache2inode: avc 0x%x event %d" ec CM_TRACE_STOREDATA64, "StoreData64: fid (%d:%d.%d.%d) offs (0x%x, 0x%x) len (0x%x, 0x%x) file length (0x%x, 0x%x)" @@ -154,9 +154,9 @@ error_table 2 ZCM ec CM_TRACE_ADJUSTSIZE, "AdjustSize index %d oldSize %d newSize %d blocksUsed %d" ec CM_TRACE_SETLENGTH, "%s line %d: m.Length was (0x%x, 0x%x), now (0x%x, 0x%x)" ec CM_TRACE_DCACHEWAIT, "%s line %d: waiting for 0x%x flags 0x%x" - ec CM_TRACE_VNODEREAD, "UFSRead: tdc 0x%x, offset (0x%x, 0x%x) len (0x%x 0x%x)" - ec CM_TRACE_SLEEP, "Sleep: evp 0x%x, count %d seq 0x%x evp->seq 0x%x" - ec CM_TRACE_WAKE, "Wakeup: evp 0x%x, evp->seq 0x%x" + ec CM_TRACE_VNODEREAD, "UFSRead: tdc 0x%lx, offset (0x%x, 0x%x) len (0x%x 0x%x)" + ec CM_TRACE_SLEEP, "Sleep: evp 0x%lx, count %d seq 0x%x evp->seq 0x%x" + ec CM_TRACE_WAKE, "Wakeup: evp 0x%lx, evp->seq 0x%x" ec CM_TRACE_DENTRYDELETE, "d_delete inode 0x%x d_name %s/%s" ec CM_TRACE_DENTRYIPUT, "d_iput inode 0x%x d_name %s/%s" ec CM_TRACE_TRYFLUSHDCACHECHILDREN, "TryFlushDcacheChildren ip 0x%x name %s parent %s" @@ -168,5 +168,10 @@ error_table 2 ZCM ec CM_TRACE_GNGETACL, "Gn_getacl vp 0x%lx (returns 0x%x)" ec CM_TRACE_EINVAL, "EINVAL in %s at line %d" ec CM_TRACE_VNODEREAD2, "negative length tdc 0x%lx validPos (0x%x, 0x%x) chunkBytes 0x%x dflags 0x%x" + ec CM_TRACE_WASHERE, "Was here: %s line %d, code = %d" + ec CM_TRACE_LOCKWAIT,"%s line %d: Waiting for lock 0x%lx level %d" + ec CM_TRACE_WRITEFAILED, "osi_Write failed len %ld resid %ld err %ld" + ec CM_TRACE_ADJUSTSIZE2, "AdjustSize dc = 0x%lx, chunkBytes = 0x%x + used = %ld, diff = %ld" end diff --git a/src/afs/afs_vcache.c b/src/afs/afs_vcache.c index 7e21e9d71..9b3c01092 100644 --- a/src/afs/afs_vcache.c +++ b/src/afs/afs_vcache.c @@ -1896,7 +1896,7 @@ struct vcache *afs_LookupVCache(struct VenusFid *afid, struct vrequest *areq, if (!tvc) { /* no cache entry, better grab one */ UpgradeSToWLock(&afs_xvcache,22); - tvc = afs_NewVCache(&nfid, NULL); + tvc = afs_NewVCache(&nfid, serverp); newvcache = 1; ConvertWToSLock(&afs_xvcache); } diff --git a/src/afsd/rc.afs.rs_aix b/src/afsd/rc.afs.rs_aix index 665b0c15c..1fd8ba4c6 100644 --- a/src/afsd/rc.afs.rs_aix +++ b/src/afsd/rc.afs.rs_aix @@ -46,10 +46,26 @@ else RMTSYS="" fi +# find out whether we have 32 or 64 bit kernel + +kernel=32 +if [ -x /bin/w64 ]; then + /bin/w64 >/dev/null 2>&1 + if [ $? -eq 0 ]; then + kernel=64 + fi +fi + # Load AFS into the kernel + cd /usr/vice/etc/dkload -/usr/vice/etc/dkload/cfgexport -a /usr/vice/etc/dkload/export.ext${ExportExt} -/usr/vice/etc/dkload/cfgafs -a /usr/vice/etc/dkload/afs.ext${AFSExt} +if [ $kernel -eq 32 ]; then + echo "32-bit kernel found" + ./cfgexport -a export.ext${ExportExt} && ./cfgafs -a afs.ext.32 +else + echo "64-bit kernel assumed" + ./cfgexport64 -a export64.ext${ExportExt} && ./cfgafs64 -a afs.ext.64 +fi if [ $? -ne 0 ]; then /bin/echo "Unable to load AFS extensions into kernel. Not starting client." exit 1 diff --git a/src/afsd/rc.dkload.client.rs_aix b/src/afsd/rc.dkload.client.rs_aix index b8cc520de..b2fe37472 100644 --- a/src/afsd/rc.dkload.client.rs_aix +++ b/src/afsd/rc.dkload.client.rs_aix @@ -6,5 +6,19 @@ # directory or online at http://www.openafs.org/dl/license10.html echo 'Loading AFS ...'>/dev/console -/usr/vice/etc/dkload/cfgexport -a /usr/vice/etc/dkload/export.ext.nonfs -/usr/vice/etc/dkload/cfgafs -a /usr/vice/etc/dkload/afs.ext +# Load AFS into the kernel +cd /usr/vice/etc/dkload +./cfgexport -a /usr/vice/etc/dkload/export.ext.nonfs +if [ $? -eq 0 ]; then + echo "32-bit kernel found" + ./cfgafs -a /usr/vice/etc/dkload/afs.ext.32 +else + echo "64-bit kernel assumed" + ./cfgexport64 -a /usr/vice/etc/dkload/export64.ext.nonfs + ./cfgafs64 -a /usr/vice/etc/dkload/afs.ext.64 +fi +if [ $? -ne 0 ]; then + /bin/echo "Unable to load AFS extensions into kernel." + exit 1 +fi + diff --git a/src/export/Makefile.in b/src/export/Makefile.in index 893937189..20891ebb8 100644 --- a/src/export/Makefile.in +++ b/src/export/Makefile.in @@ -25,7 +25,7 @@ noversion system: install install: ${DESTDIR}${libdir}/afs/export.exp ${DESTDIR}${libdir}/afs/extras.exp -export.ext: export4.exp export5.exp +export.exp: export4.exp export5.exp case ${SYS_NAME} in \ rs_aix4* ) \ cp -p export4.exp export.exp ; \ @@ -102,7 +102,7 @@ cfgafs64.o: cfgafs.c AFS_component_version_number.c ${CC} -q64 ${CFLAGS} -c cfgafs.c -o cfgafs64.o clean: - $(RM) -f *.o *.Zlst *.map *.out cfgexport cfgafs *.ext AFS_component_version_number.c + $(RM) -f *.o *.Zlst *.map *.out cfgexport cfgafs *.ext AFS_component_version_number.c export.exp ${DEST}/root.client/usr/vice/etc/dkload/export.ext: export.ext ${INSTALL} $? $@ diff --git a/src/export/export.c b/src/export/export.c index 6c0dca768..ece1c21fd 100644 --- a/src/export/export.c +++ b/src/export/export.c @@ -168,7 +168,11 @@ import_kfunc(struct k_func *kfp) { #endif if (!myg_toc) { +#ifdef __XCOFF64__ + sym = sym_lookup("ktoc", 0); +#else sym = sym_lookup("g_toc", 0); +#endif if (!sym) { printf("\nimport: can't ascertain kernel's TOC\n"); return EINVAL; @@ -183,7 +187,7 @@ import_kfunc(struct k_func *kfp) { } kfp->fdesc[0] = sym->n_value; - kfp->fdesc[1] = myg_toc; + kfp->fdesc[1] = *myg_toc; kfp->fdesc[2] = 0; #ifdef __XCOFF64__ diff --git a/src/export/export.exp b/src/export/export4-64.exp similarity index 100% rename from src/export/export.exp rename to src/export/export4-64.exp diff --git a/src/export/export4.exp b/src/export/export4.exp new file mode 100644 index 000000000..32ee19844 --- /dev/null +++ b/src/export/export4.exp @@ -0,0 +1,16 @@ +#!/unix +* +* $Locker$ +* +* EXPORT exports +* +import_kfunc +import_kvar +* +* Overwrite vanilla system calls +* +osetgroups syscall +okioctl syscall + + + diff --git a/src/export/export5-64.exp b/src/export/export5-64.exp new file mode 100644 index 000000000..be4d2c559 --- /dev/null +++ b/src/export/export5-64.exp @@ -0,0 +1,15 @@ +#!/unix +* +* $Locker$ +* +* EXPORT exports +* +import_kfunc +import_kvar +* +* Overwrite vanilla system calls +* +okioctl syscall + + + diff --git a/src/export/export5.exp b/src/export/export5.exp index 14a8b3e89..a7a68f502 100644 --- a/src/export/export5.exp +++ b/src/export/export5.exp @@ -9,8 +9,7 @@ import_kvar * * Overwrite vanilla system calls * -*osetgroups syscall -okioctl syscall +okioctl32 syscall diff --git a/src/libafs/MakefileProto.AIX.in b/src/libafs/MakefileProto.AIX.in index 089a3c20a..99a7d38e4 100644 --- a/src/libafs/MakefileProto.AIX.in +++ b/src/libafs/MakefileProto.AIX.in @@ -8,7 +8,6 @@ srcdir=@srcdir@ include @TOP_OBJDIR@/src/config/Makefile.config - # OS specific object files: AFS_OS_OBJS = \ osi_assem.o \ @@ -44,7 +43,9 @@ OPT2 = -O IMPORTS = -bI:/lib/kernex.exp -bI:/lib/syscalls.exp -bI:/lib/sockets.exp \ -bI:/lib/netinet.exp \ - -bI:${TOP_LIBDIR}/extras.exp -bI:${TOP_LIBDIR}/export.exp + -bI:${TOP_LIBDIR}/extras.exp +IMPORTS32 = -bI:${TOP_LIBDIR}/export.exp +IMPORTS64 = -bI:${TOP_LIBDIR}/export64.exp KDEFS = -U_IBMR2 -D_POWER -D_AIX -DNLS -D_NLS -DMSG -D__STR31__ -Daiws \ -D_POWER_RS -D_POWER_PC -D_POWER_RS1 -D_POWER_RS2 -D_POWER_RSC \ -D_POWER_601 -D_POWER_603 -D_POWER_604 -D_THREADS -M -D_KERNEL \ @@ -52,27 +53,24 @@ KDEFS = -U_IBMR2 -D_POWER -D_AIX -DNLS -D_NLS -DMSG -D__STR31__ -Daiws \ -DGETMOUNT -H8 -DAFS -DAFS_COMMON -D_VOPS -D_SUN -DKERNEL LDSTUFF= -b"binder:/usr/lib/bind glink:/usr/lib/glink.o" -bnoentry -b h:4 \ -D0 -T512 +LDSTUFF64= -b"binder:/usr/lib/bind glink:/usr/lib/glink64.o" -bnoentry -b h:4 \ + -D0 -T512 LDFLAGS = -m -eafs_config -bexport:${TOP_LIBDIR}/afs.exp ${IMPORTS} \ - -lsys -lcsys + -lsys -lcsys ${KLDOPTS} CFLAGS=-I. -I.. -I${TOP_OBJDIR}/src/config ${FSINCLUDES} $(KDEFS) $(KOPTS) ${DBUG} # Name of directory to hold object files and libraries. -KOBJ = MODLOAD +KOBJ = MODLOAD MODLOAD64 # This tells Makefile.common to use it's single directory build target. -COMPDIRS = single_compdir -INSTDIRS = single_instdir -DESTDIRS = single_destdir +COMPDIRS = aix_compdirs +INSTDIRS = aix_instdirs +DESTDIRS = aix_destdirs include Makefile.common setup: - -mkdir $(KOBJ) - -$(RM) $(KOBJ)/Makefile $(KOBJ)/Makefile.common $(KOBJ)/config - ln -fs ../Makefile $(KOBJ)/Makefile - ln -fs ../Makefile.common $(KOBJ)/Makefile.common - ln -fs ../config $(KOBJ)/config -$(RM) -f h net netinet rpc ufs nfs machine sys ln -fs /usr/include/sys h ln -fs /usr/include/net net @@ -81,7 +79,46 @@ setup: ln -fs /usr/include/sys sys ln -fs /usr/include/nfs nfs ln -fs /usr/include/jfs ufs - + for m in 32 64 ; do \ + KDIR=MODLOAD-$$m ; \ + mkdir -p $${KDIR} ; \ + ln -fs ../Makefile $${KDIR}/Makefile ; \ + ln -fs ../Makefile.common $${KDIR}/Makefile.common ; \ + ln -fs ../config $${KDIR}/config ; \ + done + +${COMPDIRS} ${INSTDIRS} ${DESTDIRS}: + for m in 32 64 ; do \ + KDIR=MODLOAD-$$m ; \ + echo Building in directory: $${KDIR} ; \ + if [ "$$m" = "32" ] ; then \ + KOPTS="-q32" ; \ + KLDOPTS="-b32" ; \ + KASOPTS="32" ; \ + TARG="afs.ext.32" ; \ + elif [ "$$m" = "64" ] ; then \ + KOPTS="-q64 -DAFS_64BIT_KERNEL -D__64BIT_KERNEL" ; \ + KLDOPTS="-b64" ; \ + KASOPTS="64" ; \ + TARG="afs.ext.64" ; \ + fi ; \ + cd $${KDIR} ; \ + $(MAKE) DEST="$${DEST}" KOPTS="$${KOPTS}" KLDOPTS="$${KLDOPTS}" KASOPTS="$${KASOPTS}" $@_$${TARG} || exit $$?; \ + cd ../ ; \ + done + +aix_compdirs_afs.ext.32: afs.ext.32 +aix_compdirs_afs.ext.64: afs.ext.64 +aix_instdirs_afs.ext.32: install_afs.ext.32 +aix_instdirs_afs.ext.64: install_afs.ext.64 +aix_destdirs_afs.ext.32: dest_afs.ext.32 +aix_destdirs_afs.ext.64: dest_afs.ext.64 + +dest_afs.ext.32: $(DEST)/root.client/usr/vice/etc/dkload/afs.ext.32 + echo Install for 32-bit Kernel Complete + +dest_afs.ext.64: $(DEST)/root.client/usr/vice/etc/dkload/afs.ext.64 + echo Install for 64-bit Kernel Complete # Standard AFS->NFS translator support is removed in AFS 3.5 in favor of # the iauth authentication mechanism. The model was changed by IBM in the @@ -93,14 +130,18 @@ LIBAFSIAUTH = afs.ext.iauth LIBAFS = afs.ext DEST_LIBAFSIAUTH = $(DEST)/root.client/usr/vice/etc/dkload/$(LIBAFSIAUTH) -DEST_LIBAFS = $(DEST)/root.client/usr/vice/etc/dkload/$(LIBAFS) INST_LIBAFSIAUTH = ${DESTDIR}${afskerneldir}/$(LIBAFSIAUTH) INST_LIBAFS = ${DESTDIR}${afskerneldir}/$(LIBAFS) -$(DEST_LIBAFS): $(LIBAFS) +$(DEST)/root.client/usr/vice/etc/dkload/afs.ext.32: afs.ext.32 $(INSTALL) -f $? $@ - -${STRIP} $@ + -${STRIP} -X 32 $@ + $(INSTALL) -f $?.map $@.map + +$(DEST)/root.client/usr/vice/etc/dkload/afs.ext.64: afs.ext.64 + $(INSTALL) -f $? $@ + -${STRIP} -X 64 $@ $(INSTALL) -f $?.map $@.map $(DEST_LIBAFSIAUTH): $(LIBAFSIAUTH) @@ -122,29 +163,44 @@ $(INST_LIBAFSIAUTH): $(LIBAFSIAUTH) $(LIBAFSIAUTH): $(AFSAOBJS) $(AFSIAUTHOBJS) ${LD} ${LDSTUFF} -bloadmap:afs.ext.iauth.loadmap \ -bmap:afs.ext.iauth.map -o afs.ext.iauth \ - ${AFSAOBJS} ${AFSIAUTHOBJS} ${LIBS} ${LDFLAGS} + ${AFSAOBJS} ${AFSIAUTHOBJS} ${LIBS} ${LDFLAGS} ${IMPORTS32} -$(LIBAFS): $(AFSAOBJS) $(AFSNOIAUTHOBJS) - ${LD} ${LDSTUFF} -bloadmap:afs.ext.loadmap \ - -bmap:afs.ext.map -o afs.ext \ - ${AFSAOBJS} ${AFSNOIAUTHOBJS} ${LIBS} ${LDFLAGS} +afs.ext.32: $(AFSAOBJS) $(AFSNOIAUTHOBJS) + ${LD} ${LDSTUFF} -bloadmap:afs.ext.32.loadmap \ + -bmap:afs.ext.32.map -o afs.ext.32 \ + ${AFSAOBJS} ${AFSNOIAUTHOBJS} ${LIBS} \ + ${LDFLAGS} ${IMPORTS32} -libafs: $(LIBAFS) $(LIBAFSIAUTH) +afs.ext.64: $(AFSAOBJS) $(AFSNOIAUTHOBJS) + ${LD} ${LDSTUFF64} -b64 -bloadmap:afs.ext.64.loadmap \ + -bmap:afs.ext.64.map -o afs.ext.64 \ + ${AFSAOBJS} ${AFSNOIAUTHOBJS} ${LIBS} \ + ${LDFLAGS} ${IMPORTS64} + +libafs: $(LIBAFS) $(LIBAFS64) $(LIBAFSIAUTH) install_libafs: $(INST_LIBAFS) $(INST_LIBAFSIAUTH) dest_libafs: $(DEST_LIBAFS) $(DEST_LIBAFSIAUTH) -osi_assem.o: $(TOP_SRCDIR)/afs/$(MKAFS_OSTYPE)/osi_assem.s - ${AS} -o osi_assem.o $(TOP_SRCDIR)/afs/$(MKAFS_OSTYPE)/osi_assem.s +osi_assem.o: osi_assem.s + ${AS} -a${KASOPTS} -o osi_assem.o osi_assem.s +osi_assem.s: $(TOP_SRCDIR)/afs/$(MKAFS_OSTYPE)/osi_assem32.s $(TOP_SRCDIR)/afs/$(MKAFS_OSTYPE)/osi_assem64.s + case bit${KASOPTS} in \ + bit64 ) \ + cp -p $(TOP_SRCDIR)/afs/$(MKAFS_OSTYPE)/osi_assem64.s osi_assem.s ;; \ + * ) \ + cp -p $(TOP_SRCDIR)/afs/$(MKAFS_OSTYPE)/osi_assem32.s osi_assem.s ;; \ + esac + # Build rules for iauth objects. afs_call_iauth.o: $(AFS)/afs_call.c - $(CRULE_NOOPT) -DAFS_NONFSTRANS -DAFS_AIX_IAUTH_ENV -o afs_call_iauth.o + $(CRULE1) -DAFS_NONFSTRANS -DAFS_AIX_IAUTH_ENV -o afs_call_iauth.o afs_nfsclnt_iauth.o: $(AFS)/afs_nfsclnt.c - $(CRULE_NOOPT) -DAFS_NONFSTRANS -DAFS_AIX_IAUTH_ENV -o afs_nfsclnt_iauth.o + $(CRULE1) -DAFS_NONFSTRANS -DAFS_AIX_IAUTH_ENV -o afs_nfsclnt_iauth.o afs_pioctl_iauth.o: $(AFS)/afs_pioctl.c - $(CRULE_NOOPT) -DAFS_NONFSTRANS -DAFS_AIX_IAUTH_ENV -o afs_pioctl_iauth.o -osi_vfsops_iauth.o: $(TOP_SRCDIR)/afs/$(MKAFS_OSTYPE)/osi_vnodeops.c - $(CRULE_NOOPT) -DAFS_NONFSTRANS -DAFS_AIX_IAUTH_ENV -o osi_vfsops_iauth.o -osi_vnodeops_iauth.o: $(TOP_SRCDIR)/afs/$(MKAFS_OSTYPE)/osi_vnodeops.c - $(CRULE_NOOPT) -DAFS_NONFSTRANS -DAFS_AIX_IAUTH_ENV -o osi_vnodeops_iauth.o + $(CRULE1) -DAFS_NONFSTRANS -DAFS_AIX_IAUTH_ENV -o afs_pioctl_iauth.o +osi_vfsops_iauth.o: $(AFS)/osi_vfsops.c + $(CRULE1) -DAFS_NONFSTRANS -DAFS_AIX_IAUTH_ENV -o osi_vfsops_iauth.o +osi_vnodeops_iauth.o: $(AFS)/osi_vnodeops.c + $(CRULE1) -DAFS_NONFSTRANS -DAFS_AIX_IAUTH_ENV -o osi_vnodeops_iauth.o diff --git a/src/rx/AIX/rx_kmutex.h b/src/rx/AIX/rx_kmutex.h index 00e79bf00..3b00e5cff 100644 --- a/src/rx/AIX/rx_kmutex.h +++ b/src/rx/AIX/rx_kmutex.h @@ -44,7 +44,7 @@ #define CV_SIGNAL(_cv) e_wakeup_one(_cv) #define CV_BROADCAST(_cv) e_wakeup(_cv) typedef simple_lock_data afs_kmutex_t; -typedef int afs_kcondvar_t; +typedef tid_t afs_kcondvar_t; #define osi_rxWakeup(cv) e_wakeup(cv) diff --git a/src/rx/AIX/rx_knet.c b/src/rx/AIX/rx_knet.c index 4d1ecb206..5945003c1 100644 --- a/src/rx/AIX/rx_knet.c +++ b/src/rx/AIX/rx_knet.c @@ -145,6 +145,15 @@ register struct mbuf *am; { tlen = ntohs((u_short)tvu->ui_ulen); if ((int)ti->ip_len != tlen) { if (tlen > (int)ti->ip_len) { +#ifdef RX_KERNEL_TRACE + int glockOwner = ISAFS_GLOCK(); + if (!glockOwner) AFS_GLOCK(); + afs_Trace3(afs_iclSetp, CM_TRACE_WASHERE, + ICL_TYPE_STRING, __FILE__, + ICL_TYPE_INT32, __LINE__, + ICL_TYPE_INT32, tlen); + if (!glockOwner) AFS_GUNLOCK(); +#endif m_free(am); return; } @@ -163,18 +172,47 @@ register struct mbuf *am; { * underlying network (and interfaces and drivers and * DMA hardware, etc!) is error-free. First, fill * in entire virtual ip header. */ +#ifndef AFS_64BIT_KERNEL tvu->ui_next = 0; tvu->ui_prev = 0; +#endif tvu->ui_x1 = 0; tvu->ui_len = tvu->ui_ulen; am->m_flags |= M_PKTHDR; am->m_pkthdr.len = tlen; +#if !defined(AFS_AIX51_ENV) || !defined(AFS_64BIT_KERNEL) if (in_cksum(am, sizeof(struct ip) + tlen)) { /* checksum, including cksum field, doesn't come out 0, so this packet is bad */ +#ifdef RX_KERNEL_TRACE + int glockOwner = ISAFS_GLOCK(); + if (!glockOwner) AFS_GLOCK(); + afs_Trace3(afs_iclSetp, CM_TRACE_WASHERE, + ICL_TYPE_STRING, __FILE__, + ICL_TYPE_INT32, __LINE__, + ICL_TYPE_INT32, tlen); + if (!glockOwner) AFS_GUNLOCK(); +#endif m_freem(am); return; } +#else +#ifdef notdef + { /* in_cksum() doesn't work correctly or the length is wrong? */ + int cksum; + int glockOwner = ISAFS_GLOCK(); + cksum = in_cksum(am, sizeof(struct ip) + tlen); + if (!glockOwner) + AFS_GLOCK(); + afs_Trace3(afs_iclSetp, CM_TRACE_WASHERE, + ICL_TYPE_STRING, __FILE__, + ICL_TYPE_INT32, __LINE__, + ICL_TYPE_INT32, cksum); + if (!glockOwner) + AFS_GUNLOCK(); + } +#endif +#endif } /* diff --git a/src/rx/rx.c b/src/rx/rx.c index e2cdc4127..68854a64a 100644 --- a/src/rx/rx.c +++ b/src/rx/rx.c @@ -34,6 +34,9 @@ RCSID("$Header$"); #include "netinet/in.h" #include "afs/afs_args.h" #include "afs/afs_osi.h" +#ifdef RX_KERNEL_TRACE +#include "rx_kcommon.h" +#endif #if (defined(AFS_AUX_ENV) || defined(AFS_AIX_ENV)) #include "h/systm.h" #endif @@ -314,6 +317,7 @@ static int rxdb_fileID = RXDB_FILE_RX; #define CLEAR_CALL_QUEUE_LOCK(C) #endif /* RX_ENABLE_LOCKS */ struct rx_serverQueueEntry *rx_waitForPacket = 0; +struct rx_serverQueueEntry *rx_waitingForPacket = 0; /* ------------Exported Interfaces------------- */ @@ -1500,6 +1504,8 @@ struct rx_call *rx_GetCall(int tno, struct rx_service *cur_service, osi_socket * queue_Append(&rx_idleServerQueue, sq); #ifndef AFS_AIX41_ENV rx_waitForPacket = sq; +#else + rx_waitingForPacket = sq; #endif /* AFS_AIX41_ENV */ do { CV_WAIT(&sq->cv, &rx_serverPool_lock); @@ -1528,6 +1534,19 @@ struct rx_call *rx_GetCall(int tno, struct rx_service *cur_service, osi_socket * clock_GetTime(&call->startTime); call->state = RX_STATE_ACTIVE; call->mode = RX_MODE_RECEIVING; +#ifdef RX_KERNEL_TRACE + if (ICL_SETACTIVE(afs_iclSetp)) { + int glockOwner = ISAFS_GLOCK(); + if (!glockOwner) + AFS_GLOCK(); + afs_Trace3(afs_iclSetp, CM_TRACE_WASHERE, + ICL_TYPE_STRING, __FILE__, + ICL_TYPE_INT32, __LINE__, + ICL_TYPE_POINTER, call); + if (!glockOwner) + AFS_GUNLOCK(); + } +#endif rxi_calltrace(RX_CALL_START, call); dpf(("rx_GetCall(port=%d, service=%d) ==> call %x\n", @@ -1663,6 +1682,19 @@ struct rx_call *rx_GetCall(int tno, struct rx_service *cur_service, osi_socket * clock_GetTime(&call->startTime); call->state = RX_STATE_ACTIVE; call->mode = RX_MODE_RECEIVING; +#ifdef RX_KERNEL_TRACE + if (ICL_SETACTIVE(afs_iclSetp)) { + int glockOwner = ISAFS_GLOCK(); + if (!glockOwner) + AFS_GLOCK(); + afs_Trace3(afs_iclSetp, CM_TRACE_WASHERE, + ICL_TYPE_STRING, __FILE__, + ICL_TYPE_INT32, __LINE__, + ICL_TYPE_POINTER, call); + if (!glockOwner) + AFS_GUNLOCK(); + } +#endif rxi_calltrace(RX_CALL_START, call); dpf(("rx_GetCall(port=%d, service=%d) ==> call %x\n", @@ -3897,6 +3929,19 @@ void rxi_AttachServerProc(register struct rx_call *call, } call->state = RX_STATE_ACTIVE; call->mode = RX_MODE_RECEIVING; +#ifdef RX_KERNEL_TRACE + { + int glockOwner = ISAFS_GLOCK(); + if (!glockOwner) + AFS_GLOCK(); + afs_Trace3(afs_iclSetp, CM_TRACE_WASHERE, + ICL_TYPE_STRING, __FILE__, + ICL_TYPE_INT32, __LINE__, + ICL_TYPE_POINTER, call); + if (!glockOwner) + AFS_GUNLOCK(); + } +#endif if (call->flags & RX_CALL_CLEARED) { /* send an ack now to start the packet flow up again */ call->flags &= ~RX_CALL_CLEARED; diff --git a/src/rx/rx.h b/src/rx/rx.h index 4027d94ba..311b7a2ef 100644 --- a/src/rx/rx.h +++ b/src/rx/rx.h @@ -71,7 +71,11 @@ /* Configurable parameters */ #define RX_IDLE_DEAD_TIME 60 /* default idle dead time */ #define RX_MAX_SERVICES 20 /* Maximum number of services that may be installed */ +#if defined(KERNEL) && defined(AFS_AIX51_ENV) && defined(__64__) +#define RX_DEFAULT_STACK_SIZE 24000 +#else #define RX_DEFAULT_STACK_SIZE 16000 /* Default process stack size; overriden by rx_SetStackSize */ +#endif /* This parameter should not normally be changed */ #define RX_PROCESS_PRIORITY LWP_NORMAL_PRIORITY diff --git a/src/rx/rx_clock.h b/src/rx/rx_clock.h index d1fe2a001..46ed6f5d1 100644 --- a/src/rx/rx_clock.h +++ b/src/rx/rx_clock.h @@ -90,7 +90,17 @@ extern int clock_nUpdates; #if defined(AFS_SGI61_ENV) || defined(AFS_HPUX_ENV) || defined(AFS_LINUX_64BIT_KERNEL) #define clock_GetTime(cv) osi_GetTime((osi_timeval_t *)cv) #else +#if defined(AFS_AIX51_ENV) && defined(AFS_64BIT_KERNEL) +#define clock_GetTime(cv) \ + BEGIN \ + struct timeval tv; \ + osi_GetTime(&tv); \ + (cv)->sec = (afs_int32)tv.tv_sec; \ + (cv)->usec = (afs_int32)tv.tv_usec; \ + END +#else /* defined(AFS_AIX51_ENV) && defined(AFS_64BIT_KERNEL) */ #define clock_GetTime(cv) osi_GetTime((struct timeval *)cv) +#endif /* defined(AFS_AIX51_ENV) && defined(AFS_64BIT_KERNEL) */ #endif #define clock_Sec() osi_Time() #define clock_NewTime() /* don't do anything; clock is fast enough in kernel */ diff --git a/src/rx/rx_kcommon.c b/src/rx/rx_kcommon.c index 29f589c82..9db6db5f3 100644 --- a/src/rx/rx_kcommon.c +++ b/src/rx/rx_kcommon.c @@ -940,19 +940,23 @@ int rxk_ReadPacket(osi_socket so, struct rx_packet *p, int *host, int *port) nbytes = tlen + sizeof(afs_int32); #ifdef RX_KERNEL_TRACE + if (ICL_SETACTIVE(afs_iclSetp)) { AFS_GLOCK(); afs_Trace1(afs_iclSetp, CM_TRACE_TIMESTAMP, ICL_TYPE_STRING, "before osi_NetRecive()"); AFS_GUNLOCK(); + } #endif code = osi_NetReceive(rx_socket, &from, p->wirevec, p->niovecs, &nbytes); #ifdef RX_KERNEL_TRACE + if (ICL_SETACTIVE(afs_iclSetp)) { AFS_GLOCK(); afs_Trace1(afs_iclSetp, CM_TRACE_TIMESTAMP, ICL_TYPE_STRING, "after osi_NetRecive()"); AFS_GUNLOCK(); + } #endif /* restore the vec to its correct state */ p->wirevec[p->niovecs-1].iov_len = savelen; diff --git a/src/rx/rx_kcommon.h b/src/rx/rx_kcommon.h index 23fcf74f9..ccd4102c9 100644 --- a/src/rx/rx_kcommon.h +++ b/src/rx/rx_kcommon.h @@ -131,7 +131,7 @@ typedef unsigned short etap_event_t; #include "afs/longc_procs.h" #include "afs/afs_stats.h" #include "h/errno.h" -#if 0/*def KERNEL*/ +#ifdef KERNEL #include "afs/sysincludes.h" #include "afsincludes.h" #endif diff --git a/src/rx/rx_packet.c b/src/rx/rx_packet.c index fe58e656e..ed02b646e 100644 --- a/src/rx/rx_packet.c +++ b/src/rx/rx_packet.c @@ -25,6 +25,9 @@ RCSID("$Header$"); #include "rx/rx_queue.h" #include "rx/rx_packet.h" #else /* defined(UKERNEL) */ +#ifdef RX_KERNEL_TRACE +#include "../rx/rx_kcommon.h" +#endif #include "h/types.h" #ifndef AFS_LINUX20_ENV #include "h/systm.h" @@ -1417,13 +1420,31 @@ static void rxi_SendDebugPacket(struct rx_packet *apacket, osi_socket asocket, } AFS_RXGUNLOCK(); #ifdef KERNEL +#ifdef RX_KERNEL_TRACE + if (ICL_SETACTIVE(afs_iclSetp)) { + if (!waslocked) AFS_GLOCK(); + afs_Trace1(afs_iclSetp, CM_TRACE_TIMESTAMP, + ICL_TYPE_STRING, "before osi_NetSend()"); + AFS_GUNLOCK(); + } else +#else if (waslocked) AFS_GUNLOCK(); +#endif #endif /* debug packets are not reliably delivered, hence the cast below. */ (void) osi_NetSend(asocket, &taddr, apacket->wirevec, apacket->niovecs, apacket->length+RX_HEADER_SIZE, istack); #ifdef KERNEL +#ifdef RX_KERNEL_TRACE + if (ICL_SETACTIVE(afs_iclSetp)) { + AFS_GLOCK(); + afs_Trace1(afs_iclSetp, CM_TRACE_TIMESTAMP, + ICL_TYPE_STRING, "after osi_NetSend()"); + if (!waslocked) AFS_GUNLOCK(); + } else +#else if (waslocked) AFS_GLOCK(); +#endif #endif AFS_RXGLOCK(); if (saven) { /* means we truncated the packet above. */ @@ -1513,7 +1534,16 @@ void rxi_SendPacket(struct rx_call * call, struct rx_connection * conn, AFS_RXGUNLOCK(); #ifdef KERNEL waslocked = ISAFS_GLOCK(); +#ifdef RX_KERNEL_TRACE + if (ICL_SETACTIVE(afs_iclSetp)) { + if (!waslocked) AFS_GLOCK(); + afs_Trace1(afs_iclSetp, CM_TRACE_TIMESTAMP, + ICL_TYPE_STRING, "before osi_NetSend()"); + AFS_GUNLOCK(); + } else +#else if (waslocked) AFS_GUNLOCK(); +#endif #endif if ((code = osi_NetSend(socket, &addr, p->wirevec, p->niovecs, p->length+RX_HEADER_SIZE, istack)) != 0) { @@ -1535,7 +1565,16 @@ void rxi_SendPacket(struct rx_call * call, struct rx_connection * conn, #endif } #ifdef KERNEL +#ifdef RX_KERNEL_TRACE + if (ICL_SETACTIVE(afs_iclSetp)) { + AFS_GLOCK(); + afs_Trace1(afs_iclSetp, CM_TRACE_TIMESTAMP, + ICL_TYPE_STRING, "after osi_NetSend()"); + if (!waslocked) AFS_GUNLOCK(); + } else +#else if (waslocked) AFS_GLOCK(); +#endif #endif AFS_RXGLOCK(); #ifdef RXDEBUG diff --git a/src/rx/rx_rdwr.c b/src/rx/rx_rdwr.c index 7ee34e68e..e21583cbd 100644 --- a/src/rx/rx_rdwr.c +++ b/src/rx/rx_rdwr.c @@ -18,6 +18,9 @@ RCSID("$Header$"); #ifdef KERNEL #ifndef UKERNEL +#ifdef RX_KERNEL_TRACE +#include "rx_kcommon.h" +#endif #if defined(AFS_DARWIN_ENV) || defined(AFS_XBSD_ENV) #include "afs/sysincludes.h" #else @@ -1234,6 +1237,20 @@ void rxi_FlushWrite(register struct rx_call *call) call->mode = (call->conn->type == RX_CLIENT_CONNECTION ? RX_MODE_RECEIVING: RX_MODE_EOF); +#ifdef RX_KERNEL_TRACE + { + int glockOwner = ISAFS_GLOCK(); + if (!glockOwner) + AFS_GLOCK(); + afs_Trace3(afs_iclSetp, CM_TRACE_WASHERE, + ICL_TYPE_STRING, __FILE__, + ICL_TYPE_INT32, __LINE__, + ICL_TYPE_POINTER, call); + if (!glockOwner) + AFS_GUNLOCK(); + } +#endif + #ifdef AFS_GLOBAL_RXLOCK_KERNEL /* Wait until TQ_BUSY is reset before adding any * packets to the transmit queue diff --git a/src/rx/xdr_int64.c b/src/rx/xdr_int64.c index 2ccde65d2..43951b23e 100644 --- a/src/rx/xdr_int64.c +++ b/src/rx/xdr_int64.c @@ -36,8 +36,8 @@ bool_t xdr_int64(register XDR *xdrs, afs_int64 *ulp) bool_t xdr_afs_int64(register XDR *xdrs, afs_int64 *ulp) { - static afs_int32 high; - static afs_uint32 low; + afs_int32 high; + afs_uint32 low; if (xdrs->x_op == XDR_DECODE) { if (!XDR_GETINT32(xdrs, (afs_int32 *) &high)) return (FALSE); @@ -67,8 +67,8 @@ bool_t xdr_uint64(register XDR *xdrs, afs_uint64 *ulp) } bool_t xdr_afs_uint64(register XDR *xdrs, afs_uint64 *ulp) { - static afs_uint32 high; - static afs_uint32 low; + afs_uint32 high; + afs_uint32 low; if (xdrs->x_op == XDR_DECODE) { if (!XDR_GETINT32(xdrs, (afs_uint32 *) &high)) return (FALSE); diff --git a/src/sys/Makefile.in b/src/sys/Makefile.in index 7a33ed4df..9aa6f93fe 100644 --- a/src/sys/Makefile.in +++ b/src/sys/Makefile.in @@ -8,6 +8,7 @@ srcdir=@srcdir@ include @TOP_OBJDIR@/src/config/Makefile.config +CFLAGS=-I. -I${srcdir} ${DBUG} -I${TOP_OBJDIR}/src/config -I${TOP_INCDIR} ${XCFLAGS} SFLAGS=-P -I${TOP_INCDIR} LIBS=libsys.a ${TOP_LIBDIR}/librx.a libsys.a ${TOP_LIBDIR}/liblwp.a ${TOP_LIBDIR}/util.a ${XLIBS} @@ -22,9 +23,13 @@ all: \ ${TOP_INCDIR}/afs/afs.exp \ ${TOP_INCDIR}/afs/xfsattrs.h \ ${TOP_LIBDIR}/afs.exp \ - ${TOP_LIBDIR}/libsys.a + ${TOP_LIBDIR}/libsys.a \ + ${KERNELDIR}/afs \ + ${KERNELDIR}/afs/xfsattrs.h \ + ${UKERNELDIR}/afs \ + ${UKERNELDIR}/afs/afsl.exp -libsys.a: ${OBJECTS} ${RMTOBJS} AFS_component_version_number.o +libsys.a: ${OBJECTS} ${RMTOBJS} afsl.exp AFS_component_version_number.o -$(RM) -f $@ $(AR) crv $@ ${OBJECTS} ${RMTOBJS} \ AFS_component_version_number.o ${LIBSYS_AIX_EXP} @@ -122,6 +127,22 @@ xfsinode: xfsinode.c AFS_component_version_number.c $(CC) -o xfsinode ${CFLAGS} ${srcdir}/xfsinode.c ${LIBS} esac +afs.exp: afs4.exp afs5.exp + case ${SYS_NAME} in \ + rs_aix5* ) \ + cp -p afs5.exp afs.exp ;; \ + * ) \ + cp -p afs4.exp afs.exp ;; \ + esac + +afsl.exp: afsl4.exp afsl5.exp + case ${SYS_NAME} in \ + rs_aix5* ) \ + cp -p afsl5.exp afsl.exp ;; \ + * ) \ + cp -p afsl4.exp afsl.exp ;; \ + esac + # # Installation targets # @@ -141,6 +162,18 @@ ${TOP_INCDIR}/afs/xfsattrs.h: xfsattrs.h ${TOP_LIBDIR}/libsys.a: libsys.a ${INSTALL} $? $@ +${UKERNELDIR}/afs: + mkdir -p $@ + +${UKERNELDIR}/afs/afsl.exp: afsl.exp + ${INSTALL} $? $@ + +${KERNELDIR}/afs: + mkdir -p $@ + +${KERNELDIR}/afs/xfsattrs.h: xfsattrs.h + ${INSTALL} $? $@ + install: \ ${DESTDIR}${libdir}/afs/libsys.a \ ${DESTDIR}${sbindir}/rmtsysd \ @@ -209,4 +242,5 @@ include ../config/Makefile.version clean: $(RM) -f *.o libsys.a xfsinode iinc idec icreate iopen istat core \ rmtsysc rmtsyss *.o rmtsys.ss.c rmtsys.cs.c rmtsys.xdr.c rmtsys.h \ - rmtsysd AFS_component_version_number.c pagsh pagsh.krb + rmtsysd AFS_component_version_number.c pagsh pagsh.krb \ + afs.exp afsl.exp diff --git a/src/sys/afs.exp b/src/sys/afs4.exp similarity index 100% rename from src/sys/afs.exp rename to src/sys/afs4.exp diff --git a/src/sys/afs5.exp b/src/sys/afs5.exp new file mode 100644 index 000000000..0ebc341ca --- /dev/null +++ b/src/sys/afs5.exp @@ -0,0 +1,140 @@ +#!/unix +* +* $Locker$ +* +* +* Exports for the AFS kernel extension for AIX 3.1 +* +icreate syscall +syscall syscall +iopen syscall +iinc syscall +idec syscall +* iread syscall +* iwrite syscall +lsetpag syscall +lpioctl syscall + +* +* Exported variables (useful for debugging) +* +* afs_debug + +* +* We replace the following system calls +* +*setgroups syscall +kioctl32 syscall + +* +* +* +root_exported +afs_users +CellLRU +afs_servers +afs_volumes +afs_vhashT +afs_cmstats +afs_stats_cmperf +afs_xvcache +afs_xdcache +afs_xserver +afs_xvcb +afs_xbrs +afs_xcell +afs_xconn +afs_xuser +afs_xvolume +afs_setTimeHost +afs_volCounter +afs_cellindex +afs_sysname +afs_marinerHost +* afs_marinerPort +afs_mariner +cacheInfoModTime +freeVCList +afs_freeDCList +afs_freeDCCount +afs_freeDSList +cacheInode +volumeInode +cacheDiskType +afs_indexCounter +afs_cacheFiles +afs_cacheBlocks +afs_cacheStats +afs_blocksUsed +afs_fsfragsize +osi_flplock +rx_epoch +rx_stats +rx_extraQuota +rx_extraPackets +rx_stackSize +rx_connDeadTime +rx_idleConnectionTime +rx_idlePeerTime +rx_nPackets +rx_nFreePackets +rx_socket +rx_port +* rx_selectMask +* rx_maxSocketNumber +rx_packetQuota +rx_nextCid +rx_waitingForPackets +rxi_nCalls +rxi_dataQuota +rxi_availProcs +rxi_totalMin +rxi_minDeficit +rx_peerHashTable +rx_connHashTable +rx_services +afs_indexTable +afs_indexFlags +afs_indexTimes +rxi_Alloccnt +rxi_Allocsize +afs_dcentries +rxevent_nFree +rxevent_nPosted +afs_brsWaiters +afs_brsDaemons +afs_brs +afs_callo +VLRU +afs_DLRU +afs_xcbhash +rx_serverPool_lock +rx_incomingCallQueue +rx_freeCallQueue +rx_idleServerQueue +rx_freePktQ_lock +freeSQEList_lock +rx_freeCallQueue_lock +rx_waitingForPackets_cv +rx_peerHashTable_lock +rx_connHashTable_lock +rxevent_lock +* rxdb_idHash +* rxdb_lockList +afs_duplicate_nfs_fids +rx_tq_debug +afs_totalServers +afs_totalSrvAddrs +afs_srvAddrs +afs_global_lock +afs_indexUnique +afs_dvnextTbl +afs_dcnextTbl +afs_discardDCCount +afs_TruncateDaemonRunning +afs_CacheTooFull +afs_blocksDiscarded +afs_gcpags +afs_gcpags_procsize +afs_discardDCList +afs_WaitForCacheDrain diff --git a/src/sys/afsl.exp b/src/sys/afsl4.exp similarity index 100% rename from src/sys/afsl.exp rename to src/sys/afsl4.exp diff --git a/src/sys/afsl5.exp b/src/sys/afsl5.exp new file mode 100644 index 000000000..6a080887e --- /dev/null +++ b/src/sys/afsl5.exp @@ -0,0 +1,27 @@ +#!/unix +* +* $Locker$ +* +* +* Exports for the AFS kernel extension for AIX 3.1 +* +icreate syscall +syscall syscall +iopen syscall +iinc syscall +idec syscall +* iread syscall +* iwrite syscall +lsetpag syscall +lpioctl syscall + +* +* Exported variables (useful for debugging) +* +* afs_debug + +* +* We replace the following system calls +* +*setgroups syscall +kioctl32 syscall diff --git a/src/tsm41/aix41_auth.c b/src/tsm41/aix41_auth.c index 054aaed85..ee48bfd37 100644 --- a/src/tsm41/aix41_auth.c +++ b/src/tsm41/aix41_auth.c @@ -34,7 +34,7 @@ int afs_authenticate (char *userName, char *response, int *reenter, char **mess int code, unixauthneeded, password_expires = -1; *reenter = 0; - *message = NULL; + *message = (char *)0; if (response) { pword = response; } else { @@ -53,7 +53,7 @@ int afs_authenticate (char *userName, char *response, int *reenter, char **mess return AUTH_FAILURE; } if (code = ka_UserAuthenticateGeneral(KA_USERAUTH_VERSION + KA_USERAUTH_DOSETPAG, userName, - NULL, NULL, pword, 0, &password_expires, 0, &reason)) { + (char *)0, (char *)0, pword, 0, &password_expires, 0, &reason)) { if (code == KANOENT) return AUTH_NOTFOUND; *message = (char *)malloc(1024); @@ -83,6 +83,28 @@ int afs_getgrset (char *userName) { } struct group *afs_getgrgid (int id) { +#ifdef AFS_AIX51_ENV + static char name[64]; + static char passwd[64]; + static struct group grp; + struct group *g; + char *mem = NULL; + + while ((g = getgrent()) != NULL) { + if (g->gr_gid == id) { + strncpy(&name, g->gr_name, sizeof(name)); + strncpy(&passwd, g->gr_passwd, sizeof(passwd)); + grp.gr_name = &name; + grp.gr_passwd = &passwd; + grp.gr_gid = g->gr_gid; + grp.gr_mem = &mem; + break; + } + } + endgrent(); + if (g) + return &grp; +#endif return NULL; } @@ -91,33 +113,34 @@ struct group *afs_getgrnam (char *name) { } #ifdef AFS_AIX51_ENV -/* - * This is a nasty hack. It seems getpwnam calls this routine and is not - * happy with NULL as result. Trying to call here getpwnam in order to get - * a reasonable result kills the whole program. So I tried to return - * a dummy pwd and it seems to work! - */ struct passwd *afs_getpwnam (char *user) { - char name[64]; - char *passwd = "*"; - char *gecos = ""; - char *dir = "/"; - char *shell = "/bin/sh"; - char *nobody = "nobody"; - struct passwd p; - - strncpy((char *)&name, user, sizeof(name)); - name[63] = 0; - p.pw_name = &name; - p.pw_name = nobody; - p.pw_passwd = passwd; - p.pw_uid = 4294967294; - p.pw_gid = 4294967294; - p.pw_gecos = gecos; - p.pw_dir = dir; - p.pw_shell = shell; - - return &p; + static char name[64]; + static char passwd[64]; + static char gecos[256]; + static char dir[256]; + static char shell[256]; + static struct passwd pwd; + struct passwd *p; + + while ((p = getpwent()) != NULL) { + if (!strcmp(p->pw_name, user)) { + strncpy(&name, p->pw_name, sizeof(name)); + strncpy(&passwd, p->pw_passwd, sizeof(passwd)); + strncpy(&gecos, p->pw_gecos, sizeof(gecos)); + strncpy(&dir, p->pw_dir, sizeof(dir)); + strncpy(&shell, p->pw_shell, sizeof(shell)); + pwd.pw_name = &name; + pwd.pw_passwd = &passwd; + pwd.pw_uid = p->pw_uid; + pwd.pw_gid = p->pw_gid; + pwd.pw_gecos = &gecos; + pwd.pw_dir = &dir; + pwd.pw_shell = &shell; + break; + } + } + endpwent(); + return &pwd; } #else int afs_getpwnam(int id) diff --git a/src/venus/fstrace.c b/src/venus/fstrace.c index bd3185cfe..852a5aad7 100644 --- a/src/venus/fstrace.c +++ b/src/venus/fstrace.c @@ -40,14 +40,14 @@ RCSID("$Header$"); #include #include -#if defined(AFS_ALPHA_ENV) || defined(AFS_SGI61_ENV) +#if defined(AFS_ALPHA_ENV) || defined(AFS_SGI61_ENV) || (defined(AFS_AIX51_ENV) && defined(AFS_64BIT_KERNEL)) /* For SGI 6.2, this is changed to 1 if it's a 32 bit kernel. */ int afs_icl_sizeofLong = 2; #else int afs_icl_sizeofLong = 1; #endif -#ifdef AFS_SGI61_ENV +#if defined(AFS_SGI61_ENV) || (defined(AFS_AIX51_ENV) && defined(AFS_64BIT_KERNEL)) int afs_64bit_kernel = 1; /* Default for 6.2+, and always for 6.1 */ extern int afs_icl_sizeofLong; /* Used in ICL_SIZEHACK() */ #ifdef AFS_SGI62_ENV @@ -120,7 +120,7 @@ static icl_GetSize(type, addr) * by typesp. Also watch for prematurely running out of parameters * before the string is gone. */ -#ifdef AFS_SGI61_ENV +#if defined(AFS_SGI61_ENV) || (defined(AFS_AIX51_ENV) && defined(AFS_64BIT_KERNEL)) static int CheckTypes(bufferp, typesp, typeCount, outMsgBuffer) char *bufferp; int *typesp; @@ -257,7 +257,7 @@ static DisplayRecord(outFilep, alp, rsize) afs_int32 rsize; { char msgBuffer[1024]; -#ifdef AFS_SGI61_ENV +#if defined(AFS_SGI61_ENV) || (defined(AFS_AIX51_ENV) && defined(AFS_64BIT_KERNEL)) char outMsgBuffer[1024]; uint64_t tempParam; uint64_t printfParms[ICL_MAXEXPANSION * /* max parms */ 4]; @@ -297,7 +297,7 @@ static DisplayRecord(outFilep, alp, rsize) case ICL_TYPE_LONG: case ICL_TYPE_POINTER: printfTypes[pftix++] = 0; -#ifdef AFS_SGI61_ENV +#if defined(AFS_SGI61_ENV) || (defined(AFS_AIX51_ENV) && defined(AFS_64BIT_KERNEL)) printfParms[pfpix] = alp[pix]; printfParms[pfpix] &= 0xffffffff; if (afs_64bit_kernel) { @@ -340,7 +340,7 @@ static DisplayRecord(outFilep, alp, rsize) #ifdef AFS_SGI64_ENV printfStrings[pfpix++] = (char*) &alp[pix]; #else /* AFS_SGI64_ENV */ -#ifdef AFS_SGI61_ENV +#if defined(AFS_SGI61_ENV) || (defined(AFS_AIX51_ENV) && defined(AFS_64BIT_KERNEL)) printfStrings[pfpix++] = (char *) &alp[pix]; #else /* AFS_SGI61_ENV */ printfParms[pfpix++] = (long) &alp[pix]; @@ -369,7 +369,7 @@ static DisplayRecord(outFilep, alp, rsize) */ printed = 0; if (status == 0) { -#ifdef AFS_SGI61_ENV +#if defined(AFS_SGI61_ENV) || (defined(AFS_AIX51_ENV) && defined(AFS_64BIT_KERNEL)) if (CheckTypes(msgBuffer, printfTypes, pftix, outMsgBuffer)) { /* we have a string to use, but it ends "(dfs / zcm)", * so we remove the extra gunk. @@ -2592,7 +2592,8 @@ int icl_ZeroLog(register struct afs_icl_log *logp) } /* free a log entry, and drop its reference count */ -int icl_LogFree(register struct afs_icl_log *logp) +icl_LogFree(logp) + register struct afs_icl_log *logp; { logp->states |= ICL_LOGF_DELETED; icl_LogRele(logp); diff --git a/src/vol/vnode.h b/src/vol/vnode.h index 1a262431c..ebed6f84f 100644 --- a/src/vol/vnode.h +++ b/src/vol/vnode.h @@ -205,8 +205,8 @@ extern VInitVnodes(); extern VInitVnodes_r(); extern Vnode *VGetVnode(); extern Vnode *VGetVnode_r(); -extern VputVnode(); -extern VputVnode_r(); +extern void VPutVnode(); +extern void VPutVnode_r(); extern VVnodeWriteToRead(); extern VVnodeWriteToRead_r(); extern Vnode *VAllocVnode(); diff --git a/src/volser/dumpstuff.c b/src/volser/dumpstuff.c index cca133581..f5f1c218f 100644 --- a/src/volser/dumpstuff.c +++ b/src/volser/dumpstuff.c @@ -1250,7 +1250,7 @@ int SizeDumpVolume(register struct rx_call *call, register Volume *vp, afs_int32 struct iod iod; int code = 0; register struct iod *iodp = (struct iod *)0; -// iod_Init(iodp, call); +/* iod_Init(iodp, call); */ if (!code) code = SizeDumpDumpHeader(iodp, vp, fromtime, v_size); if (!code) code = SizeDumpPartial(iodp, vp, fromtime, dumpAllDirs, v_size); @@ -1265,9 +1265,9 @@ static int SizeDumpDumpHeader(register struct iod *iodp, register Volume *vp, af int code = 0; int UseLatestReadOnlyClone = 1; afs_int32 dumpTimes[2]; -// iodp->device = vp->device; -// iodp->parentId = V_parentId(vp); -// iodp->dumpPartition = vp->partition; +/* iodp->device = vp->device; */ +/* iodp->parentId = V_parentId(vp); */ +/* iodp->dumpPartition = vp->partition; */ v_size->dump_size = 0; /* initialize the size */ /* if (!code) code = DumpDouble(iodp, D_DUMPHEADER, DUMPBEGINMAGIC, DUMPVERSION); */ -- 2.39.5