From: Jim Rees Date: Tue, 12 Nov 2002 23:57:37 +0000 (+0000) Subject: openbsd-20021112 X-Git-Tag: openafs-devel-1_3_50~510 X-Git-Url: https://git.michaelhowe.org/gitweb/?a=commitdiff_plain;h=822d725f808d26b177464ef09de7d076e5c7fa36;p=packages%2Fo%2Fopenafs.git openbsd-20021112 Remove size test in afs_buffer.c:DRead(). Cleanups and prototypes. OpenBSD client works now, at least readonly. --- diff --git a/src/afs/OBSD/osi_file.c b/src/afs/OBSD/osi_file.c index 58ba584b4..9e2ce2cff 100644 --- a/src/afs/OBSD/osi_file.c +++ b/src/afs/OBSD/osi_file.c @@ -116,8 +116,10 @@ int osi_UFSTruncate(struct osi_file *afile, afs_int32 asize) void osi_DisableAtimes(struct vnode *avp) { +#if 0 struct inode *ip = VTOI(avp); ip->i_flag &= ~IACC; +#endif } @@ -133,24 +135,24 @@ int afs_osi_Read(struct osi_file *afile, int offset, void *aptr, afs_int32 asize * If the osi_file passed in is NULL, panic only if AFS is not shutting * down. No point in crashing when we are already shutting down */ - if ( !afile ) { - if ( !afs_shuttingdown ) + if (!afile) { + if (!afs_shuttingdown) osi_Panic("osi_Read called with null param"); else return EIO; } - if (offset != -1) afile->offset = offset; + if (offset != -1) + afile->offset = offset; AFS_GUNLOCK(); - code = gop_rdwr(UIO_READ, afile->vnode, (caddr_t) aptr, asize, afile->offset, - AFS_UIOSYS, IO_UNIT, &afs_osi_cred, &resid); + code = vn_rdwr(UIO_READ, afile->vnode, aptr, asize, afile->offset, + AFS_UIOSYS, IO_UNIT, &afs_osi_cred, &resid, curproc); AFS_GLOCK(); if (code == 0) { code = asize - resid; afile->offset += code; osi_DisableAtimes(afile->vnode); - } - else { + } else { afs_Trace2(afs_iclSetp, CM_TRACE_READFAILED, ICL_TYPE_INT32, resid, ICL_TYPE_INT32, code); code = -1; @@ -172,8 +174,8 @@ int afs_osi_Write(struct osi_file *afile, afs_int32 offset, void *aptr, afs_int3 AFS_GUNLOCK(); VOP_LOCK(afile->vnode, LK_EXCLUSIVE | LK_RETRY, curproc); - code = gop_rdwr(UIO_WRITE, afile->vnode, (caddr_t) aptr, asize, afile->offset, - AFS_UIOSYS, IO_UNIT, &afs_osi_cred, &resid); + code = vn_rdwr(UIO_WRITE, afile->vnode, (caddr_t) aptr, asize, afile->offset, + AFS_UIOSYS, IO_UNIT, &afs_osi_cred, &resid, curproc); VOP_UNLOCK(afile->vnode, 0, curproc); AFS_GLOCK(); diff --git a/src/afs/OBSD/osi_machdep.h b/src/afs/OBSD/osi_machdep.h index c3181f6cd..9d48b5f85 100644 --- a/src/afs/OBSD/osi_machdep.h +++ b/src/afs/OBSD/osi_machdep.h @@ -47,9 +47,6 @@ extern struct timeval time; #define osi_vnhold(avc, r) afs_vget(AFSTOV(avc), 0) -#define gop_rdwr(rw,gp,base,len,offset,segflg,unit,cred,aresid) \ - vn_rdwr((rw),(gp),(base),(len),(offset),(segflg),(unit),(cred),(aresid), curproc) - #define afs_suser() afs_osi_suser(osi_curcred()) extern int (**afs_vnodeop_p)(); diff --git a/src/afs/OBSD/osi_sleep.c b/src/afs/OBSD/osi_sleep.c index 4a796d480..c41144348 100644 --- a/src/afs/OBSD/osi_sleep.c +++ b/src/afs/OBSD/osi_sleep.c @@ -1,3 +1,37 @@ +/* + * $Id$ + */ + +/* +copyright 2002 +the regents of the university of michigan +all rights reserved + +permission is granted to use, copy, create derivative works +and redistribute this software and such derivative works +for any purpose, so long as the name of the university of +michigan is not used in any advertising or publicity +pertaining to the use or distribution of this software +without specific, written prior authorization. if the +above copyright notice or any other identification of the +university of michigan is included in any copy of any +portion of this software, then the disclaimer below must +also be included. + +this software is provided as is, without representation +from the university of michigan as to its fitness for any +purpose, and without warranty by the university of +michigan of any kind, either express or implied, including +without limitation the implied warranties of +merchantability and fitness for a particular purpose. the +regents of the university of michigan shall not be liable +for any damages, including special, indirect, incidental, or +consequential damages, with respect to any claim arising +out of or in connection with the use of the software, even +if it has been or is hereafter advised of the possibility of +such damages. +*/ + /* * Copyright 2000, International Business Machines Corporation and others. * All Rights Reserved. @@ -7,7 +41,6 @@ * directory or online at http://www.openafs.org/dl/license10.html */ - #include #include "afs/param.h" diff --git a/src/afs/OBSD/osi_vfsops.c b/src/afs/OBSD/osi_vfsops.c index c16c0c56b..f94e7a2e3 100644 --- a/src/afs/OBSD/osi_vfsops.c +++ b/src/afs/OBSD/osi_vfsops.c @@ -1,3 +1,41 @@ +/* + * OpenBSD specific assistance routines & VFS ops + * Original NetBSD version for Transarc afs by John Kohl + * OpenBSD version by Jim Rees + * + * $Id$ + */ + +/* +copyright 2002 +the regents of the university of michigan +all rights reserved + +permission is granted to use, copy, create derivative works +and redistribute this software and such derivative works +for any purpose, so long as the name of the university of +michigan is not used in any advertising or publicity +pertaining to the use or distribution of this software +without specific, written prior authorization. if the +above copyright notice or any other identification of the +university of michigan is included in any copy of any +portion of this software, then the disclaimer below must +also be included. + +this software is provided as is, without representation +from the university of michigan as to its fitness for any +purpose, and without warranty by the university of +michigan of any kind, either express or implied, including +without limitation the implied warranties of +merchantability and fitness for a particular purpose. the +regents of the university of michigan shall not be liable +for any damages, including special, indirect, incidental, or +consequential damages, with respect to any claim arising +out of or in connection with the use of the software, even +if it has been or is hereafter advised of the possibility of +such damages. +*/ + /* Copyright 1995 Massachusetts Institute of Technology. All Rights Reserved. @@ -14,14 +52,6 @@ ANY WARRANTY OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE OR NONINFRINGEMENT. */ -/* - * OpenBSD specific assistance routines & VFS ops - * Original NetBSD version for Transarc afs by John Kohl - * OpenBSD version by Jim Rees - * - * $Id$ - */ - /* * Some code cribbed from ffs_vfsops and other NetBSD sources, which * are marked: @@ -334,13 +364,13 @@ afs_root(struct mount *mp, !(code = afs_CheckInit())) { tvp = afs_GetVCache(&afs_rootFid, &treq, NULL, NULL); if (tvp) { -printf("tvp %x %d\n", tvp, AFSTOV(tvp)->v_usecount); /* There is really no reason to over-hold this bugger--it's held by the root filesystem reference. */ if (afs_globalVp != tvp) { +#ifdef AFS_DONT_OVERHOLD_GLOBALVP if (afs_globalVp) -printf("afs_globalVp %x %d\n", afs_globalVp, AFSTOV(afs_globalVp)->v_usecount); -/* AFS_RELE(AFSTOV(afs_globalVp));*/ + AFS_RELE(AFSTOV(afs_globalVp)); +#endif afs_globalVp = tvp; AFS_HOLD(AFSTOV(afs_globalVp)); } diff --git a/src/afs/OBSD/osi_vnodeops.c b/src/afs/OBSD/osi_vnodeops.c index 57d88ae8d..077585535 100644 --- a/src/afs/OBSD/osi_vnodeops.c +++ b/src/afs/OBSD/osi_vnodeops.c @@ -1,3 +1,41 @@ +/* + * OpenBSD specific vnodeops + other misc interface glue + * Original NetBSD version for Transarc afs by John Kohl + * OpenBSD version by Jim Rees + * + * $Id$ + */ + +/* +copyright 2002 +the regents of the university of michigan +all rights reserved + +permission is granted to use, copy, create derivative works +and redistribute this software and such derivative works +for any purpose, so long as the name of the university of +michigan is not used in any advertising or publicity +pertaining to the use or distribution of this software +without specific, written prior authorization. if the +above copyright notice or any other identification of the +university of michigan is included in any copy of any +portion of this software, then the disclaimer below must +also be included. + +this software is provided as is, without representation +from the university of michigan as to its fitness for any +purpose, and without warranty by the university of +michigan of any kind, either express or implied, including +without limitation the implied warranties of +merchantability and fitness for a particular purpose. the +regents of the university of michigan shall not be liable +for any damages, including special, indirect, incidental, or +consequential damages, with respect to any claim arising +out of or in connection with the use of the software, even +if it has been or is hereafter advised of the possibility of +such damages. +*/ + /* Copyright 1995 Massachusetts Institute of Technology. All Rights Reserved. @@ -14,14 +52,6 @@ ANY WARRANTY OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE OR NONINFRINGEMENT. */ -/* - * OpenBSD specific vnodeops + other misc interface glue - * Original NetBSD version for Transarc afs by John Kohl - * OpenBSD version by Jim Rees - * - * $Id$ - */ - /* * A bunch of code cribbed from NetBSD ufs_vnops.c, ffs_vnops.c, and * nfs_vnops.c which carry this copyright: @@ -178,16 +208,25 @@ struct vnodeopv_desc afs_vnodeop_opv_desc = int afs_debug; -#define NBSD_WRITES_ALLOWED -#ifndef NBSD_WRITES_ALLOWED -int nbsd_writes_allowed = 0; -#endif - #undef vrele #define vrele afs_nbsd_rele #undef VREF #define VREF afs_nbsd_ref +extern int afs_lookup(); +extern int afs_open(); +extern int afs_close(); +extern int HandleIoctl(struct vcache *avc, afs_int32 acom, struct afs_ioctl *adata); +extern int afs_fsync(); +extern int afs_remove(); +extern int afs_link(); +extern int afs_rename(); +extern int afs_mkdir(); +extern int afs_rmdir(); +extern int afs_symlink(); +extern int afs_readdir(); +extern int afs_readlink(); + int afs_nbsd_lookup(ap) struct vop_lookup_args /* { @@ -276,11 +315,6 @@ afs_nbsd_create(ap) /* vnode layer handles excl/nonexcl */ -#ifndef NBSD_WRITES_ALLOWED - if (!nbsd_writes_allowed) - error = EROFS; - if (!error) -#endif error = afs_create(VTOAFS(dvp), name, ap->a_vap, NONEXCL, ap->a_vap->va_mode, &vcp, cnp->cn_cred); @@ -331,6 +365,7 @@ afs_nbsd_open(ap) { int error; struct vcache *vc = VTOAFS(ap->a_vp); + error = afs_open(&vc, ap->a_mode, ap->a_cred); #ifdef DIAGNOSTIC if (AFSTOV(vc) != ap->a_vp) @@ -348,7 +383,7 @@ afs_nbsd_close(ap) struct proc *a_p; } */ *ap; { - return afs_close(VTOAFS(ap->a_vp), ap->a_fflag, ap->a_cred, ap->a_p); + return afs_close(VTOAFS(ap->a_vp), ap->a_fflag, ap->a_cred); } int @@ -422,21 +457,15 @@ afs_nbsd_ioctl(ap) struct proc *a_p; } */ *ap; { - struct vcache *tvc = VTOAFS(ap->a_vp); - int error = 0; - /* in case we ever get in here... */ AFS_STATCNT(afs_ioctl); - if (((ap->a_command >> 8) & 0xff) == 'V') { + if (((ap->a_command >> 8) & 0xff) == 'V') /* This is a VICEIOCTL call */ - error = HandleIoctl(tvc, (struct file *)0/*Not used*/, - ap->a_command, ap->a_data); - return(error); - } else { + return HandleIoctl(VTOAFS(ap->a_vp), ap->a_command, (struct afs_ioctl *) ap->a_data); + else /* No-op call; just return. */ - return(ENOTTY); - } + return ENOTTY; } /* ARGSUSED */ @@ -467,6 +496,7 @@ afs_nbsd_fsync(ap) { int wait = ap->a_waitfor == MNT_WAIT; struct vnode *vp = ap->a_vp; + vflushbuf(vp, wait); return afs_fsync(VTOAFS(vp), ap->a_cred); } @@ -484,11 +514,6 @@ afs_nbsd_remove(ap) struct vnode *dvp = ap->a_dvp; GETNAME(); -#ifndef NBSD_WRITES_ALLOWED - if (!nbsd_writes_allowed) - error = EROFS; - if (!error) -#endif error = afs_remove(VTOAFS(dvp), name, cnp->cn_cred); if (dvp == vp) vrele(vp); @@ -527,15 +552,12 @@ afs_nbsd_link(ap) VOP_ABORTOP(dvp, cnp); goto out; } -#ifndef NBSD_WRITES_ALLOWED - if (!nbsd_writes_allowed) - error = EROFS; - if (!error) -#endif + error = afs_link(VTOAFS(vp), VTOAFS(dvp), name, cnp->cn_cred); FREE(cnp->cn_pnbuf, M_NAMEI); if (dvp != vp) VOP_UNLOCK(vp, 0, curproc); + out: vput(dvp); DROPNAME(); @@ -621,11 +643,6 @@ abortit: tname[tcnp->cn_namelen] = '\0'; -#ifndef NBSD_WRITES_ALLOWED - if (!nbsd_writes_allowed) - error = EROFS; - if (!error) -#endif /* XXX use "from" or "to" creds? NFS uses "to" creds */ error = afs_rename(VTOAFS(fdvp), fname, VTOAFS(tdvp), tname, tcnp->cn_cred); @@ -663,11 +680,6 @@ afs_nbsd_mkdir(ap) #ifdef DIAGNOSTIC if ((cnp->cn_flags & HASBUF) == 0) panic("afs_nbsd_mkdir: no name"); -#endif -#ifndef NBSD_WRITES_ALLOWED - if (!nbsd_writes_allowed) - error = EROFS; - if (!error) #endif error = afs_mkdir(VTOAFS(dvp), name, vap, &vcp, cnp->cn_cred); if (error) { @@ -708,11 +720,6 @@ afs_nbsd_rmdir(ap) return (EINVAL); } -#ifndef NBSD_WRITES_ALLOWED - if (!nbsd_writes_allowed) - error = EROFS; - if (!error) -#endif error = afs_rmdir(VTOAFS(dvp), name, cnp->cn_cred); DROPNAME(); vput(dvp); @@ -735,11 +742,6 @@ afs_nbsd_symlink(ap) /* NFS ignores a_vpp; so do we. */ GETNAME(); -#ifndef NBSD_WRITES_ALLOWED - if (!nbsd_writes_allowed) - error = EROFS; - if (!error) -#endif error = afs_symlink(VTOAFS(dvp), name, ap->a_vap, ap->a_target, cnp->cn_cred); DROPNAME(); @@ -759,10 +761,14 @@ afs_nbsd_readdir(ap) u_long **a_cookies; } */ *ap; { -/* printf("readdir %p cookies %p ncookies %d\n", ap->a_vp, ap->a_cookies, - ap->a_ncookies); */ +#ifdef AFS_HAVE_COOKIES + printf("readdir %p cookies %p ncookies %d\n", ap->a_vp, ap->a_cookies, + ap->a_ncookies); return afs_readdir(VTOAFS(ap->a_vp), ap->a_uio, ap->a_cred, ap->a_eofflag, ap->a_ncookies, ap->a_cookies); +#else + return afs_readdir(VTOAFS(ap->a_vp), ap->a_uio, ap->a_cred, ap->a_eofflag); +#endif } int diff --git a/src/afs/VNOPS/afs_vnop_attrs.c b/src/afs/VNOPS/afs_vnop_attrs.c index c78dbd8c0..de017db9b 100644 --- a/src/afs/VNOPS/afs_vnop_attrs.c +++ b/src/afs/VNOPS/afs_vnop_attrs.c @@ -39,7 +39,6 @@ int afs_CopyOutAttrs(register struct vcache *avc, register struct vattr *attrs) { register struct volume *tvp; register struct cell *tcell; - register afs_int32 i; int fakedir = 0; AFS_STATCNT(afs_CopyOutAttrs); diff --git a/src/afs/VNOPS/afs_vnop_lookup.c b/src/afs/VNOPS/afs_vnop_lookup.c index defe6a866..df25bee19 100644 --- a/src/afs/VNOPS/afs_vnop_lookup.c +++ b/src/afs/VNOPS/afs_vnop_lookup.c @@ -1124,12 +1124,12 @@ afs_lookup(adp, aname, avcp, acred) /* now check the access */ if (treq.uid != adp->last_looker) { - if (!afs_AccessOK(adp, PRSFS_LOOKUP, &treq, CHECK_MODE_BITS)) { - *avcp = NULL; - code = EACCES; - goto done; - } - else adp->last_looker = treq.uid; + if (!afs_AccessOK(adp, PRSFS_LOOKUP, &treq, CHECK_MODE_BITS)) { + *avcp = NULL; + code = EACCES; + goto done; + } + else adp->last_looker = treq.uid; } /* Check for read access as well. We need read access in order to @@ -1192,7 +1192,7 @@ afs_lookup(adp, aname, avcp, acred) #endif /* linux22 */ } - { + { /* sub-block just to reduce stack usage */ register struct dcache *tdc; afs_size_t dirOffset, dirLen; ino_t theDir; @@ -1201,9 +1201,9 @@ afs_lookup(adp, aname, avcp, acred) /* now we have to lookup the next fid */ tdc = afs_GetDCache(adp, (afs_size_t) 0, &treq, &dirOffset, &dirLen, 1); if (!tdc) { - *avcp = NULL; /* redundant, but harmless */ - code = EIO; - goto done; + *avcp = NULL; /* redundant, but harmless */ + code = EIO; + goto done; } /* now we will just call dir package with appropriate inode. @@ -1254,9 +1254,8 @@ afs_lookup(adp, aname, avcp, acred) code = afs_dir_LookupOffset(&theDir, sysState.name, &tfid.Fid, &dirCookie); /* If the first lookup doesn't succeed, maybe it's got @sys in the name */ - while (code == ENOENT && Next_AtSys(adp, &treq, &sysState)) { - code = afs_dir_LookupOffset(&theDir, sysState.name, &tfid.Fid, &dirCookie); - } + while (code == ENOENT && Next_AtSys(adp, &treq, &sysState)) + code = afs_dir_LookupOffset(&theDir, sysState.name, &tfid.Fid, &dirCookie); tname = sysState.name; ReleaseReadLock(&tdc->lock); @@ -1298,10 +1297,10 @@ afs_lookup(adp, aname, avcp, acred) * but hasn't been statd, then do a bulk stat operation. */ do { - retry = 0; - ObtainReadLock(&afs_xvcache); - tvc = afs_FindVCache(&tfid, &retry, 0/* !stats,!lru */); - ReleaseReadLock(&afs_xvcache); + retry = 0; + ObtainReadLock(&afs_xvcache); + tvc = afs_FindVCache(&tfid, &retry, 0 /* !stats,!lru */); + ReleaseReadLock(&afs_xvcache); } while (tvc && retry); if (!tvc || !(tvc->states & CStatd)) @@ -1327,13 +1326,13 @@ afs_lookup(adp, aname, avcp, acred) * the file has not yet been looked up. */ if (!tvc) { - afs_int32 cached = 0; - if (!tfid.Fid.Unique && (adp->states & CForeign)) { + afs_int32 cached = 0; + if (!tfid.Fid.Unique && (adp->states & CForeign)) { tvc = afs_LookupVCache(&tfid, &treq, &cached, adp, tname); - } - if (!tvc && !bulkcode) { /* lookup failed or wasn't called */ - tvc = afs_GetVCache(&tfid, &treq, &cached, NULL); - } + } + if (!tvc && !bulkcode) { /* lookup failed or wasn't called */ + tvc = afs_GetVCache(&tfid, &treq, &cached, NULL); + } } /* if !tvc */ } /* sub-block just to reduce stack usage */ @@ -1363,7 +1362,7 @@ afs_lookup(adp, aname, avcp, acred) #if defined(UKERNEL) && defined(AFS_WEB_ENHANCEMENTS) if (!(flags & AFS_LOOKUP_NOEVAL)) - /* don't eval mount points */ + /* don't eval mount points */ #endif /* UKERNEL && AFS_WEB_ENHANCEMENTS */ if (tvc->mvstat == 1 && force_eval) { /* a mt point, possibly unevaluated */ @@ -1381,7 +1380,7 @@ afs_lookup(adp, aname, avcp, acred) /* next, we want to continue using the target of the mt point */ if (tvc->mvid && (tvc->states & CMValid)) { - struct vcache *uvc; + struct vcache *uvc; /* now lookup target, to set .. pointer */ afs_Trace2(afs_iclSetp, CM_TRACE_LOOKUP1, ICL_TYPE_POINTER, tvc, ICL_TYPE_FID, &tvc->fid); @@ -1473,7 +1472,7 @@ done: #endif /* AFS_OSF_ENV */ if (afs_mariner) - afs_AddMarinerName(aname, tvc); + afs_AddMarinerName(aname, tvc); #if defined(UKERNEL) && defined(AFS_WEB_ENHANCEMENTS) if (!(flags & AFS_LOOKUP_NOEVAL)) @@ -1483,7 +1482,7 @@ done: mount point's vc in the vcache by its fid. */ #endif /* UKERNEL && AFS_WEB_ENHANCEMENTS */ if (!hit) { - osi_dnlc_enter (adp, aname, tvc, &versionNo); + osi_dnlc_enter (adp, aname, tvc, &versionNo); } else { #ifdef AFS_LINUX20_ENV @@ -1498,10 +1497,10 @@ done: if (bulkcode) code = bulkcode; else code = afs_CheckCode(code, &treq, 19); if (code) { - /* If there is an error, make sure *avcp is null. - * Alphas panic otherwise - defect 10719. - */ - *avcp = NULL; + /* If there is an error, make sure *avcp is null. + * Alphas panic otherwise - defect 10719. + */ + *avcp = NULL; } afs_PutFakeStat(&fakestate); diff --git a/src/afs/afs_buffer.c b/src/afs/afs_buffer.c index 7dbb4751f..257984c30 100644 --- a/src/afs/afs_buffer.c +++ b/src/afs/afs_buffer.c @@ -147,13 +147,12 @@ char *DRead(register afs_inode_t *fid, register int page) { /* Read a page from the disk. */ register struct buffer *tb, *tb2; - void *tfile; - register afs_int32 code, *sizep; + struct osi_file *tfile; + int code; AFS_STATCNT(DRead); MObtainWriteLock(&afs_bufferLock,256); -/* some new code added 1/1/92 */ #define bufmatch(tb) (tb->page == page && dirp_Eq(tb->fid, fid)) #define buf_Front(head,parent,p) {(parent)->hashNext = (p)->hashNext; (p)->hashNext= *(head);*(head)=(p);} @@ -213,21 +212,13 @@ char *DRead(register afs_inode_t *fid, register int page) */ tb = afs_newslot(fid, page, (tb ? tb : tb2)); if (!tb) { - MReleaseWriteLock(&afs_bufferLock); - return 0; + MReleaseWriteLock(&afs_bufferLock); + return 0; } MObtainWriteLock(&tb->lock,260); MReleaseWriteLock(&afs_bufferLock); tb->lockers++; tfile = afs_CFileOpen(fid[0]); - sizep = (afs_int32 *)tfile; - if (page * AFS_BUFFER_PAGESIZE >= *sizep) { - dirp_Zap(tb->fid); - tb->lockers--; - MReleaseWriteLock(&tb->lock); - afs_CFileClose(tfile); - return 0; - } code = afs_CFileRead(tfile, tb->page * AFS_BUFFER_PAGESIZE, tb->data, AFS_BUFFER_PAGESIZE); afs_CFileClose(tfile); @@ -273,7 +264,7 @@ static struct buffer *afs_newslot (afs_inode_t *afid, afs_int32 apage,register s register afs_int32 i; afs_int32 lt; register struct buffer *tp; - void *tfile; + struct osi_file *tfile; AFS_STATCNT(afs_newslot); /* we take a pointer here to a buffer which was at the end of an @@ -444,7 +435,7 @@ void DFlush (void) /* Flush all the modified buffers. */ register int i; register struct buffer *tb; - void *tfile; + struct osi_file *tfile; AFS_STATCNT(DFlush); tb = Buffers; diff --git a/src/afs/afs_dcache.c b/src/afs/afs_dcache.c index c93059391..ed9b20a99 100644 --- a/src/afs/afs_dcache.c +++ b/src/afs/afs_dcache.c @@ -377,7 +377,7 @@ static void afs_GetDownD(int anumber, int *aneedSpace) struct dcache *tdc; struct VenusFid *afid; - afs_int32 i, j, k; + afs_int32 i, j; afs_hyper_t vtime; int skip, phase; register struct vcache *tvc; @@ -1185,15 +1185,15 @@ struct dcache *afs_FindDCache(register struct vcache *avc, afs_size_t abyte) i = DCHash(&avc->fid, chunk); MObtainWriteLock(&afs_xdcache,278); for(index = afs_dchashTbl[i]; index != NULLIDX;) { - if (afs_indexUnique[index] == avc->fid.Fid.Unique) { - tdc = afs_GetDSlot(index, NULL); - ReleaseReadLock(&tdc->tlock); - if (!FidCmp(&tdc->f.fid, &avc->fid) && chunk == tdc->f.chunk) { - break; /* leaving refCount high for caller */ + if (afs_indexUnique[index] == avc->fid.Fid.Unique) { + tdc = afs_GetDSlot(index, NULL); + ReleaseReadLock(&tdc->tlock); + if (!FidCmp(&tdc->f.fid, &avc->fid) && chunk == tdc->f.chunk) { + break; /* leaving refCount high for caller */ + } + afs_PutDCache(tdc); } - afs_PutDCache(tdc); - } - index = afs_dcnextTbl[index]; + index = afs_dcnextTbl[index]; } MReleaseWriteLock(&afs_xdcache); if (index != NULLIDX) { diff --git a/src/afs/afs_osi_pag.c b/src/afs/afs_osi_pag.c index 736c77722..fa4a4bd03 100644 --- a/src/afs/afs_osi_pag.c +++ b/src/afs/afs_osi_pag.c @@ -361,8 +361,10 @@ int afs_InitReq(register struct vrequest *av, struct AFS_UCRED *acred) * programs (without setpag) to work properly. */ #if defined(AFS_DARWIN_ENV) || defined(AFS_XBSD_ENV) - av->uid = acred->cr_uid; /* default when no pag is set */ - /* bsd creds don't have ruid */ + if (acred == NOCRED) + av->uid = -2; /* XXX nobody... ?*/ + else + av->uid = acred->cr_uid; /* bsd creds don't have ruid */ #else av->uid = acred->cr_ruid; /* default when no pag is set */ #endif diff --git a/src/afs/afs_pioctl.c b/src/afs/afs_pioctl.c index 5710722f4..492bb0546 100644 --- a/src/afs/afs_pioctl.c +++ b/src/afs/afs_pioctl.c @@ -913,36 +913,36 @@ afs_syscall_pioctl(path, com, cmarg, follow) code = afs_HandlePioctl(vp, com, &data, follow, &credp); #else #ifdef AFS_AIX41_ENV - { - struct ucred *cred1, *cred2; + { + struct ucred *cred1, *cred2; - if (foreigncreds) { - cred1 = cred2 = foreigncreds; - } else { - cred1 = cred2 = credp; - } - code = afs_HandlePioctl(vp, com, &data, follow, &cred1); - if (cred1 != cred2) { - /* something changed the creds */ - crset(cred1); + if (foreigncreds) { + cred1 = cred2 = foreigncreds; + } else { + cred1 = cred2 = credp; + } + code = afs_HandlePioctl(vp, com, &data, follow, &cred1); + if (cred1 != cred2) { + /* something changed the creds */ + crset(cred1); + } } - } #else #if defined(AFS_HPUX101_ENV) - { - struct ucred *cred = p_cred(u.u_procp); - code = afs_HandlePioctl(vp, com, &data, follow, &cred); - } + { + struct ucred *cred = p_cred(u.u_procp); + code = afs_HandlePioctl(vp, com, &data, follow, &cred); + } #else #ifdef AFS_SGI_ENV - { - struct cred *credp; - credp = OSI_GET_CURRENT_CRED(); - code = afs_HandlePioctl(vp, com, &data, follow, &credp); - } + { + struct cred *credp; + credp = OSI_GET_CURRENT_CRED(); + code = afs_HandlePioctl(vp, com, &data, follow, &credp); + } #else #if defined(AFS_LINUX22_ENV) || defined(AFS_DARWIN_ENV) || defined(AFS_XBSD_ENV) - code = afs_HandlePioctl(vp, com, &data, follow, &credp); + code = afs_HandlePioctl(vp ? VTOAFS(vp) : NULL, com, &data, follow, &credp); #else code = afs_HandlePioctl(vp, com, &data, follow, &u.u_cred); #endif diff --git a/src/afs/afs_prototypes.h b/src/afs/afs_prototypes.h index 985b99097..9a9e13f3b 100644 --- a/src/afs/afs_prototypes.h +++ b/src/afs/afs_prototypes.h @@ -432,6 +432,11 @@ extern void *osi_AllocSmallSpace(size_t size); extern char *osi_AllocSmall(register afs_int32 size, register afs_int32 morespace); #endif +/* afs_osi_uio.c */ +extern int afsio_copy(struct uio *ainuio, struct uio *aoutuio, struct iovec *aoutvec); +extern int afsio_trim(struct uio *auio, afs_int32 asize); +extern int afsio_skip(struct uio *auio, afs_int32 asize); + /* ARCH/osi_misc.c */ diff --git a/src/rxkad/rxkad_client.c b/src/rxkad/rxkad_client.c index 684f503b1..a225474a1 100644 --- a/src/rxkad/rxkad_client.c +++ b/src/rxkad/rxkad_client.c @@ -28,7 +28,9 @@ RCSID("$Header$"); #ifdef AFS_LINUX20_ENV #include "h/socket.h" #endif +#ifndef AFS_OBSD_ENV #include "netinet/in.h" +#endif #else /* !UKERNEL */ #include "afs/sysincludes.h" #endif /* !UKERNEL */ diff --git a/src/rxkad/rxkad_common.c b/src/rxkad/rxkad_common.c index bf63cb3e7..c51050a1a 100644 --- a/src/rxkad/rxkad_common.c +++ b/src/rxkad/rxkad_common.c @@ -82,7 +82,7 @@ char *rxi_Alloc(); #ifndef KERNEL #define osi_Time() time(0) #endif -struct rxkad_stats rxkad_stats = {0}; +struct rxkad_stats rxkad_stats; /* static prototypes */ static afs_int32 ComputeSum(struct rx_packet *apacket,