which included commits to RCS files with non-trunk default branches.
Makefile
aclocal.m4
config.log
+config.cache
config.status
configure
configure-libafs
sgi_65
sun4x_56
sun4x_57
+autom4te.cache
AC_ARG_ENABLE(tivoli-tsm,
[ --enable-tivoli-tsm Enable use of the Tivoli TSM API libraries for butc support],, enable_tivoli_tsm="no"
)
+AC_ARG_ENABLE(debug-kernel,
+[ --enable-debug-kernel enable compilation of the kernel module with debugging information (defaults to disabled)],, enable_debug_kernel="no"
+)
dnl weird ass systems
AC_AIX
OPENAFS_CHECK_BIGENDIAN
+KERN_DEBUG_OPT=
+if test "x$enable_debug_kernel" = "xyes"; then
+ KERN_DEBUG_OPT=-g
+fi
+
AC_MSG_CHECKING(your OS)
system=$host
case $system in
fi
AC_MSG_RESULT(linux)
if test "x$enable_kernel_module" = "xyes"; then
+ OMIT_FRAME_POINTER=
+ if test "x$enable_debug_kernel" = "xno"; then
+ OMIT_FRAME_POINTER=-fomit-frame-pointer
+ fi
+ AC_SUBST(OMIT_FRAME_POINTER)
ifdef([OPENAFS_CONFIGURE_LIBAFS],
[LINUX_BUILD_VNODE_FROM_INODE(config,afs)],
[LINUX_BUILD_VNODE_FROM_INODE(src/config,src/afs/LINUX)]
MKAFS_OSTYPE=SOLARIS
AC_MSG_RESULT(sun4)
SOLARIS_UFSVFS_HAS_DQRWLOCK
+ SOLARIS_PROC_HAS_P_COREFILE
;;
*-hpux*)
MKAFS_OSTYPE=HPUX
AC_MSG_RESULT($system)
;;
esac
+AC_SUBST(KERN_DEBUG_OPT)
if test "x$with_afs_sysname" != "x"; then
AFS_SYSNAME="$with_afs_sysname"
powerpc-apple-darwin5.2*)
AFS_SYSNAME="ppc_darwin_14"
;;
+ powerpc-apple-darwin5.3*)
+ AFS_SYSNAME="ppc_darwin_14"
+ ;;
+ powerpc-apple-darwin5.4*)
+ AFS_SYSNAME="ppc_darwin_14"
+ ;;
sparc-sun-solaris2.5*)
AFS_SYSNAME="sun4x_55"
;;
AC_CHECK_HEADERS(security/pam_modules.h siad.h usersec.h)
AC_CHECK_FUNCS(utimes random srandom getdtablesize snprintf re_comp re_exec)
+AC_CHECK_FUNCS(setprogname getprogname)
dnl Directory PATH handling
if test "x$enable_transarc_paths" = "xyes" ; then
AC_INIT(Makefile.common)
-AM_INIT_AUTOMAKE(openafs-libafs,1.2.3)
+AM_INIT_AUTOMAKE(openafs-libafs,1.2.4)
AC_CONFIG_HEADER(config/afsconfig.h)
define(OPENAFS_CONFIGURE_LIBAFS)
afsStatus.UnixModeBits = 0x1ff;
afsStatus.ParentVnode = 0x1;
afsStatus.ParentUnique = 0x1;
- afsStatus.ResidencyMask = 0;
+ afsStatus.SegSize = 0;
afsStatus.ClientModTime = 0x3b49f6e2;
afsStatus.ServerModTime = 0x3b49f6e2;
afsStatus.Group = 0;
statusp->UnixModeBits = 0x1ff;
statusp->ParentVnode = 0x1;
statusp->ParentUnique = 0x1;
- statusp->ResidencyMask = 0;
+ statusp->SegSize = 0;
statusp->ClientModTime = 0x3b49f6e2;
statusp->ServerModTime = 0x3b49f6e2;
statusp->Group = 0;
typedef struct smb_tran2QFSInfo {
union {
+#pragma pack(push, 2)
struct {
long FSID; /* file system ID */
long sectorsPerAllocUnit;
long availAllocUnits; /* free blocks */
unsigned short bytesPerSector; /* bytes per sector */
} allocInfo;
+#pragma pack(pop)
struct {
long vsn; /* volume serial number */
char vnCount; /* count of chars in label, incl null */
#include <afs/stds.h>
}
+#include "../afsapplib/afsapplib.h"
+
#include "svrmgr.h"
#include "cmdline.h"
#include "action.h"
swUSER,
swPASSWORD,
swLOOKUP,
+ swUSEEXISTING
} SWITCH;
static struct {
BOOL fPresent;
TCHAR szValue[ cchRESOURCE ];
} aSWITCHES[] = {
- { TEXT("cell"), TRUE },
- { TEXT("subset"), TRUE },
- { TEXT("server"), TRUE },
- { TEXT("reset"), FALSE },
- { TEXT("confirm"), FALSE },
- { TEXT("user"), TRUE },
- { TEXT("password"), TRUE },
- { TEXT("lookup"), FALSE }
+ { TEXT("cell"), TRUE },
+ { TEXT("subset"), TRUE },
+ { TEXT("server"), TRUE },
+ { TEXT("reset"), FALSE },
+ { TEXT("confirm"), FALSE },
+ { TEXT("user"), TRUE },
+ { TEXT("password"), TRUE },
+ { TEXT("lookup"), FALSE },
+ { TEXT("useexisting"), FALSE }
};
#define nSWITCHES (sizeof(aSWITCHES) / sizeof(aSWITCHES[0]))
return opLOOKUPERRORCODE;
}
+ if (aSWITCHES[ swUSEEXISTING ].fPresent)
+ {
+ ULONG ulStatus;
+ TCHAR szDefCell[ cchNAME ];
+
+ if (aSWITCHES[ swCELL ].fPresent)
+ {
+ lstrcpy(szDefCell,aSWITCHES[ swCELL ].szValue);
+ }
+ else
+ {
+ AfsAppLib_GetLocalCell(szDefCell);
+ }
+ g.hCreds = AfsAppLib_GetCredentials(szDefCell,&ulStatus);
+ if (g.hCreds != NULL)
+ {
+ LPOPENCELL_PACKET lpocp = New (OPENCELL_PACKET);
+
+ memset(lpocp,0x00,sizeof(OPENCELL_PACKET));
+ lstrcpy(lpocp->szCell,szDefCell);
+ lpocp->fCloseAppOnFail = TRUE;
+ lpocp->hCreds = g.hCreds;
+ lpocp->sub = NULL;
+ StartTask(taskOPENCELL,NULL,lpocp);
+ return opNOCELLDIALOG;
+ }
+ else
+ return opCLOSEAPP;
+ }
+
if (aSWITCHES[ swCELL ].fPresent)
{
LPOPENCELL_PACKET lpp = New (OPENCELL_PACKET);
#include <afsconfig.h>
#include "../afs/param.h"
-RCSID("$Header: /tmp/cvstemp/openafs/src/afs/AIX/osi_vfsops.c,v 1.1.1.4 2001/07/14 22:19:34 hartmans Exp $");
+RCSID("$Header: /tmp/cvstemp/openafs/src/afs/AIX/osi_vfsops.c,v 1.1.1.5 2002/05/10 23:43:33 hartmans Exp $");
#include "../afs/sysincludes.h" /* Standard vendor system headers */
#include "../afs/afsincludes.h" /* Afs-based standard headers */
crfree(credp);
}
if (tvp) {
- VN_HOLD((struct vnode *)tvp);
+ VN_HOLD(AFSTOV(tvp));
- VN_LOCK((struct vnode *)tvp);
- tvp->v.v_flag |= VROOT; /* No-op on Ultrix 2.2 */
- VN_UNLOCK((struct vnode *)tvp);
+ VN_LOCK(AFSTOV(tvp));
+ AFSTOV(tvp)->v_flag |= VROOT; /* No-op on Ultrix 2.2 */
+ VN_UNLOCK(AFSTOV(tvp));
afs_globalVFS = afsp;
- *avpp = (struct vnode *) tvp;
+ *avpp = AFSTOV(tvp);
afsp->vfs_mntd = *avpp;
}
#include <afsconfig.h>
#include "../afs/param.h"
-RCSID("$Header: /tmp/cvstemp/openafs/src/afs/AIX/osi_vm.c,v 1.1.1.4 2001/07/14 22:19:35 hartmans Exp $");
+RCSID("$Header: /tmp/cvstemp/openafs/src/afs/AIX/osi_vm.c,v 1.1.1.5 2002/05/10 23:43:33 hartmans Exp $");
#include "../afs/sysincludes.h" /* Standard vendor system headers */
#include "../afs/afsincludes.h" /* Afs-based standard headers */
}
/* Free the alloced gnode that was accompanying the vcache's vnode */
- aix_gnode_rele((struct vnode *)avc);
+ aix_gnode_rele(AFSTOV(avc));
return 0;
}
avc->states &= ~CCore;
avc->opens--;
avc->execsOrWriters--;
- AFS_RELE((struct vnode *)avc);
+ AFS_RELE(AFSTOV(avc));
crfree((struct ucred *)avc->linkData);
avc->linkData = (char *)0;
}
#include <afsconfig.h>
#include "../afs/param.h"
-RCSID("$Header: /tmp/cvstemp/openafs/src/afs/AIX/osi_vnodeops.c,v 1.1.1.5 2001/09/11 14:24:53 hartmans Exp $");
+RCSID("$Header: /tmp/cvstemp/openafs/src/afs/AIX/osi_vnodeops.c,v 1.1.1.6 2002/05/10 23:43:34 hartmans Exp $");
#include "../h/systm.h"
#include "../h/types.h"
{
int error;
struct vattr va;
- struct vcache *tvp = (struct vcache *)vp;
+ struct vcache *tvp = VTOAFS(vp);
afs_int32 modes;
AFS_STATCNT(afs_gn_open);
* we'd never flush the files out to the server! Gross but the simplest
* solution we came out with */
if (cred->cr_luid != RMTUSER_REQ) {
- while ((flags & FNSHARE) && ((struct vcache *)*vpp)->opens) {
+ while ((flags & FNSHARE) && VTOAFS(*vpp)->opens) {
if (!(flags & FDELAY))
return ETXTBSY;
- afs_osi_Sleep(&((struct vcache *)*vpp)->opens);
+ afs_osi_Sleep(&VTOAFS(*vpp)->opens);
}
/* Since in the standard copen() for bsd vnode kernels they do an
* vop_open after the vop_create, we must do the open here since there
afs_gn_rele(vp)
struct vnode *vp;
{
- struct vcache *vcp = (struct vcache *)vp;
+ struct vcache *vcp = VTOAFS(vp);
int error = 0;
AFS_STATCNT(afs_gn_rele);
struct ucred *cred;
{
int error;
- struct vcache *tvp = (struct vcache *)vp;
+ struct vcache *tvp = VTOAFS(vp);
AFS_STATCNT(afs_gn_close);
u_int len, off, flag;
struct ucred *cred;
{
- struct vcache *vcp = (struct vcache *)vp;
+ struct vcache *vcp = VTOAFS(vp);
struct vrequest treq;
afs_int32 error;
AFS_STATCNT(afs_gn_map);
int flag;
struct ucred *cred;
{
- struct vcache *vcp = (struct vcache *)vp;
+ struct vcache *vcp = VTOAFS(vp);
AFS_STATCNT(afs_gn_unmap);
ObtainWriteLock(&vcp->lock, 402);
if (flag & SHM_RDONLY) {
struct iovec iov;
struct uio uio;
static int fclear_init =0;
- register struct vcache *avc = (struct vcache *)vp;
+ register struct vcache *avc = VTOAFS(vp);
AFS_STATCNT(afs_gn_fclear);
if (!fclear_init) {
struct vattr *vattrp;
struct ucred *cred;
{
- register struct vcache *vcp = (struct vcache *)vp;
+ register struct vcache *vcp = VTOAFS(vp);
struct vrequest treq;
int error=0;
int free_cred = 0;
register int i;
afs_int32 blockSize, fileSize;
afs_int32 xfrSize, xfrOffset;
- register struct vcache *vcp = (struct vcache *)vp;
+ register struct vcache *vcp = VTOAFS(vp);
struct dcache *tdc;
register afs_int32 start_offset;
int save_resid = uiop->afsio_resid;
#include <afsconfig.h>
#include <afs/param.h>
-RCSID("$Header: /tmp/cvstemp/openafs/src/afs/DARWIN/osi_vfsops.c,v 1.1.1.4 2001/09/11 14:24:55 hartmans Exp $");
+RCSID("$Header: /tmp/cvstemp/openafs/src/afs/DARWIN/osi_vfsops.c,v 1.1.1.5 2002/05/10 23:43:37 hartmans Exp $");
#include <afs/sysincludes.h> /* Standard vendor system headers */
#include <afs/afsincludes.h> /* Afs-based standard headers */
if (tvp) {
osi_vnhold(tvp,0);
AFS_GUNLOCK();
- vn_lock((struct vnode *)tvp, LK_EXCLUSIVE | LK_RETRY, p);
+ vn_lock(AFSTOV(tvp), LK_EXCLUSIVE | LK_RETRY, p);
AFS_GLOCK();
afs_globalVFS = mp;
- *vpp = (struct vnode *) tvp;
- tvp->v.v_flag |= VROOT;
+ *vpp = AFSTOV(tvp);
+ AFSTOV(tvp)->v_flag |= VROOT;
}
afs_Trace2(afs_iclSetp, CM_TRACE_VFSROOT, ICL_TYPE_POINTER, *vpp,
#include <afsconfig.h>
#include "../afs/param.h"
-RCSID("$Header: /tmp/cvstemp/openafs/src/afs/DARWIN/osi_vm.c,v 1.1.1.4 2002/01/22 19:48:05 hartmans Exp $");
+RCSID("$Header: /tmp/cvstemp/openafs/src/afs/DARWIN/osi_vm.c,v 1.1.1.5 2002/05/10 23:43:37 hartmans Exp $");
#include "../afs/sysincludes.h" /* Standard vendor system headers */
#include "../afs/afsincludes.h" /* Afs-based standard headers */
struct vcache *avc;
int *slept;
{
- struct vnode *vp=(struct vnode *)avc;
+ struct vnode *vp=AFSTOV(avc);
#ifdef AFS_DARWIN14_ENV
if (UBCINFOEXISTS(vp))
return EBUSY;
osi_VM_StoreAllSegments(avc)
struct vcache *avc;
{
- struct vnode *vp=(struct vnode *)avc;
+ struct vnode *vp=AFSTOV(avc);
ReleaseWriteLock(&avc->lock);
AFS_GUNLOCK();
if (UBCINFOEXISTS(vp)) {
struct AFS_UCRED *acred;
int sync;
{
- struct vnode *vp=(struct vnode *)avc;
+ struct vnode *vp=AFSTOV(avc);
void *object;
kern_return_t kret;
off_t size, lastpg;
struct vcache *avc;
struct AFS_UCRED *credp;
{
- struct vnode *vp=(struct vnode *)avc;
+ struct vnode *vp=AFSTOV(avc);
void *object;
kern_return_t kret;
off_t size;
int alen;
struct AFS_UCRED *acred;
{
- struct vnode *vp=(struct vnode *)avc;
+ struct vnode *vp=AFSTOV(avc);
if (UBCINFOEXISTS(vp)) {
ubc_setsize(vp, alen);
}
int *slept;
{
struct proc *p=current_proc();
- struct vnode *vp=(struct vnode *)avc;
+ struct vnode *vp=AFSTOV(avc);
void *obj;
if (slept)
void osi_VM_NukePages(struct vnode *vp, off_t offset, off_t size) {
void *object;
- struct vcache *avc = (struct vcache *)vp;
+ struct vcache *avc = VTOAFS(vp);
#ifdef AFS_DARWIN14_ENV
offset=trunc_page(offset);
}
int osi_VM_Setup(struct vcache *avc) {
int error;
- struct vnode *vp=(struct vnode *)avc;
+ struct vnode *vp=AFSTOV(avc);
if (UBCISVALID(vp) && (avc->states & CStatd)) {
if (!UBCINFOEXISTS(vp) && !ISSET(vp->v_flag, VTERMINATE)) {
#include <afsconfig.h>
#include <afs/param.h>
-RCSID("$Header: /tmp/cvstemp/openafs/src/afs/DARWIN/osi_vnodeops.c,v 1.1.1.5 2002/01/22 19:48:06 hartmans Exp $");
+RCSID("$Header: /tmp/cvstemp/openafs/src/afs/DARWIN/osi_vnodeops.c,v 1.1.1.6 2002/05/10 23:43:37 hartmans Exp $");
#include <afs/sysincludes.h> /* Standard vendor system headers */
#include <afs/afsincludes.h> /* Afs-based standard headers */
if (flags & ISDOTDOT)
VOP_UNLOCK(dvp, 0, p);
AFS_GLOCK();
- error = afs_lookup((struct vcache *)dvp, name, &vcp, cnp->cn_cred);
+ error = afs_lookup(VTOAFS(dvp), name, &vcp, cnp->cn_cred);
AFS_GUNLOCK();
if (error) {
if (flags & ISDOTDOT)
*ap->a_vpp = 0;
return (error);
}
- vp = (struct vnode *)vcp; /* always get a node if no error */
+ vp = AFSTOV(vcp); /* always get a node if no error */
/* The parent directory comes in locked. We unlock it on return
unless the caller wants it left locked.
/* vnode layer handles excl/nonexcl */
AFS_GLOCK();
- error = afs_create((struct vcache *)dvp, name, ap->a_vap, NONEXCL,
+ error = afs_create(VTOAFS(dvp), name, ap->a_vap, NONEXCL,
ap->a_vap->va_mode, &vcp,
cnp->cn_cred);
AFS_GUNLOCK();
}
if (vcp) {
- *ap->a_vpp = (struct vnode *)vcp;
- vn_lock((struct vnode *)vcp, LK_EXCLUSIVE| LK_RETRY, p);
- if (UBCINFOMISSING((struct vnode *)vcp) ||
- UBCINFORECLAIMED((struct vnode *)vcp))
- ubc_info_init((struct vnode *)vcp);
+ *ap->a_vpp = AFSTOV(vcp);
+ vn_lock(*ap->a_vpp, LK_EXCLUSIVE| LK_RETRY, p);
+ if (UBCINFOMISSING(*ap->a_vpp) ||
+ UBCINFORECLAIMED(*ap->a_vpp))
+ ubc_info_init(*ap->a_vpp);
}
else *ap->a_vpp = 0;
} */ *ap;
{
int error;
- struct vcache *vc = (struct vcache *)ap->a_vp;
+ struct vcache *vc = VTOAFS(ap->a_vp);
AFS_GLOCK();
error = afs_open(&vc, ap->a_mode, ap->a_cred);
#ifdef DIAGNOSTIC
- if ((struct vnode *)vc != ap->a_vp)
+ if (AFSTOV(vc) != ap->a_vp)
panic("AFS open changed vnode!");
#endif
afs_BozonLock(&vc->pvnLock, vc);
{
int code;
AFS_GLOCK();
- code=afs_access((struct vcache *)ap->a_vp, ap->a_mode, ap->a_cred);
+ code=afs_access(VTOAFS(ap->a_vp), ap->a_mode, ap->a_cred);
AFS_GUNLOCK();
return code;
}
{
int code;
AFS_GLOCK();
- code=afs_getattr((struct vcache *)ap->a_vp, ap->a_vap, ap->a_cred);
+ code=afs_getattr(VTOAFS(ap->a_vp), ap->a_vap, ap->a_cred);
AFS_GUNLOCK();
return code;
}
{
int code;
AFS_GLOCK();
- code=afs_setattr((struct vcache *)ap->a_vp, ap->a_vap, ap->a_cred);
+ code=afs_setattr(VTOAFS(ap->a_vp), ap->a_vap, ap->a_cred);
AFS_GUNLOCK();
return code;
}
} */ *ap;
{
int code;
- struct vcache *avc=(struct vcache *)ap->a_vp;
+ struct vcache *avc=VTOAFS(ap->a_vp);
AFS_GLOCK();
afs_BozonLock(&avc->pvnLock, avc);
osi_FlushPages(avc); /* hold bozon lock, but not basic vnode lock */
int nocommit = flags & UPL_NOCOMMIT;
int code;
- struct vcache *tvc=(struct vcache *)vp;
+ struct vcache *tvc=VTOAFS(vp);
if (UBCINVALID(vp)) {
#if DIAGNOSTIC
} */ *ap;
{
int code;
- struct vcache *avc=(struct vcache *)ap->a_vp;
+ struct vcache *avc=VTOAFS(ap->a_vp);
void *object;
AFS_GLOCK();
afs_BozonLock(&avc->pvnLock, avc);
ubc_clean(ap->a_vp, 1);
if (UBCINFOEXISTS(ap->a_vp))
osi_VM_NukePages(ap->a_vp, ap->a_uio->uio_offset, ap->a_uio->uio_resid);
- code=afs_write((struct vcache *)ap->a_vp, ap->a_uio, ap->a_ioflag, ap->a_cred, 0);
+ code=afs_write(VTOAFS(ap->a_vp), ap->a_uio, ap->a_ioflag, ap->a_cred, 0);
afs_BozonUnlock(&avc->pvnLock, avc);
AFS_GUNLOCK();
return code;
int nocommit = flags & UPL_NOCOMMIT;
int code;
- struct vcache *tvc=(struct vcache *)vp;
+ struct vcache *tvc=VTOAFS(vp);
if (UBCINVALID(vp)) {
#if DIAGNOSTIC
struct proc *a_p;
} */ *ap;
{
- struct vcache *tvc = (struct vcache *)ap->a_vp;
+ struct vcache *tvc = VTOAFS(ap->a_vp);
struct afs_ioctl data;
int error = 0;
AFS_GLOCK();
/*vflushbuf(vp, wait);*/
if (ap->a_cred)
- error=afs_fsync((struct vcache *)vp, ap->a_cred);
+ error=afs_fsync(VTOAFS(vp), ap->a_cred);
else
- error=afs_fsync((struct vcache *)vp, &afs_osi_cred);
+ error=afs_fsync(VTOAFS(vp), &afs_osi_cred);
AFS_GUNLOCK();
return error;
}
GETNAME();
AFS_GLOCK();
- error = afs_remove((struct vcache *)dvp, name, cnp->cn_cred);
+ error = afs_remove(VTOAFS(dvp), name, cnp->cn_cred);
AFS_GUNLOCK();
cache_purge(vp);
if (!error && UBCINFOEXISTS(vp)) {
goto out;
}
AFS_GLOCK();
- error = afs_link((struct vcache *)vp, (struct vcache *)dvp, name, cnp->cn_cred);
+ error = afs_link(VTOAFS(vp), VTOAFS(dvp), name, cnp->cn_cred);
AFS_GUNLOCK();
FREE_ZONE(cnp->cn_pnbuf, cnp->cn_pnlen, M_NAMEI);
if (dvp != vp)
AFS_GLOCK();
/* XXX use "from" or "to" creds? NFS uses "to" creds */
- error = afs_rename((struct vcache *)fdvp, fname, (struct vcache *)tdvp, tname, tcnp->cn_cred);
+ error = afs_rename(VTOAFS(fdvp), fname, VTOAFS(tdvp), tname, tcnp->cn_cred);
AFS_GUNLOCK();
VOP_UNLOCK(fvp, 0, p);
panic("afs_vop_mkdir: no name");
#endif
AFS_GLOCK();
- error = afs_mkdir((struct vcache *)dvp, name, vap, &vcp, cnp->cn_cred);
+ error = afs_mkdir(VTOAFS(dvp), name, vap, &vcp, cnp->cn_cred);
AFS_GUNLOCK();
if (error) {
VOP_ABORTOP(dvp, cnp);
return(error);
}
if (vcp) {
- *ap->a_vpp = (struct vnode *)vcp;
- vn_lock((struct vnode *)vcp, LK_EXCLUSIVE|LK_RETRY, p);
+ *ap->a_vpp = AFSTOV(vcp);
+ vn_lock(*ap->a_vpp, LK_EXCLUSIVE|LK_RETRY, p);
} else
*ap->a_vpp = 0;
DROPNAME();
}
AFS_GLOCK();
- error = afs_rmdir((struct vcache *)dvp, name, cnp->cn_cred);
+ error = afs_rmdir(VTOAFS(dvp), name, cnp->cn_cred);
AFS_GUNLOCK();
DROPNAME();
vput(dvp);
GETNAME();
AFS_GLOCK();
- error = afs_symlink((struct vcache *)dvp, name, ap->a_vap, ap->a_target,
+ error = afs_symlink(VTOAFS(dvp), name, ap->a_vap, ap->a_target,
cnp->cn_cred);
AFS_GUNLOCK();
DROPNAME();
ap->a_ncookies); */
off=ap->a_uio->uio_offset;
AFS_GLOCK();
- error= afs_readdir((struct vcache *)ap->a_vp, ap->a_uio, ap->a_cred,
+ error= afs_readdir(VTOAFS(ap->a_vp), ap->a_uio, ap->a_cred,
ap->a_eofflag);
AFS_GUNLOCK();
if (!error && ap->a_ncookies != NULL) {
int error;
/* printf("readlink %x\n", ap->a_vp);*/
AFS_GLOCK();
- error= afs_readlink((struct vcache *)ap->a_vp, ap->a_uio, ap->a_cred);
+ error= afs_readlink(VTOAFS(ap->a_vp), ap->a_uio, ap->a_cred);
AFS_GUNLOCK();
return error;
}
vprint("afs_vop_inactive(): pushing active", vp);
AFS_GLOCK();
- afs_InactiveVCache((struct vcache *)vp, 0); /* decrs ref counts */
+ afs_InactiveVCache(VTOAFS(vp), 0); /* decrs ref counts */
AFS_GUNLOCK();
VOP_UNLOCK(vp, 0, ap->a_p);
return 0;
#if 0
AFS_GLOCK();
- error = afs_FlushVCache((struct vcache *)vp, &sl); /* tosses our stuff from vnode */
+ error = afs_FlushVCache(VTOAFS(vp), &sl); /* tosses our stuff from vnode */
AFS_GUNLOCK();
ubc_unlink(vp);
if (!error && vp->v_data)
} */ *ap;
{
register struct vnode *vp = ap->a_vp;
- register struct vcache *avc = (struct vcache *)vp;
+ register struct vcache *avc = VTOAFS(vp);
if (vp->v_tag == VT_NON)
return (ENOENT);
} */ *ap;
{
struct vnode *vp = ap->a_vp;
- struct vcache *avc = (struct vcache *)vp;
+ struct vcache *avc = VTOAFS(vp);
return (lockmgr(&avc->rwlock, ap->a_flags | LK_RELEASE,
&vp->v_interlock, ap->a_p));
} */ *ap;
{
register struct vnode *vp = ap->a_vp;
- register struct vcache *vc = (struct vcache *)ap->a_vp;
+ register struct vcache *vc = VTOAFS(ap->a_vp);
int s = vc->states;
char buf[20];
printf("tag %d, fid: %ld.%x.%x.%x, opens %d, writers %d", vp->v_tag, vc->fid.Cell,
struct vnode *a_vp;
} */ *ap;
{
- struct vcache *vc = (struct vcache *)ap->a_vp;
+ struct vcache *vc = VTOAFS(ap->a_vp);
return lockstatus(&vc->rwlock);
}
cr=*p->p_cred->pc_ucred;
pcred_unlock(p);
AFS_GLOCK();
- error= afs_lockctl((struct vcache *)ap->a_vp, ap->a_fl, ap->a_op, &cr,
+ error= afs_lockctl(VTOAFS(ap->a_vp), ap->a_fl, ap->a_op, &cr,
(int) ap->a_id);
AFS_GUNLOCK();
return error;
#define afs_bufferpages bufpages
#define osi_vnhold(avc,r) do { \
- if ((avc)->vrefCount) { VN_HOLD((struct vnode *)(avc)); } \
+ if ((avc)->vrefCount) { VN_HOLD(AFSTOV(avc)); } \
else osi_Panic("refcnt==0"); } while(0)
#define gop_rdwr(rw,gp,base,len,offset,segflg,unit,cred,aresid) \
#include <afsconfig.h>
#include "../afs/param.h"
-RCSID("$Header: /tmp/cvstemp/openafs/src/afs/DUX/osi_vfsops.c,v 1.1.1.6 2001/09/11 14:24:57 hartmans Exp $");
+RCSID("$Header: /tmp/cvstemp/openafs/src/afs/DUX/osi_vfsops.c,v 1.1.1.7 2002/05/10 23:43:40 hartmans Exp $");
#include "../afs/sysincludes.h" /* Standard vendor system headers */
#include "../afs/afsincludes.h" /* Afs-based standard headers */
}
}
if (tvp) {
+ struct vnode *vp = AFSTOV(tvp);
AFS_GUNLOCK();
- VN_HOLD((struct vnode *)tvp);
- VN_LOCK((struct vnode *)tvp);
- tvp->v.v_flag |= VROOT; /* No-op on Ultrix 2.2 */
- VN_UNLOCK((struct vnode *)tvp);
+ VN_HOLD(vp);
+ VN_LOCK(vp);
+ vp->v_flag |= VROOT; /* No-op on Ultrix 2.2 */
+ VN_UNLOCK(vp);
AFS_GLOCK();
afs_globalVFS = afsp;
- *avpp = (struct vnode *) tvp;
+ *avpp = vp;
}
afs_Trace2(afs_iclSetp, CM_TRACE_VFSROOT, ICL_TYPE_POINTER, *avpp,
long addr[2];
register struct cell *tcell;
int rootvp = 0;
- struct vcache *avc = (struct vcache *)avn;
+ struct vcache *avc = VTOAFS(avn);
AFS_GLOCK();
AFS_STATCNT(afs_fid);
fidp->fid_reserved = AFS_XLATOR_MAGIC;
addr[0] = (long)avc;
AFS_GUNLOCK();
- VN_HOLD((struct vnode *)avc);
+ VN_HOLD(AFSTOV(avc));
AFS_GLOCK();
}
#include <afsconfig.h>
#include "../afs/param.h"
-RCSID("$Header: /tmp/cvstemp/openafs/src/afs/DUX/osi_vm.c,v 1.1.1.4 2001/07/14 22:19:38 hartmans Exp $");
+RCSID("$Header: /tmp/cvstemp/openafs/src/afs/DUX/osi_vm.c,v 1.1.1.5 2002/05/10 23:43:40 hartmans Exp $");
#include "../afs/sysincludes.h" /* Standard vendor system headers */
#include "../afs/afsincludes.h" /* Afs-based standard headers */
return EBUSY;
AFS_GUNLOCK();
- ubc_invalidate(((struct vnode *)avc)->v_object, 0, 0, B_INVAL);
+ ubc_invalidate(AFSTOV(avc)->v_object, 0, 0, B_INVAL);
AFS_GLOCK();
return 0;
{
ReleaseWriteLock(&avc->lock);
AFS_GUNLOCK();
- osi_ubc_flush_dirty_and_wait((struct vnode *)avc, 0);
+ osi_ubc_flush_dirty_and_wait(AFSTOV(avc), 0);
AFS_GLOCK();
ObtainWriteLock(&avc->lock,94);
}
{
ReleaseWriteLock(&avc->lock);
AFS_GUNLOCK();
- osi_ubc_flush_dirty_and_wait((struct vnode *)avc, 0);
- ubc_invalidate(((struct vnode *)avc)->v_object, 0, 0, B_INVAL);
+ osi_ubc_flush_dirty_and_wait(AFSTOV(avc), 0);
+ ubc_invalidate(AFSTOV(avc)->v_object, 0, 0, B_INVAL);
AFS_GLOCK();
ObtainWriteLock(&avc->lock,59);
}
struct vcache *avc;
struct AFS_UCRED *credp;
{
- ubc_flush_dirty(((struct vnode *)avc)->v_object, 0);
- ubc_invalidate(((struct vnode *)avc)->v_object, 0, 0, B_INVAL);
+ ubc_flush_dirty(AFSTOV(avc)->v_object, 0);
+ ubc_invalidate(AFSTOV(avc)->v_object, 0, 0, B_INVAL);
}
/* Purge pages beyond end-of-file, when truncating a file.
int alen;
struct AFS_UCRED *acred;
{
- ubc_invalidate(((struct vnode *)avc)->v_object, alen,
+ ubc_invalidate(AFSTOV(avc)->v_object, alen,
MAXINT - alen, B_INVAL);
}
#include <afsconfig.h>
#include "../afs/param.h"
-RCSID("$Header: /tmp/cvstemp/openafs/src/afs/DUX/osi_vnodeops.c,v 1.1.1.5 2001/07/14 22:19:37 hartmans Exp $");
+RCSID("$Header: /tmp/cvstemp/openafs/src/afs/DUX/osi_vnodeops.c,v 1.1.1.6 2002/05/10 23:43:41 hartmans Exp $");
#include "../afs/sysincludes.h" /* Standard vendor system headers */
ReleaseWriteLock(&avc->lock);
AFS_GUNLOCK();
#ifdef AFS_DUX50_ENV
- code = ubc_lookup(((struct vnode *)avc)->v_object, pageBase,
+ code = ubc_lookup(AFSTOV(avc)->v_object, pageBase,
PAGE_SIZE, PAGE_SIZE, &page, &flags, NULL);
#else
- code = ubc_lookup(((struct vnode *)avc)->v_object, pageBase,
+ code = ubc_lookup(AFSTOV(avc)->v_object, pageBase,
PAGE_SIZE, PAGE_SIZE, &page, &flags);
#endif
AFS_GLOCK();
*/
if ((uio->uio_rw == UIO_WRITE) &&
((pageOffset == 0 && (size == PAGE_SIZE || fileBase >= avc->m.Length)))) {
- struct vnode *vp = (struct vnode *)avc;
+ struct vnode *vp = AFSTOV(avc);
/* we're doing a write operation past eof; no need to read it */
newpage = 1;
AFS_GUNLOCK();
bp = ubc_bufalloc(page, 1, PAGE_SIZE, 1, B_READ);
AFS_GLOCK();
bp->b_dev = 0;
- bp->b_vp = (struct vnode *)avc;
+ bp->b_vp = AFSTOV(avc);
bp->b_blkno = btodb(pageBase);
ReleaseWriteLock(&avc->lock);
code = afs_ustrategy(bp, cred); /* do the I/O */
/* We released the page, so we can get a null page
* list if another thread calls the strategy routine.
*/
- pl = ubc_dirty_kluster(((struct vnode *)avc)->v_object,
+ pl = ubc_dirty_kluster(AFSTOV(avc)->v_object,
NULL, toffset, 0, B_WANTED, FALSE, &kpcnt);
if (pl) {
bp = ubc_bufalloc(pl, 1, PAGE_SIZE, 1, B_WRITE);
bp->b_dev = 0;
- bp->b_vp = (struct vnode *)avc;
+ bp->b_vp = AFSTOV(avc);
bp->b_blkno = btodb(pageBase);
AFS_GLOCK();
code = afs_ustrategy(bp, cred); /* do the I/O */
afs_BozonUnlock(&avc->pvnLock, avc);
if (DO_FLUSH || (!newpage && (cnt < 10))) {
AFS_GUNLOCK();
- ubc_flush_dirty(((struct vnode *)avc)->v_object, flags);
+ ubc_flush_dirty(AFSTOV(avc)->v_object, flags);
AFS_GLOCK();
}
{
struct vp_mmap_args args;
register struct vp_mmap_args *ap = &args;
- struct vnode *vp = (struct vnode *)avc;
+ struct vnode *vp = AFSTOV(avc);
int code;
struct vrequest treq;
#if !defined(DYNEL)
vm_page_t *pagep;
vm_offset_t off;
- struct vcache *avc = (struct vcache *)vop->vu_vp;
+ struct vcache *avc = VTOAFS(vop->vu_vp);
/* first, obtain the proper lock for the VM system */
ReleaseWriteLock(&avc->lock);
AFS_GUNLOCK();
#ifdef AFS_DUX50_ENV
- code = ubc_lookup(((struct vnode *)avc)->v_object, off,
+ code = ubc_lookup(AFSTOV(avc)->v_object, off,
PAGE_SIZE, PAGE_SIZE, pagep, &flags, NULL);
#else
- code = ubc_lookup(((struct vnode *)avc)->v_object, off,
+ code = ubc_lookup(AFSTOV(avc)->v_object, off,
PAGE_SIZE, PAGE_SIZE, pagep, &flags);
#endif
AFS_GLOCK();
}
if(flags & B_NOCACHE) { /* if (page) */
if ((rw & B_WRITE) && (offset+len >= avc->m.Length)) {
- struct vnode *vp = (struct vnode *)avc;
+ struct vnode *vp = AFSTOV(avc);
/* we're doing a write operation past eof; no need to read it */
AFS_GUNLOCK();
ubc_page_zero(*pagep, 0, PAGE_SIZE);
bp = ubc_bufalloc(*pagep, 1, PAGE_SIZE, 1, B_READ);
AFS_GLOCK();
bp->b_dev = 0;
- bp->b_vp = (struct vnode *)avc;
+ bp->b_vp = AFSTOV(avc);
bp->b_blkno = btodb(off);
ReleaseWriteLock(&avc->lock);
code = afs_ustrategy(bp, cred); /* do the I/O */
struct ucred *cred;
{
register afs_int32 code=0;
- struct vcache *avc = (struct vcache *)vop->vu_vp;
- struct vnode *vp = (struct vnode *)avc;
+ struct vnode *vp = vop->vu_vp;
+ struct vcache *avc = VTOAFS(vp);
int i;
AFS_GLOCK();
bp = ubc_bufalloc(page, 1, PAGE_SIZE, 1, B_WRITE);
AFS_GLOCK();
bp->b_dev = 0;
- bp->b_vp = (struct vnode *)avc;
+ bp->b_vp = AFSTOV(avc);
bp->b_blkno = btodb(page->pg_offset);
ReleaseWriteLock(&avc->lock);
code = afs_ustrategy(bp, cred); /* do the I/O */
uio.afsio_offset = offset;
uio.afsio_resid = fsbsize;
*bpp = 0;
- error = afs_read((struct vcache *)vp, &uio, cred, lbn, bpp, 0);
+ error = afs_read(VTOAFS(vp), &uio, cred, lbn, bpp, 0);
if (error) {
afs_bread_freebp = bp;
AFS_GUNLOCK();
#include <afsconfig.h>
#include "../afs/param.h"
-RCSID("$Header: /tmp/cvstemp/openafs/src/afs/FBSD/osi_vfsops.c,v 1.1.1.4 2001/09/11 14:24:58 hartmans Exp $");
+RCSID("$Header: /tmp/cvstemp/openafs/src/afs/FBSD/osi_vfsops.c,v 1.1.1.5 2002/05/10 23:43:46 hartmans Exp $");
#include "../afs/sysincludes.h" /* Standard vendor system headers */
#include "../afs/afsincludes.h" /* Afs-based standard headers */
if (tvp) {
AFS_GUNLOCK();
VN_HOLD((struct vnode *)tvp);
- VN_LOCK((struct vnode *)tvp);
+ VN_LOCK(AFSTOV(tvp));
tvp->v.v_flag |= VROOT; /* No-op on Ultrix 2.2 */
VN_UNLOCK((struct vnode *)tvp);
AFS_GLOCK();
afs_globalVFS = afsp;
- *avpp = (struct vnode *) tvp;
+ *avpp = AFSTOV(tvp);
}
afs_Trace2(afs_iclSetp, CM_TRACE_VFSROOT, ICL_TYPE_POINTER, *avpp,
#include <afsconfig.h>
#include "../afs/param.h"
-RCSID("$Header: /tmp/cvstemp/openafs/src/afs/FBSD/osi_vm.c,v 1.1.1.3 2001/07/14 22:20:05 hartmans Exp $");
+RCSID("$Header: /tmp/cvstemp/openafs/src/afs/FBSD/osi_vm.c,v 1.1.1.4 2002/05/10 23:43:47 hartmans Exp $");
#include "../afs/sysincludes.h" /* Standard vendor system headers */
#include "../afs/afsincludes.h" /* Afs-based standard headers */
#ifdef SECRETLY_OSF1
ReleaseWriteLock(&avc->lock);
AFS_GUNLOCK();
- osi_ubc_flush_dirty_and_wait((struct vnode *)avc, 0);
- ubc_invalidate(((struct vnode *)avc)->v_object, 0, 0, B_INVAL);
+ osi_ubc_flush_dirty_and_wait(AFSTOV(avc), 0);
+ ubc_invalidate((AFSTOV(avc))->v_object, 0, 0, B_INVAL);
AFS_GLOCK();
ObtainWriteLock(&avc->lock,59);
#endif /* SECRETLY_OSF1 */
struct AFS_UCRED *credp;
{
#ifdef SECRETLY_OSF1
- ubc_flush_dirty(((struct vnode *)avc)->v_object, 0);
- ubc_invalidate(((struct vnode *)avc)->v_object, 0, 0, B_INVAL);
+ ubc_flush_dirty((AFSTOV(avc))->v_object, 0);
+ ubc_invalidate((AFSTOV(avc))->v_object, 0, 0, B_INVAL);
#endif /* SECRETLY_OSF1 */
}
struct AFS_UCRED *acred;
{
#ifdef SECRETLY_OSF1
- ubc_invalidate(((struct vnode *)avc)->v_object, alen,
+ ubc_invalidate((AFSTOV(avc))->v_object, alen,
MAXINT - alen, B_INVAL);
#endif /* SECRETLY_OSF1 */
}
#define AFS_UCRED ucred
#define AFS_PROC proc_t
-#define osi_vnhold(avc, r) do { VN_HOLD((struct vnode *)(avc)); } while(0)
+#define osi_vnhold(avc, r) do { VN_HOLD(AFSTOV(avc)); } while(0)
#define gop_rdwr(rw,gp,base,len,offset,segflg,unit,aresid) \
vn_rdwr((rw),(gp),(base),(len),(offset),(segflg),(unit),(aresid),0)
#include <afsconfig.h>
#include "../afs/param.h"
-RCSID("$Header: /tmp/cvstemp/openafs/src/afs/HPUX/osi_vfsops.c,v 1.1.1.4 2001/07/14 22:19:41 hartmans Exp $");
+RCSID("$Header: /tmp/cvstemp/openafs/src/afs/HPUX/osi_vfsops.c,v 1.1.1.5 2002/05/10 23:43:50 hartmans Exp $");
#include "../afs/sysincludes.h" /* Standard vendor system headers */
#include "../afs/afsincludes.h" /* Afs-based standard headers */
}
}
if (tvp) {
- VN_HOLD((struct vnode *)tvp);
- SET_V_FLAG( ((struct vnode *)tvp), VROOT);
+ VN_HOLD(AFSTOV(tvp));
+ SET_V_FLAG(AFSTOV(tvp), VROOT);
afs_globalVFS = afsp;
- *avpp = (struct vnode *) tvp;
+ *avpp = AFSTOV(tvp);
}
afs_Trace2(afs_iclSetp, CM_TRACE_VFSROOT, ICL_TYPE_POINTER, *avpp,
#include <afsconfig.h>
#include "../afs/param.h"
-RCSID("$Header: /tmp/cvstemp/openafs/src/afs/HPUX/osi_vm.c,v 1.1.1.4 2001/07/14 22:19:41 hartmans Exp $");
+RCSID("$Header: /tmp/cvstemp/openafs/src/afs/HPUX/osi_vm.c,v 1.1.1.5 2002/05/10 23:43:52 hartmans Exp $");
#include "../afs/sysincludes.h" /* Standard vendor system headers */
#include "../afs/afsincludes.h" /* Afs-based standard headers */
struct AFS_UCRED *acred;
int sync;
{
- struct vnode *vp = (struct vnode *)avc;
+ struct vnode *vp = AFSTOV(avc);
/* Flush the delayed write blocks associated with this vnode
* from the buffer cache
#include <afsconfig.h>
#include "../afs/param.h"
-RCSID("$Header: /tmp/cvstemp/openafs/src/afs/HPUX/osi_vnodeops.c,v 1.1.1.5 2001/09/11 14:25:01 hartmans Exp $");
+RCSID("$Header: /tmp/cvstemp/openafs/src/afs/HPUX/osi_vnodeops.c,v 1.1.1.6 2002/05/10 23:43:53 hartmans Exp $");
#include "../afs/sysincludes.h" /* Standard vendor system headers */
#include "../afs/afsincludes.h" /* Afs-based standard headers */
uio.uio_fpflags = 0;
*bpp = 0;
- error = afs_read((struct vcache *)vp, &uio, p_cred(u.u_procp),
+ error = afs_read(VTOAFS(vp), &uio, p_cred(u.u_procp),
lbn, bpp, 0);
if (error) {
afs_bread_freebp = bp;
register struct vcache *avc;
struct AFS_UCRED *acred;
{
- struct vnode *vp = (struct vnode *)avc;
+ struct vnode *vp = AFSTOV(avc);
ulong_t context;
lock_t *sv_lock;
if (afs_shuttingdown) return ;
afsioctl.out = ai->out;
afsioctl.in_size = ai->in_size;
afsioctl.out_size = ai->out_size;
- error = HandleIoctl((struct vcache *)vp, com, &afsioctl);
+ error = HandleIoctl(VTOAFS(vp), com, &afsioctl);
return(error);
}
return(ENOTTY);
we can't read, and finally call iodone(bp). File is
in bp->b_vp. Credentials are from u area??
*/
- code = afs_rdwr((struct vcache *)bp->b_vp,&tuio,UIO_READ,0,kt_cred(t));
+ code = afs_rdwr(VTOAFS(bp->b_vp),&tuio,UIO_READ,0,kt_cred(t));
if (code == 0)
if (tuio.afsio_resid > 0)
{
}
} else
- code = afs_rdwr((struct vcache *)bp->b_vp,&tuio,UIO_WRITE,0,kt_cred(t));
+ code = afs_rdwr(VTOAFS(bp->b_vp),&tuio,UIO_WRITE,0,kt_cred(t));
/* Remap back to the user's space */
hdl_remap_bp(bp);
#define AFS_UCRED ucred
-#define osi_vnhold(avc, r) do { VN_HOLD((struct vnode *)(avc)); } while(0)
+#define osi_vnhold(avc, r) do { VN_HOLD(AFSTOV(avc)); } while(0)
#undef afs_osi_Alloc_NoSleep
extern void *afs_osi_Alloc_NoSleep(size_t size);
#undef OSI_VC_DECL
#define OSI_VC_DECL(V) bhv_desc_t *bhv_##V
#undef OSI_VC_CONVERT
-#define OSI_VC_CONVERT(V) struct vcache * V = (struct vcache*)BHV_TO_VNODE(bhv_##V);
+#define OSI_VC_CONVERT(V) struct vcache * V = VTOAFS(BHV_TO_VNODE(bhv_##V));
#undef OSI_VFS_ARG
#define OSI_VFS_ARG(V) bhv_##V
#undef OSI_VFS_DECL
#include <afsconfig.h>
#include "../afs/param.h"
-RCSID("$Header: /tmp/cvstemp/openafs/src/afs/IRIX/osi_vfsops.c,v 1.1.1.5 2002/01/22 19:48:10 hartmans Exp $");
+RCSID("$Header: /tmp/cvstemp/openafs/src/afs/IRIX/osi_vfsops.c,v 1.1.1.6 2002/05/10 23:43:59 hartmans Exp $");
#include "../afs/sysincludes.h" /* Standard vendor system headers */
#include "../afs/afsincludes.h" /* Afs-based standard headers */
* rootvp gets lots of ref counts
*/
if (rootvp) {
- tvc = (struct vcache *)rootvp;
+ tvc = VTOAFS(rootvp);
if (tvc->opens || CheckLock(&tvc->lock) || LockWaiters(&tvc->lock)) {
ReleaseWriteLock(&afs_xvcache);
return EBUSY;
}
if (tvp) {
int s;
- VN_HOLD((struct vnode *)tvp);
- s = VN_LOCK((struct vnode *)tvp);
- tvp->v.v_flag |= VROOT;
- VN_UNLOCK((struct vnode *)tvp, s);
+ VN_HOLD(AFSTOV(tvp));
+ s = VN_LOCK(AFSTOV(tvp));
+ AFSTOV(tvp)->v_flag |= VROOT;
+ VN_UNLOCK(AFSTOV(tvp), s);
afs_globalVFS = afsp;
- *avpp = (struct vnode *) tvp;
+ *avpp = AFSTOV(tvp);
}
afs_Trace2(afs_iclSetp, CM_TRACE_VFSROOT, ICL_TYPE_POINTER, *avpp,
#include <afsconfig.h>
#include "../afs/param.h"
-RCSID("$Header: /tmp/cvstemp/openafs/src/afs/IRIX/osi_vm.c,v 1.1.1.4 2001/07/14 22:19:44 hartmans Exp $");
+RCSID("$Header: /tmp/cvstemp/openafs/src/afs/IRIX/osi_vm.c,v 1.1.1.5 2002/05/10 23:44:01 hartmans Exp $");
#include "../afs/sysincludes.h" /* Standard vendor system headers */
#include "../afs/afsincludes.h" /* Afs-based standard headers */
osi_Assert(OSI_GET_LOCKID() != avc->vc_rwlockid);
if (((vnode_t *)avc)->v_type == VREG && AFS_VN_MAPPED(((vnode_t *)avc)))
remapf(((vnode_t *)avc), 0, 0);
- PTOSSVP((struct vnode *)avc, (off_t)0, (off_t)MAXLONG);
+ PTOSSVP(AFSTOV(avc), (off_t)0, (off_t)MAXLONG);
AFS_GLOCK();
ObtainWriteLock(&avc->lock,62);
}
/* Write out dirty pages list to avoid B_DELWRI buffers. */
while (VN_GET_DPAGES((vnode_t*)avc)) {
- pdflush((struct vnode*)avc, 0);
+ pdflush(AFSTOV(avc), 0);
}
- PFLUSHVP((struct vnode *)avc, (off_t)avc->m.Length, (off_t)0, error);
+ PFLUSHVP(AFSTOV(avc), (off_t)avc->m.Length, (off_t)0, error);
AFS_GLOCK();
if (error) {
/*
#include <afsconfig.h>
#include "../afs/param.h"
-RCSID("$Header: /tmp/cvstemp/openafs/src/afs/IRIX/osi_vnodeops.c,v 1.1.1.8 2002/01/22 19:48:10 hartmans Exp $");
+RCSID("$Header: /tmp/cvstemp/openafs/src/afs/IRIX/osi_vnodeops.c,v 1.1.1.9 2002/05/10 23:44:01 hartmans Exp $");
#ifdef AFS_SGI62_ENV
#include "../afs/sysincludes.h" /* Standard vendor system headers */
struct cred *cr)
#endif
{
- register struct vnode *vp = (struct vnode *)avc;
+ register struct vnode *vp = AFSTOV(avc);
struct buf *bp;
daddr_t bn;
size_t acnt, cnt;
struct cred *cr;
{
OSI_VC_CONVERT(avc)
- struct vnode *vp = (struct vnode*)avc;
+ struct vnode *vp = AFSTOV(avc);
if (vp->v_flag & VNOMAP)
return ENOSYS;
struct cred *acred;
{
OSI_VC_CONVERT(avc)
- struct vnode *vp = (struct vnode*)avc;
+ struct vnode *vp = AFSTOV(avc);
register struct brequest *tb;
struct vrequest treq;
afs_int32 code;
#endif
{
OSI_VC_CONVERT(avc)
- struct vnode *vp = (struct vnode*)avc;
+ struct vnode *vp = AFSTOV(avc);
struct vrequest treq;
int error;
void afs_rwlock(OSI_VN_DECL(vp), AFS_RWLOCK_T flag)
{
OSI_VN_CONVERT(vp)
- struct vcache *avc = (struct vcache *)vp;
+ struct vcache *avc = VTOAFS(vp);
if (OSI_GET_LOCKID() == avc->vc_rwlockid) {
avc->vc_locktrips++;
void afs_rwunlock(OSI_VN_DECL(vp), AFS_RWLOCK_T flag)
{
OSI_VN_CONVERT(vp)
- struct vcache *avc = (struct vcache *)vp;
+ struct vcache *avc = VTOAFS(vp);
AFS_ASSERT_GLOCK();
osi_Assert(OSI_GET_LOCKID() == avc->vc_rwlockid);
*/
int afs_rwlock_nowait(vnode_t *vp, AFS_RWLOCK_T flag)
{
- struct vcache *avc = (struct vcache *)vp;
+ struct vcache *avc = VTOAFS(vp);
AFS_ASSERT_GLOCK();
if (OSI_GET_LOCKID() == avc->vc_rwlockid) {
#include <afsconfig.h>
#include "../afs/param.h"
-RCSID("$Header: /tmp/cvstemp/openafs/src/afs/LINUX/osi_alloc.c,v 1.1.1.9 2002/01/22 19:48:11 hartmans Exp $");
+RCSID("$Header: /tmp/cvstemp/openafs/src/afs/LINUX/osi_alloc.c,v 1.1.1.10 2002/05/10 23:44:02 hartmans Exp $");
#include "../afs/sysincludes.h"
#include "../afs/afsincludes.h"
int memtype;
memtype = MEMTYPE(lmp->chunk);
+#ifdef AFS_SPARC64_LINUX24_ENV
+ if ((memtype == KM_TYPE) && (!VALID_PAGE(virt_to_page(lmp->chunk)))) {
+ printf("osi_linux_verify_alloced_memory: address 0x%x outside range, index=%d, key=%d\n", lmp->chunk, index, key);
+ }
+#else
if ((memtype == KM_TYPE) && (AFS_LINUX_MAP_NR(lmp->chunk) > max_mapnr)) {
printf("osi_linux_verify_alloced_memory: address 0x%x outside range, index=%d, key=%d\n", lmp->chunk, index, key);
}
+#endif
if (memtype != KM_TYPE && memtype != VM_TYPE) {
printf("osi_linux_verify_alloced_memory: unknown type %d at 0x%x, index=%d\n", memtype, lmp->chunk, index);
allocator_init = 1; /* initialization complete */
}
+ up(&afs_linux_alloc_sem);
new = linux_alloc(asize); /* get a chunk of memory of size asize */
+ down(&afs_linux_alloc_sem);
if (!new) {
printf("afs_osi_Alloc: Can't vmalloc %d bytes.\n", asize);
goto error;
return MEMADDR(new);
free_error:
- if (new)
- linux_free(new);
+ if (new) {
+ up(&afs_linux_alloc_sem);
+ linux_free(new);
+ down(&afs_linux_alloc_sem);
+ }
new = NULL;
goto error;
#include <afsconfig.h>
#include "../afs/param.h"
-RCSID("$Header: /tmp/cvstemp/openafs/src/afs/LINUX/osi_groups.c,v 1.1.1.8 2001/09/11 14:25:04 hartmans Exp $");
+RCSID("$Header: /tmp/cvstemp/openafs/src/afs/LINUX/osi_groups.c,v 1.1.1.9 2002/05/10 23:44:03 hartmans Exp $");
#include "../afs/sysincludes.h"
#include "../afs/afsincludes.h"
return code;
}
#endif
+
#if defined(AFS_SPARC64_LINUX20_ENV)
+/* Intercept the uid16 system call as used by 32bit programs. */
+extern int (*sys32_setgroupsp)(int gidsetsize, __kernel_gid_t32 *grouplist);
asmlinkage int afs32_xsetgroups(int gidsetsize, __kernel_gid_t32 *grouplist)
{
- gid_t gl[NGROUPS];
- int ret, i;
- mm_segment_t old_fs = get_fs ();
-
- if ((unsigned) gidsetsize > NGROUPS)
- return -EINVAL;
- for (i = 0; i < gidsetsize; i++, grouplist++)
- if (__get_user (gl[i], grouplist))
- return -EFAULT;
- set_fs (KERNEL_DS);
- ret = afs_xsetgroups(gidsetsize, gl);
- set_fs (old_fs);
- return ret;
+ int code;
+ cred_t *cr = crref();
+ afs_uint32 junk;
+ int old_pag;
+
+ lock_kernel();
+ old_pag = PagInCred(cr);
+ crfree(cr);
+ unlock_kernel();
+
+ code = (*sys32_setgroupsp)(gidsetsize, grouplist);
+ if (code) {
+ return code;
+ }
+
+ lock_kernel();
+ cr = crref();
+ if (old_pag != NOPAG && PagInCred(cr) == NOPAG) {
+ /* re-install old pag if there's room. */
+ code = setpag(&cr, old_pag, &junk, 0);
+ }
+ crfree(cr);
+ unlock_kernel();
+
+ return code;
}
#ifdef AFS_LINUX24_ENV
+/* Intercept the uid32 system call as used by 32bit programs. */
+extern int (*sys32_setgroups32p)(int gidsetsize, __kernel_gid_t32 *grouplist);
asmlinkage int afs32_xsetgroups32(int gidsetsize, __kernel_gid_t32 *grouplist)
{
- gid_t gl[NGROUPS];
- int ret, i;
- mm_segment_t old_fs = get_fs ();
-
- if ((unsigned) gidsetsize > NGROUPS)
- return -EINVAL;
- for (i = 0; i < gidsetsize; i++, grouplist++)
- if (__get_user (gl[i], grouplist))
- return -EFAULT;
- set_fs (KERNEL_DS);
- ret = afs_xsetgroups32(gidsetsize, gl);
- set_fs (old_fs);
- return ret;
+ int code;
+ cred_t *cr = crref();
+ afs_uint32 junk;
+ int old_pag;
+
+ lock_kernel();
+ old_pag = PagInCred(cr);
+ crfree(cr);
+ unlock_kernel();
+
+ code = (*sys32_setgroups32p)(gidsetsize, grouplist);
+ if (code) {
+ return code;
+ }
+
+ lock_kernel();
+ cr = crref();
+ if (old_pag != NOPAG && PagInCred(cr) == NOPAG) {
+ /* re-install old pag if there's room. */
+ code = setpag(&cr, old_pag, &junk, 0);
+ }
+ crfree(cr);
+ unlock_kernel();
+
+ return code;
}
#endif
#endif
#include <afsconfig.h>
#include "../afs/param.h"
-RCSID("$Header: /tmp/cvstemp/openafs/src/afs/LINUX/osi_vfsops.c,v 1.1.1.11 2002/01/30 14:01:28 hartmans Exp $");
+RCSID("$Header: /tmp/cvstemp/openafs/src/afs/LINUX/osi_vfsops.c,v 1.1.1.12 2002/05/10 23:44:09 hartmans Exp $");
#include "../afs/sysincludes.h"
#include "../afs/afsincludes.h"
#endif
/* "/afs" is a directory, reset inode ops accordingly. */
- tvp->v.v_op = &afs_dir_iops;
+ AFSTOV(tvp)->v_op = &afs_dir_iops;
#if defined(AFS_LINUX24_ENV)
- tvp->v.v_fop = &afs_dir_fops;
+ AFSTOV(tvp)->v_fop = &afs_dir_fops;
#endif
/* setup super_block and mount point inode. */
afs_globalVp = tvp;
#if defined(AFS_LINUX24_ENV)
- afsp->s_root = d_alloc_root((struct inode*)&tvp->v);
+ afsp->s_root = d_alloc_root(AFSTOI(tvp));
#else
- afsp->s_root = d_alloc_root((struct inode*)tvp, NULL);
+ afsp->s_root = d_alloc_root(AFSTOI(tvp), NULL);
#endif
afsp->s_root->d_op = &afs_dentry_operations;
} else
VATTR_NULL(&vattr);
iattr2vattr(&vattr, iattrp); /* Convert for AFS vnodeops call. */
update_inode_cache(ip, &vattr);
- code = afs_setattr((struct vcache*)ip, &vattr, credp);
- afs_CopyOutAttrs((struct vcache*)ip, &vattr);
+ code = afs_setattr(ITOAFS(ip), &vattr, credp);
+ afs_CopyOutAttrs(ITOAFS(ip), &vattr);
/* Note that the inode may still not have all the correct info. But at
* least we've got the newest version of what was supposed to be set.
*/
void afs_delete_inode(struct inode *ip)
{
- struct vcache *vc = (struct vcache*)ip;
+ struct vcache *vc = ITOAFS(ip);
AFS_GLOCK();
osi_clear_inode(ip);
#include <afsconfig.h>
#include "../afs/param.h"
-RCSID("$Header: /tmp/cvstemp/openafs/src/afs/LINUX/osi_vm.c,v 1.1.1.8 2002/01/30 14:01:29 hartmans Exp $");
+RCSID("$Header: /tmp/cvstemp/openafs/src/afs/LINUX/osi_vm.c,v 1.1.1.9 2002/05/10 23:44:09 hartmans Exp $");
#include "../afs/sysincludes.h" /* Standard vendor system headers */
#include "../afs/afsincludes.h" /* Afs-based standard headers */
*/
int osi_VM_FlushVCache(struct vcache *avc, int *slept)
{
- struct inode *ip = (struct inode*)avc;
+ struct inode *ip = AFSTOI(avc);
if (VREFCOUNT(avc) != 0)
return EBUSY;
*/
void osi_VM_TryToSmush(struct vcache *avc, struct AFS_UCRED *acred, int sync)
{
- invalidate_inode_pages((struct inode *)avc);
+ invalidate_inode_pages(AFSTOI(avc));
}
/* Flush and invalidate pages, for fsync() with INVAL flag
*/
void osi_VM_StoreAllSegments(struct vcache *avc)
{
- struct inode *ip = (struct inode *) avc;
+ struct inode *ip = AFSTOI(avc);
#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,4,5)
/* filemap_fdatasync() only exported in 2.4.5 and above */
void osi_VM_FlushPages(struct vcache *avc, struct AFS_UCRED *credp)
{
#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,4,0)
- struct inode *ip = (struct inode*)avc;
+ struct inode *ip = AFSTOI(avc);
truncate_inode_pages(&ip->i_data, 0);
#elif LINUX_VERSION_CODE >= KERNEL_VERSION(2,2,15)
- struct inode *ip = (struct inode*)avc;
+ struct inode *ip = AFSTOI(avc);
truncate_inode_pages(ip, 0);
#else
- invalidate_inode_pages((struct inode*)avc);
+ invalidate_inode_pages(AFSTOI(avc));
#endif
}
void osi_VM_Truncate(struct vcache *avc, int alen, struct AFS_UCRED *acred)
{
#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,4,0)
- struct inode *ip = (struct inode*)avc;
+ struct inode *ip = AFSTOI(avc);
truncate_inode_pages(&ip->i_data, alen);
#elif LINUX_VERSION_CODE >= KERNEL_VERSION(2,2,15)
- struct inode *ip = (struct inode*)avc;
+ struct inode *ip = AFSTOI(avc);
truncate_inode_pages(ip, alen);
#else
- invalidate_inode_pages((struct inode*)avc);
+ invalidate_inode_pages(AFSTOI(avc));
#endif
}
#include <afsconfig.h>
#include "../afs/param.h"
-RCSID("$Header: /tmp/cvstemp/openafs/src/afs/SOLARIS/osi_groups.c,v 1.1.1.4 2001/07/14 22:19:48 hartmans Exp $");
+RCSID("$Header: /tmp/cvstemp/openafs/src/afs/SOLARIS/osi_groups.c,v 1.1.1.5 2002/05/10 23:44:11 hartmans Exp $");
#include "../afs/sysincludes.h"
#include "../afs/afsincludes.h"
AFS_STATCNT(setpag);
gidset = (gid_t *) osi_AllocSmallSpace(AFS_SMALLOCSIZ);
+
+ mutex_enter(&curproc->p_crlock);
ngroups = afs_getgroups(*cred, gidset);
if (afs_get_pag_from_groups(gidset[0], gidset[1]) == NOPAG) {
}
*newpag = (pagvalue == -1 ? genpag(): pagvalue);
afs_get_groups_from_pag(*newpag, &gidset[0], &gidset[1]);
+ /* afs_setgroups will release curproc->p_crlock */
if (code = afs_setgroups(cred, ngroups, gidset, change_parent)) {
osi_FreeSmallSpace((char *)gidset);
return (code);
AFS_STATCNT(afs_setgroups);
- if (ngroups > ngroups_max)
+ if (ngroups > ngroups_max) {
+ mutex_exit(&curproc->p_crlock);
return EINVAL;
+ }
if (!change_parent)
*cred = (struct cred *)crcopy(*cred);
(*cred)->cr_ngroups = ngroups;
gp = (*cred)->cr_groups;
while (ngroups--)
*gp++ = *gidset++;
- if (!change_parent) {
- struct proc *proc = ttoproc(curthread);
- crset(proc, *cred); /* broadcast to all threads */
- }
+ mutex_exit(&curproc->p_crlock);
+ if (!change_parent)
+ crset(curproc, *cred); /* broadcast to all threads */
return (0);
}
#include <afsconfig.h>
#include "../afs/param.h"
-RCSID("$Header: /tmp/cvstemp/openafs/src/afs/SOLARIS/osi_inode.c,v 1.1.1.7 2001/07/14 22:19:50 hartmans Exp $");
+RCSID("$Header: /tmp/cvstemp/openafs/src/afs/SOLARIS/osi_inode.c,v 1.1.1.8 2002/05/10 23:44:12 hartmans Exp $");
#include "../afs/sysincludes.h" /* Standard vendor system headers */
#include "../afs/afsincludes.h" /* Afs-based standard headers */
if (ip->i_mode == 0) {
/* Not an allocated inode */
- AFS_ITIMES(ip);
rw_exit(&ip->i_contents);
VN_RELE(ITOV(ip));
return (ENOENT);
#undef afs_osi_Alloc_NoSleep
extern void *afs_osi_Alloc_NoSleep(size_t size);
-#define osi_vnhold(avc, r) do { VN_HOLD((struct vnode *)(avc)); } while(0)
+#define osi_vnhold(avc, r) do { VN_HOLD(AFSTOV(avc)); } while(0)
#define gop_rdwr(rw,gp,base,len,offset,segflg,ioflag,ulimit,cr,aresid) \
vn_rdwr((rw),(gp),(base),(len),(offset),(segflg),(ioflag),(ulimit),(cr),(aresid))
#include <afsconfig.h>
#include "../afs/param.h"
-RCSID("$Header: /tmp/cvstemp/openafs/src/afs/SOLARIS/osi_vfsops.c,v 1.1.1.9 2001/10/14 17:59:10 hartmans Exp $");
+RCSID("$Header: /tmp/cvstemp/openafs/src/afs/SOLARIS/osi_vfsops.c,v 1.1.1.10 2002/05/10 23:44:13 hartmans Exp $");
#include "../afs/sysincludes.h" /* Standard vendor system headers */
#include "../afs/afsincludes.h" /* Afs-based standard headers */
AFS_STATCNT(afs_mount);
- if (!suser(credp))
+ if (!suser(credp)) {
+ AFS_GUNLOCK();
return EPERM;
+ }
afsp->vfs_fstype = afsfstype;
if (afs_globalVFS) { /* Don't allow remounts. */
+ AFS_GUNLOCK();
return EBUSY;
}
AFS_GLOCK();
AFS_STATCNT(afs_unmount);
- if (!suser(credp))
+ if (!suser(credp)) {
+ AFS_GUNLOCK();
return EPERM;
+ }
afs_globalVFS = 0;
afs_shutdown();
}
}
if (tvp) {
- VN_HOLD((struct vnode *)tvp);
- mutex_enter(&(((struct vnode*)tvp)->v_lock));
- tvp->v.v_flag |= VROOT;
- mutex_exit(&(((struct vnode*)tvp)->v_lock));
+ VN_HOLD(AFSTOV(tvp));
+ mutex_enter(&AFSTOV(tvp)->v_lock);
+ AFSTOV(tvp)->v_flag |= VROOT;
+ mutex_exit(&AFSTOV(tvp)->v_lock);
afs_globalVFS = afsp;
- *avpp = (struct vnode *) tvp;
+ *avpp = AFSTOV(tvp);
}
afs_Trace2(afs_iclSetp, CM_TRACE_VFSROOT, ICL_TYPE_POINTER, *avpp,
int (*ufs_igetp)();
void (*ufs_itimes_nolockp)();
+int (*afs_orig_ioctl)(), (*afs_orig_ioctl32)();
+int (*afs_orig_setgroups)(), (*afs_orig_setgroups32)();
+
struct streamtab *udp_infop = 0;
struct ill_s *ill_g_headp = 0;
afsinit(struct vfssw *vfsswp, int fstype)
{
- extern int afs_xioctl(), afs_xflock();
+ extern int afs_xioctl();
extern int afs_xsetgroups();
AFS_STATCNT(afsinit);
+ afs_orig_setgroups = sysent[SYS_setgroups].sy_callc;
+ afs_orig_ioctl = sysent[SYS_ioctl].sy_call;
sysent[SYS_setgroups].sy_callc = afs_xsetgroups;
sysent[SYS_ioctl].sy_call = afs_xioctl;
#if defined(AFS_SUN57_64BIT_ENV)
+ afs_orig_setgroups32 = sysent32[SYS_setgroups].sy_callc;
+ afs_orig_ioctl32 = sysent32[SYS_ioctl].sy_call;
sysent32[SYS_setgroups].sy_callc = afs_xsetgroups;
sysent32[SYS_ioctl].sy_call = afs_xioctl;
#endif
extern struct bind *sb_hashtab[];
struct modctl *mp = 0;
+ if (afs_sinited)
+ return EBUSY;
+
if ((!(mp = mod_find_by_filename("fs", "ufs")) &&
!(mp = mod_find_by_filename(NULL, "/kernel/fs/ufs")) &&
!(mp = mod_find_by_filename(NULL, "sys/ufs"))) ||
{
int code;
- if (afs_sinited)
- return (EBUSY);
+ if (afs_globalVFS)
+ return EBUSY;
+
+ if (afs_sinited) {
+ sysent[SYS_setgroups].sy_callc = afs_orig_setgroups;
+ sysent[SYS_ioctl].sy_call = afs_orig_ioctl;
+#if defined(AFS_SUN57_64BIT_ENV)
+ sysent32[SYS_setgroups].sy_callc = afs_orig_setgroups32;
+ sysent32[SYS_ioctl].sy_call = afs_orig_ioctl32;
+#endif
+ }
code = mod_remove(&afs_modlinkage);
return code;
}
#include <afsconfig.h>
#include "../afs/param.h"
-RCSID("$Header: /tmp/cvstemp/openafs/src/afs/SOLARIS/osi_vm.c,v 1.1.1.4 2001/07/14 22:19:50 hartmans Exp $");
+RCSID("$Header: /tmp/cvstemp/openafs/src/afs/SOLARIS/osi_vm.c,v 1.1.1.5 2002/05/10 23:44:14 hartmans Exp $");
#include "../afs/sysincludes.h" /* Standard vendor system headers */
#include "../afs/afsincludes.h" /* Afs-based standard headers */
int code;
AFS_GUNLOCK();
- code = afs_putpage((struct vnode *)avc,
+ code = afs_putpage(AFSTOV(avc),
(offset_t) AFS_CHUNKTOBASE(adc->f.chunk),
AFS_CHUNKTOSIZE(adc->f.chunk),
B_INVAL, CRED());
return EBUSY;
AFS_GUNLOCK();
- pvn_vplist_dirty((struct vnode *)avc, 0, NULL, B_TRUNC|B_INVAL, CRED());
+ pvn_vplist_dirty(AFSTOV(avc), 0, NULL, B_TRUNC|B_INVAL, CRED());
AFS_GLOCK();
/* Might as well make the obvious check */
- if (((struct vnode *)avc)->v_pages)
+ if (AFSTOV(avc)->v_pages)
return EBUSY; /* should be all gone still */
rw_destroy(&avc->rwlock);
{
AFS_GUNLOCK();
#if defined(AFS_SUN56_ENV)
- (void) pvn_vplist_dirty((struct vnode *)avc, (u_offset_t)0, afs_putapage,
+ (void) pvn_vplist_dirty(AFSTOV(avc), (u_offset_t)0, afs_putapage,
0, CRED());
#else
- (void) pvn_vplist_dirty((struct vnode *)avc, 0, afs_putapage, 0, CRED());
+ (void) pvn_vplist_dirty(AFSTOV(avc), 0, afs_putapage, 0, CRED());
#endif
AFS_GLOCK();
}
{
AFS_GUNLOCK();
#if defined(AFS_SUN56_ENV)
- (void) pvn_vplist_dirty((struct vnode *)avc, (u_offset_t)0, afs_putapage,
+ (void) pvn_vplist_dirty(AFSTOV(avc), (u_offset_t)0, afs_putapage,
(sync ? B_INVAL : B_FREE), acred);
#else
- (void) pvn_vplist_dirty((struct vnode *)avc, 0, afs_putapage,
+ (void) pvn_vplist_dirty(AFSTOV(avc), 0, afs_putapage,
(sync ? B_INVAL : B_FREE), acred);
#endif
AFS_GLOCK();
extern int afs_pvn_vptrunc;
afs_pvn_vptrunc++;
- (void) afs_putpage((struct vnode *)avc, (offset_t)0, 0,
+ (void) afs_putpage(AFSTOV(avc), (offset_t)0, 0,
B_TRUNC|B_INVAL, credp);
}
ReleaseWriteLock(&avc->lock);
AFS_GUNLOCK();
- pp = page_lookup((struct vnode *)avc, alen - pageOffset, SE_EXCL);
+ pp = page_lookup(AFSTOV(avc), alen - pageOffset, SE_EXCL);
if (pp) {
pagezero(pp, pageOffset, PAGESIZE - pageOffset);
page_unlock(pp);
* It's OK to specify afs_putapage here, even though we aren't holding
* the vcache entry lock, because it isn't going to get called.
*/
- pvn_vplist_dirty((struct vnode *)avc, alen, afs_putapage, B_TRUNC|B_INVAL,
+ pvn_vplist_dirty(AFSTOV(avc), alen, afs_putapage, B_TRUNC|B_INVAL,
acred);
}
#include <afsconfig.h>
#include "../afs/param.h"
-RCSID("$Header: /tmp/cvstemp/openafs/src/afs/SOLARIS/osi_vnodeops.c,v 1.1.1.8 2001/10/14 17:59:10 hartmans Exp $");
+RCSID("$Header: /tmp/cvstemp/openafs/src/afs/SOLARIS/osi_vnodeops.c,v 1.1.1.9 2002/05/10 23:44:14 hartmans Exp $");
#if defined(AFS_SUN_ENV) || defined(AFS_SUN5_ENV)
/*
{
register int code;
- if (!RW_READ_HELD(&((struct vcache *)avp)->rwlock))
+ if (!RW_READ_HELD(&(VTOAFS(avp))->rwlock))
osi_Panic("afs_vmread: !rwlock");
AFS_GLOCK();
- code = afs_nfsrdwr((struct vcache *)avp, auio, UIO_READ, ioflag, acred);
+ code = afs_nfsrdwr(VTOAFS(avp), auio, UIO_READ, ioflag, acred);
AFS_GUNLOCK();
return code;
}
{
register int code;
- if (!RW_WRITE_HELD(&((struct vcache *)avp)->rwlock))
+ if (!RW_WRITE_HELD(&(VTOAFS(avp))->rwlock))
osi_Panic("afs_vmwrite: !rwlock");
AFS_GLOCK();
- code = afs_nfsrdwr((struct vcache *)avp, auio, UIO_WRITE, ioflag, acred);
+ code = afs_nfsrdwr(VTOAFS(avp), auio, UIO_WRITE, ioflag, acred);
AFS_GUNLOCK();
return code;
}
#if defined(AFS_SUN56_ENV)
if (len <= PAGESIZE)
- code = afs_GetOnePage((struct vnode *) vp, toff, len, protp, pl, plsz,
+ code = afs_GetOnePage(vp, toff, len, protp, pl, plsz,
seg, addr, rw, acred);
#else
#ifdef AFS_SUN5_ENV
#endif
#endif
else {
- struct vcache *vcp = (struct vcache *)vp;
+ struct vcache *vcp = VTOAFS(vp);
#ifdef AFS_SUN5_ENV
ObtainWriteLock(&vcp->vlock, 548);
vcp->multiPage++;
#endif
afs_BozonLock(&vcp->pvnLock, vcp);
#if defined(AFS_SUN56_ENV)
- code = pvn_getpages(afs_GetOnePage, (struct vnode *) vp, toff,
+ code = pvn_getpages(afs_GetOnePage, vp, toff,
len, protp, pl, plsz, seg, addr, rw, acred);
#else
- code = pvn_getpages(afs_GetOnePage, (struct vnode *) vp, (u_int)off,
+ code = pvn_getpages(afs_GetOnePage, vp, (u_int)off,
len, protp, pl, plsz, seg, addr, rw, acred);
#endif
afs_BozonUnlock(&vcp->pvnLock, vcp);
acred = u.u_cred; /* better than nothing */
#endif
- avc = (struct vcache *) vp; /* cast to afs vnode */
+ avc = VTOAFS(vp); /* cast to afs vnode */
#ifdef AFS_SUN5_ENV
if (avc->credp /*&& AFS_NFSXLATORREQ(acred)*/ && AFS_NFSXLATORREQ(avc->credp)) {
afs_Trace4(afs_iclSetp, CM_TRACE_PAGEOUT, ICL_TYPE_POINTER, (afs_int32) vp,
ICL_TYPE_LONG, (afs_int32) off, ICL_TYPE_LONG, (afs_int32) len,
ICL_TYPE_LONG, (int) flags);
- avc = (struct vcache *) vp;
+ avc = VTOAFS(vp);
afs_BozonLock(&avc->pvnLock, avc);
ObtainWriteLock(&avc->lock,247);
int flags, struct AFS_UCRED *credp)
{
struct buf *tbuf;
- struct vcache *avc = (struct vcache *)vp;
+ struct vcache *avc = VTOAFS(vp);
afs_int32 code = 0;
u_int toff, tlen = PAGESIZE, off = (pages->p_offset/PAGESIZE)*PAGESIZE;
u_int poff = pages->p_offset;
AFS_STATCNT(afs_putpage);
wholeEnchilada = (off == 0 && len == 0 && (flags & (B_INVAL|B_ASYNC)) == B_INVAL);
- avc = (struct vcache *) vp;
+ avc = VTOAFS(vp);
afs_BozonLock(&avc->pvnLock, avc);
ObtainWriteLock(&avc->lock,248);
ReleaseWriteLock(&avc->lock); /* uiomove may page fault */
AFS_GUNLOCK();
#if defined(AFS_SUN56_ENV)
- data = segmap_getmap(segkmap,(struct vnode *)avc,(u_offset_t)pageBase);
+ data = segmap_getmap(segkmap,AFSTOV(avc),(u_offset_t)pageBase);
#else
- data = segmap_getmap(segkmap, (struct vnode *) avc, pageBase);
+ data = segmap_getmap(segkmap, AFSTOV(avc), pageBase);
#endif
#ifndef AFS_SUN5_ENV
code = as_fault(&kas, data+pageOffset, tsize, F_SOFTLOCK, mode);
struct segvn_crargs crargs;
register afs_int32 code;
struct vrequest treq;
- register struct vcache *avc = (struct vcache *) vp;
+ register struct vcache *avc = VTOAFS(vp);
AFS_STATCNT(afs_map);
} else
(void) as_unmap(as, *addr, len); /* unmap old address space use */
/* setup the create parameter block for the call */
- crargs.vp = (struct vnode *) avc;
+ crargs.vp = AFSTOV(avc);
crargs.offset = (u_int)off;
crargs.cred = cred;
crargs.type = flags&MAP_TYPE;
struct vnode *vnp;
int wlock;
{
- rw_enter(&((struct vcache *)vnp)->rwlock, (wlock ? RW_WRITER : RW_READER));
+ rw_enter(&(VTOAFS(vnp))->rwlock, (wlock ? RW_WRITER : RW_READER));
}
struct vnode *vnp;
int wlock;
{
- rw_exit(&((struct vcache *)vnp)->rwlock);
+ rw_exit(&(VTOAFS(vnp))->rwlock);
}
AFS_GLOCK();
}
- code = afs_lockctl((struct vcache *)vnp, ap, cmd, credp);
+ code = afs_lockctl(VTOAFS(vnp), ap, cmd, credp);
AFS_GUNLOCK();
return code;
}
if (!ap->l_len) {
vattr.va_mask = AT_SIZE;
vattr.va_size = ap->l_start;
- code = afs_setattr((struct vcache *)vnp, &vattr, 0, credp);
+ code = afs_setattr(VTOAFS(vnp), &vattr, 0, credp);
}
AFS_GUNLOCK();
}
void afs_inactive(struct vcache *avc, struct AFS_UCRED *acred)
{
- struct vnode *vp = (struct vnode *)avc;
+ struct vnode *vp = AFSTOV(avc);
if (afs_shuttingdown) return ;
/*
#include <afsconfig.h>
#include "../afs/param.h"
-RCSID("$Header: /tmp/cvstemp/openafs/src/afs/UKERNEL/afs_usrops.c,v 1.1.1.7 2001/09/11 14:25:10 hartmans Exp $");
+RCSID("$Header: /tmp/cvstemp/openafs/src/afs/UKERNEL/afs_usrops.c,v 1.1.1.8 2002/05/10 23:44:15 hartmans Exp $");
#ifdef UKERNEL
return -1;
}
- avc = (struct vcache *) vp;
+ avc = VTOAFS(vp);
r = avc->mvstat;
VN_RELE(vp);
#define afs_hz HZ
#define osi_Time() (time(NULL))
-#define osi_vnhold(avc, r) do { VN_HOLD((struct vnode *)(avc)); } while(0)
+#define osi_vnhold(avc, r) do { VN_HOLD(AFSTOV(avc)); } while(0)
#define afs_suser suser
/*
#include <afsconfig.h>
#include "../afs/param.h"
-RCSID("$Header: /tmp/cvstemp/openafs/src/afs/UKERNEL/osi_vfsops.c,v 1.1.1.5 2001/07/14 22:19:53 hartmans Exp $");
+RCSID("$Header: /tmp/cvstemp/openafs/src/afs/UKERNEL/osi_vfsops.c,v 1.1.1.6 2002/05/10 23:44:18 hartmans Exp $");
#include "../afs/sysincludes.h" /* Standard vendor system headers */
#include "../afs/afsincludes.h" /* Afs-based standard headers */
}
}
if (tvp) {
- VN_HOLD((struct vnode *)tvp);
+ VN_HOLD(AFSTOV(tvp));
- tvp->v.v_flag |= VROOT; /* No-op on Ultrix 2.2 */
+ AFSTOV(tvp)->v_flag |= VROOT; /* No-op on Ultrix 2.2 */
afs_globalVFS = afsp;
- *avpp = (struct vnode *) tvp;
+ *avpp = AFSTOV(tvp);
}
afs_Trace3(afs_iclSetp, CM_TRACE_GOPEN, ICL_TYPE_POINTER, *avpp,
#include <afsconfig.h>
#include "../afs/param.h"
-RCSID("$Header: /tmp/cvstemp/openafs/src/afs/UKERNEL/osi_vnodeops.c,v 1.1.1.4 2001/07/14 22:19:51 hartmans Exp $");
+RCSID("$Header: /tmp/cvstemp/openafs/src/afs/UKERNEL/osi_vnodeops.c,v 1.1.1.5 2002/05/10 23:44:19 hartmans Exp $");
#include "../afs/sysincludes.h" /* Standard vendor system headers */
#include "../afs/afsincludes.h" /* Afs-based standard headers */
int afs_inactive(struct vcache *avc, struct AFS_UCRED *acred)
{
- struct vnode *vp = (struct vnode *)avc;
+ struct vnode *vp = AFSTOV(avc);
if (afs_shuttingdown) return ;
usr_assert(avc->vrefCount == 0);
#include <afsconfig.h>
#include "../afs/param.h"
-RCSID("$Header: /tmp/cvstemp/openafs/src/afs/VNOPS/afs_vnop_attrs.c,v 1.1.1.7 2001/07/14 22:19:53 hartmans Exp $");
+RCSID("$Header: /tmp/cvstemp/openafs/src/afs/VNOPS/afs_vnop_attrs.c,v 1.1.1.8 2002/05/10 23:44:19 hartmans Exp $");
#include "../afs/sysincludes.h" /* Standard vendor system headers */
#include "../afs/afsincludes.h" /* Afs-based standard headers */
#ifdef AFS_LINUX22_ENV
/* And linux has it's own stash as well. */
- vattr2inode((struct inode*)avc, attrs);
+ vattr2inode(AFSTOV(avc), attrs);
#endif
return 0;
}
attrs->va_nodeid = ip->i_ino;
}
#else
- if (avc->v.v_flag & VROOT) {
- struct vnode *vp = (struct vnode *)avc;
+ if (AFSTOV(avc)->v_flag & VROOT) {
+ struct vnode *vp = AFSTOV(avc);
vp = vp->v_vfsp->vfs_vnodecovered;
if (vp) { /* Ignore weird failures */
#include <afsconfig.h>
#include "../afs/param.h"
-RCSID("$Header: /tmp/cvstemp/openafs/src/afs/VNOPS/afs_vnop_create.c,v 1.1.1.6 2001/07/14 22:19:54 hartmans Exp $");
+RCSID("$Header: /tmp/cvstemp/openafs/src/afs/VNOPS/afs_vnop_create.c,v 1.1.1.7 2002/05/10 23:44:20 hartmans Exp $");
#include "../afs/sysincludes.h" /* Standard vendor system headers */
#include "../afs/afsincludes.h" /* Afs-based standard headers */
afs_create(ndp, attrs)
struct nameidata *ndp;
struct vattr *attrs; {
- register struct vcache *adp = (struct vcache *)ndp->ni_dvp;
+ register struct vcache *adp = VTOAFS(ndp->ni_dvp);
char *aname = ndp->ni_dent.d_name;
enum vcexcl aexcl = NONEXCL; /* XXX - create called properly */
int amode = 0; /* XXX - checked in higher level */
AFS_STATCNT(afs_create);
- if (code = afs_InitReq(&treq, acred)) return code;
+ if (code = afs_InitReq(&treq, acred))
+ goto done2;
+
afs_Trace3(afs_iclSetp, CM_TRACE_CREATE, ICL_TYPE_POINTER, adp,
ICL_TYPE_STRING, aname, ICL_TYPE_INT32, amode);
* the reference count on it.
*/
if (*avcp) {
- AFS_RELE((struct vnode*)(*avcp));
+ AFS_RELE(AFSTOV(*avcp));
*avcp = NULL;
}
#endif
+ if (strlen(aname) > AFSNAMEMAX) {
+ code = ENAMETOOLONG;
+ goto done;
+ }
+
if (!afs_ENameOK(aname)) {
code = EINVAL;
goto done;
#ifdef AFS_OSF_ENV
if (!code && !strcmp(aname, "core"))
tvc->states |= CCore1;
+#endif
+
+ code = afs_CheckCode(code, &treq, 20);
+
+done2:
+#ifdef AFS_OSF_ENV
afs_PutVCache(adp, 0);
#endif /* AFS_OSF_ENV */
- code = afs_CheckCode(code, &treq, 20);
return code;
}
#include <afsconfig.h>
#include "../afs/param.h"
-RCSID("$Header: /tmp/cvstemp/openafs/src/afs/VNOPS/afs_vnop_dirops.c,v 1.1.1.4 2001/07/14 22:19:55 hartmans Exp $");
+RCSID("$Header: /tmp/cvstemp/openafs/src/afs/VNOPS/afs_vnop_dirops.c,v 1.1.1.5 2002/05/10 23:44:20 hartmans Exp $");
#include "../afs/sysincludes.h" /* Standard vendor system headers */
#include "../afs/afsincludes.h" /* Afs-based standard headers */
afs_mkdir(ndp, attrs)
struct nameidata *ndp;
struct vattr *attrs; {
- register struct vcache *adp = (struct vcache *)ndp->ni_dvp;
+ register struct vcache *adp = VTOAFS(ndp->ni_dvp);
char *aname = ndp->ni_dent.d_name;
register struct vcache **avcp = (struct vcache **)&(ndp->ni_vp);
struct ucred *acred = ndp->ni_cred;
afs_Trace2(afs_iclSetp, CM_TRACE_MKDIR, ICL_TYPE_POINTER, adp,
ICL_TYPE_STRING, aname);
- if (code = afs_InitReq(&treq, acred)) return code;
+ if (code = afs_InitReq(&treq, acred))
+ goto done2;
+
+ if (strlen(aname) > AFSNAMEMAX) {
+ code = ENAMETOOLONG;
+ goto done;
+ }
if (!afs_ENameOK(aname)) {
code = EINVAL;
}
else code = ENOENT;
done:
+ code = afs_CheckCode(code, &treq, 26);
+done2:
#ifdef AFS_OSF_ENV
AFS_RELE(ndp->ni_dvp);
#endif /* AFS_OSF_ENV */
- code = afs_CheckCode(code, &treq, 26);
return code;
}
#ifdef AFS_OSF_ENV
afs_rmdir(ndp)
struct nameidata *ndp; {
- register struct vcache *adp = (struct vcache *)ndp->ni_dvp;
+ register struct vcache *adp = VTOAFS(ndp->ni_dvp);
char *aname = ndp->ni_dent.d_name;
struct ucred *acred = ndp->ni_cred;
#else /* AFS_OSF_ENV */
afs_Trace2(afs_iclSetp, CM_TRACE_RMDIR, ICL_TYPE_POINTER, adp,
ICL_TYPE_STRING, aname);
- if (code = afs_InitReq(&treq, acred)) return code;
+ if (code = afs_InitReq(&treq, acred))
+ goto done2;
+
+ if (strlen(aname) > AFSNAMEMAX) {
+ code = ENAMETOOLONG;
+ goto done;
+ }
+
code = afs_VerifyVCache(adp, &treq);
if (code) goto done;
code = 0;
done:
+ code = afs_CheckCode(code, &treq, 27);
+done2:
#ifdef AFS_OSF_ENV
afs_PutVCache(adp, 0);
afs_PutVCache(ndp->ni_vp, 0);
#endif /* AFS_OSF_ENV */
- code = afs_CheckCode(code, &treq, 27);
return code;
}
#include <afsconfig.h>
#include "../afs/param.h"
-RCSID("$Header: /tmp/cvstemp/openafs/src/afs/VNOPS/afs_vnop_fid.c,v 1.1.1.6 2001/09/11 14:25:12 hartmans Exp $");
+RCSID("$Header: /tmp/cvstemp/openafs/src/afs/VNOPS/afs_vnop_fid.c,v 1.1.1.7 2002/05/10 23:44:21 hartmans Exp $");
#if !defined(AFS_DUX40_ENV) && !defined(AFS_LINUX20_ENV) && !defined(AFS_DARWIN_ENV)
#include "../afs/sysincludes.h" /* Standard vendor system headers */
addr[0] = (long)avc;
#ifndef AFS_AIX41_ENV
/* No post processing, so don't hold ref count. */
- VN_HOLD((struct vnode *)avc);
+ VN_HOLD(AFSTOV(avc));
#endif
}
#if defined(AFS_AIX_ENV) || defined(AFS_SUN54_ENV)
#include <afsconfig.h>
#include "../afs/param.h"
-RCSID("$Header: /tmp/cvstemp/openafs/src/afs/VNOPS/afs_vnop_flock.c,v 1.1.1.8 2001/10/14 17:59:12 hartmans Exp $");
+RCSID("$Header: /tmp/cvstemp/openafs/src/afs/VNOPS/afs_vnop_flock.c,v 1.1.1.9 2002/05/10 23:44:21 hartmans Exp $");
#include "../afs/sysincludes.h" /* Standard vendor system headers */
#include "../afs/afsincludes.h" /* Afs-based standard headers */
/* first determine whether this is any sort of vnode */
if (fd->f_type == DTYPE_VNODE) {
/* good, this is a vnode; next see if it is an AFS vnode */
- tvc = (struct vcache *) fd->f_data; /* valid, given a vnode */
- if (IsAfsVnode((struct vnode *)tvc)) {
+ tvc = VTOAFS(fd->f_data); /* valid, given a vnode */
+ if (IsAfsVnode(AFSTOV(tvc))) {
/* This is an AFS vnode, so do the work */
#ifdef AFS_DEC_ENV
/* find real vcache entry; shouldn't be null if gnode ref count
* is greater than 0.
*/
- tvc = (struct vcache *) afs_gntovn(tvc);
+ tvc = VTOAFS(afs_gntovn)(tvc);
if (!tvc) {
u.u_error = ENOENT;
return;
#include <afsconfig.h>
#include "../afs/param.h"
-RCSID("$Header: /tmp/cvstemp/openafs/src/afs/VNOPS/afs_vnop_link.c,v 1.1.1.4 2001/07/14 22:19:55 hartmans Exp $");
+RCSID("$Header: /tmp/cvstemp/openafs/src/afs/VNOPS/afs_vnop_link.c,v 1.1.1.5 2002/05/10 23:44:21 hartmans Exp $");
#include "../afs/sysincludes.h" /* Standard vendor system headers */
#include "../afs/afsincludes.h" /* Afs-based standard headers */
afs_link(avc, ndp)
register struct vcache *avc;
struct nameidata *ndp; {
- register struct vcache *adp = (struct vcache *)ndp->ni_dvp;
+ register struct vcache *adp = VTOAFS(ndp->ni_dvp);
char *aname = ndp->ni_dent.d_name;
struct ucred *acred = ndp->ni_cred;
#else /* AFS_OSF_ENV */
afs_Trace3(afs_iclSetp, CM_TRACE_LINK, ICL_TYPE_POINTER, adp,
ICL_TYPE_POINTER, avc, ICL_TYPE_STRING, aname);
/* create a hard link; new entry is aname in dir adp */
- if (code = afs_InitReq(&treq, acred)) return code;
+ if (code = afs_InitReq(&treq, acred))
+ goto done2;
+
if (avc->fid.Cell != adp->fid.Cell || avc->fid.Fid.Volume != adp->fid.Fid.Volume) {
code = EXDEV;
goto done;
}
+ if (strlen(aname) > AFSNAMEMAX) {
+ code = ENAMETOOLONG;
+ goto done;
+ }
code = afs_VerifyVCache(adp, &treq);
if (code) goto done;
ReleaseWriteLock(&avc->lock);
code = 0;
done:
+ code = afs_CheckCode(code, &treq, 24);
+done2:
#ifdef AFS_OSF_ENV
afs_PutVCache(adp, WRITE_LOCK);
#endif /* AFS_OSF_ENV */
- return afs_CheckCode(code, &treq);
+ return code;
}
#include <afsconfig.h>
#include "../afs/param.h"
-RCSID("$Header: /tmp/cvstemp/openafs/src/afs/VNOPS/afs_vnop_open.c,v 1.1.1.4 2001/07/14 22:19:56 hartmans Exp $");
+RCSID("$Header: /tmp/cvstemp/openafs/src/afs/VNOPS/afs_vnop_open.c,v 1.1.1.5 2002/05/10 23:44:23 hartmans Exp $");
#include "../afs/sysincludes.h" /* Standard vendor system headers */
#include "../afs/afsincludes.h" /* Afs-based standard headers */
if (code = afs_InitReq(&treq, acred)) return code;
#ifdef AFS_SGI64_ENV
/* avcpp can be, but is not necesarily, bhp's vnode. */
- tvc = (struct vcache *)BHV_TO_VNODE(bhv);
+ tvc = VTOAFS(BHV_TO_VNODE(bhv));
#else
tvc = *avcp;
#endif
#include <afsconfig.h>
#include "../afs/param.h"
-RCSID("$Header: /tmp/cvstemp/openafs/src/afs/VNOPS/afs_vnop_remove.c,v 1.1.1.6 2002/01/22 19:48:17 hartmans Exp $");
+RCSID("$Header: /tmp/cvstemp/openafs/src/afs/VNOPS/afs_vnop_remove.c,v 1.1.1.7 2002/05/10 23:44:24 hartmans Exp $");
#include "../afs/sysincludes.h" /* Standard vendor system headers */
#include "../afs/afsincludes.h" /* Afs-based standard headers */
#ifdef AFS_OSF_ENV
afs_remove(ndp)
struct nameidata *ndp; {
- register struct vcache *adp = (struct vcache *)ndp->ni_dvp;
+ register struct vcache *adp = VTOAFS(ndp->ni_dvp);
char *aname = ndp->ni_dent.d_name;
struct ucred *acred = ndp->ni_cred;
#else /* AFS_OSF_ENV */
afs_Trace2(afs_iclSetp, CM_TRACE_REMOVE, ICL_TYPE_POINTER, adp,
ICL_TYPE_STRING, aname);
+#ifdef AFS_OSF_ENV
+ tvc = (struct vcache *)ndp->ni_vp; /* should never be null */
+#endif
+
/* Check if this is dynroot */
- if (afs_IsDynroot(adp))
+ if (afs_IsDynroot(adp)) {
+#ifdef AFS_OSF_ENV
+ afs_PutVCache(adp, 0);
+ afs_PutVCache(tvc, 0);
+#endif
return afs_DynrootVOPRemove(adp, acred, aname);
+ }
- if (code = afs_InitReq(&treq, acred))
+ if (code = afs_InitReq(&treq, acred)) {
+#ifdef AFS_OSF_ENV
+ afs_PutVCache(adp, 0);
+ afs_PutVCache(tvc, 0);
+#endif
return code;
+ }
+ if (strlen(aname) > AFSNAMEMAX) {
+#ifdef AFS_OSF_ENV
+ afs_PutVCache(adp, 0);
+ afs_PutVCache(tvc, 0);
+#endif
+ return ENAMETOOLONG;
+ }
tagain:
code = afs_VerifyVCache(adp, &treq);
#ifdef AFS_OSF_ENV
- tvc = (struct vcache *)ndp->ni_vp; /* should never be null */
+ tvc = VTOAFS(ndp->ni_vp); /* should never be null */
if (code) {
afs_PutVCache(adp, 0);
afs_PutVCache(tvc, 0);
* fileserver
*/
if ( adp->states & CRO ) {
+#ifdef AFS_OSF_ENV
+ afs_PutVCache(adp, 0);
+ afs_PutVCache(tvc, 0);
+#endif
code = EROFS;
return code;
}
cred = avc->uncred;
avc->uncred = NULL;
+#ifdef AFS_DARWIN_ENV
+ /* this is called by vrele (via VOP_INACTIVE) when the refcount
+ is 0. we can't just call VN_HOLD since vref will panic.
+ we can't just call osi_vnhold because a later AFS_RELE will call
+ vrele again, which will try to call VOP_INACTIVE again after
+ vn_locking the vnode. which would be fine except that our vrele
+ caller also locked the vnode... So instead, we just gimmick the
+ refcounts and hope nobody else can touch the file now */
+ osi_Assert(VREFCOUNT(avc) == 0);
+ VREFCOUNT_SET(avc, 1);
+#endif
VN_HOLD(&avc->v);
/* We'll only try this once. If it fails, just release the vnode.
}
osi_FreeSmallSpace(unlname);
crfree(cred);
+#ifdef AFS_DARWIN_ENV
+ osi_Assert(VREFCOUNT(avc) == 1);
+ VREFCOUNT_SET(avc, 0);
+#endif
}
}
else {
#include <afsconfig.h>
#include "../afs/param.h"
-RCSID("$Header: /tmp/cvstemp/openafs/src/afs/VNOPS/afs_vnop_rename.c,v 1.1.1.4 2001/07/14 22:19:57 hartmans Exp $");
+RCSID("$Header: /tmp/cvstemp/openafs/src/afs/VNOPS/afs_vnop_rename.c,v 1.1.1.5 2002/05/10 23:44:25 hartmans Exp $");
#include "../afs/sysincludes.h" /* Standard vendor system headers */
#include "../afs/afsincludes.h" /* Afs-based standard headers */
if (code = afs_InitReq(&treq, acred)) return code;
+ if (strlen(aname1) > AFSNAMEMAX || strlen(aname2) > AFSNAMEMAX) {
+ code = ENAMETOOLONG;
+ goto done;
+ }
+
/* verify the latest versions of the stat cache entries */
tagain:
code = afs_VerifyVCache(aodp, &treq);
#ifdef AFS_OSF_ENV
afs_rename(fndp, tndp)
struct nameidata *fndp, *tndp; {
- register struct vcache *aodp = (struct vcache *)fndp->ni_dvp;
+ register struct vcache *aodp = VTOAFS(fndp->ni_dvp);
char *aname1 = fndp->ni_dent.d_name;
- register struct vcache *andp = (struct vcache *)tndp->ni_dvp;
+ register struct vcache *andp = VTOAFS(tndp->ni_dvp);
char *aname2 = tndp->ni_dent.d_name;
struct ucred *acred = tndp->ni_cred;
#else /* AFS_OSF_ENV */
#include <afsconfig.h>
#include "../afs/param.h"
-RCSID("$Header: /tmp/cvstemp/openafs/src/afs/VNOPS/afs_vnop_strategy.c,v 1.1.1.7 2001/10/14 17:59:13 hartmans Exp $");
+RCSID("$Header: /tmp/cvstemp/openafs/src/afs/VNOPS/afs_vnop_strategy.c,v 1.1.1.8 2002/05/10 23:44:25 hartmans Exp $");
#if !defined(AFS_HPUX_ENV) && !defined(AFS_SGI_ENV) && !defined(AFS_LINUX20_ENV)
register struct buf *abp; {
register afs_int32 code;
struct uio tuio;
- register struct vcache *tvc = (struct vcache *) abp->b_vp;
+ register struct vcache *tvc = VTOAFS(abp->b_vp);
register afs_int32 len = abp->b_bcount;
#if !defined(AFS_SUN5_ENV) && !defined(AFS_OSF_ENV) && !defined(AFS_DARWIN_ENV) && !defined(AFS_FBSD_ENV)
#ifdef AFS_AIX41_ENV
/* are user's credentials valid here? probably, but this
sure seems like the wrong things to do. */
#if defined(AFS_SUN5_ENV)
- code = afs_nlrdwr((struct vcache *) abp->b_vp, &tuio, UIO_READ, 0, credp);
+ code = afs_nlrdwr(VTOAFS(abp->b_vp), &tuio, UIO_READ, 0, credp);
#else
- code = afs_rdwr((struct vcache *) abp->b_vp, &tuio, UIO_READ, 0, credp);
+ code = afs_rdwr(VTOAFS(abp->b_vp), &tuio, UIO_READ, 0, credp);
#endif
if (code == 0) {
if (tuio.afsio_resid > 0)
len = MIN(len, tvc->m.Length - dbtob(abp->b_blkno));
#endif
#ifdef AFS_ALPHA_ENV
- len = MIN(abp->b_bcount, ((struct vcache *)abp->b_vp)->m.Length - dbtob(abp->b_blkno));
+ len = MIN(abp->b_bcount, (VTOAFS(abp->b_vp))->m.Length - dbtob(abp->b_blkno));
#endif /* AFS_ALPHA_ENV */
tuio.afsio_resid = len;
#if defined(AFS_FBSD_ENV)
/* are user's credentials valid here? probably, but this
sure seems like the wrong things to do. */
#if defined(AFS_SUN5_ENV)
- code = afs_nlrdwr((struct vcache *) abp->b_vp, &tuio, UIO_WRITE, 0, credp);
+ code = afs_nlrdwr(VTOAFS(abp->b_vp), &tuio, UIO_WRITE, 0, credp);
#else
- code = afs_rdwr((struct vcache *) abp->b_vp, &tuio, UIO_WRITE, 0, credp);
+ code = afs_rdwr(VTOAFS(abp->b_vp), &tuio, UIO_WRITE, 0, credp);
#endif
}
#if !defined(AFS_AIX32_ENV) && !defined(AFS_SUN5_ENV)
if (code && !(abp->b_flags & B_READ)) {
/* prevent ubc from retrying writes */
AFS_GUNLOCK();
- ubc_invalidate(((struct vnode *)tvc)->v_object,
+ ubc_invalidate(AFSTOV(tvc)->v_object,
(vm_offset_t)dbtob(abp->b_blkno),
PAGE_SIZE, B_INVAL);
AFS_GLOCK();
#include <afsconfig.h>
#include "../afs/param.h"
-RCSID("$Header: /tmp/cvstemp/openafs/src/afs/VNOPS/afs_vnop_symlink.c,v 1.1.1.5 2002/01/22 19:48:17 hartmans Exp $");
+RCSID("$Header: /tmp/cvstemp/openafs/src/afs/VNOPS/afs_vnop_symlink.c,v 1.1.1.6 2002/05/10 23:44:25 hartmans Exp $");
#include "../afs/sysincludes.h" /* Standard vendor system headers */
#include "../afs/afsincludes.h" /* Afs-based standard headers */
struct nameidata *ndp;
struct vattr *attrs;
register char *atargetName; {
- register struct vcache *adp = (struct vcache *)ndp->ni_dvp;
+ register struct vcache *adp = VTOAFS(ndp->ni_dvp);
char *aname = ndp->ni_dent.d_name;
struct ucred *acred = ndp->ni_cred;
#else /* AFS_OSF_ENV */
afs_Trace2(afs_iclSetp, CM_TRACE_SYMLINK, ICL_TYPE_POINTER, adp,
ICL_TYPE_STRING, aname);
- if (afs_IsDynroot(adp))
- return afs_DynrootVOPSymlink(adp, acred, aname, atargetName);
+ if (strlen(aname) > AFSNAMEMAX || strlen(atargetName) > AFSPATHMAX) {
+ code = ENAMETOOLONG;
+ goto done2;
+ }
+
+ if (afs_IsDynroot(adp)) {
+ code = afs_DynrootVOPSymlink(adp, acred, aname, atargetName);
+ goto done2;
+ }
if (code = afs_InitReq(&treq, acred))
- return code;
+ goto done2;
code = afs_VerifyVCache(adp, &treq);
if (code) {
code = afs_CheckCode(code, &treq, 30);
- return code;
+ goto done2;
}
/** If the volume is read-only, return error without making an RPC to the
*/
if ( adp->states & CRO ) {
code = EROFS;
- return code;
+ goto done2;
}
InStatus.Mask = AFS_SETMODTIME | AFS_SETMODE;
afs_PutVCache(tvc, WRITE_LOCK);
code = 0;
done:
-#ifdef AFS_OSF_ENV
- AFS_RELE(ndp->ni_dvp);
-#endif /* AFS_OSF_ENV */
if ( volp )
afs_PutVolume(volp, READ_LOCK);
code = afs_CheckCode(code, &treq, 31);
+done2:
+#ifdef AFS_OSF_ENV
+ AFS_RELE(ndp->ni_dvp);
+#endif /* AFS_OSF_ENV */
return code;
}
struct vrequest *areq;
{
register struct dcache *tdc;
- register char *tp;
+ register char *tp, *rbuf;
afs_int32 offset, len, alen;
register afs_int32 code;
}
if (avc->m.Mode & 0111) alen = len+1; /* regular link */
else alen = len; /* mt point */
- tp = afs_osi_Alloc(alen); /* make room for terminating null */
+ rbuf = (char *) osi_AllocLargeSpace(AFS_LRALLOCSIZ);
addr = afs_MemCacheOpen(tdc->f.inode);
- code = afs_MemReadBlk(addr, 0, tp, len);
- tp[alen-1] = 0;
+ code = afs_MemReadBlk(addr, 0, rbuf, len);
+ rbuf[alen-1] = '\0';
+ alen = strlen(rbuf) + 1;
+ tp = afs_osi_Alloc(alen); /* make room for terminating null */
+ memcpy(tp, rbuf, alen);
+ osi_FreeLargeSpace(rbuf);
afs_PutDCache(tdc);
if (code != len) {
afs_osi_Free(tp, alen);
register struct vcache *avc;
struct vrequest *areq; {
register struct dcache *tdc;
- register char *tp;
+ register char *tp, *rbuf;
char *tfile;
afs_int32 offset, len, alen;
register afs_int32 code;
tfile = osi_UFSOpen (tdc->f.inode);
if (avc->m.Mode & 0111) alen = len+1; /* regular link */
else alen = len; /* mt point */
- tp = afs_osi_Alloc(alen); /* make room for terminating null */
- code = afs_osi_Read(tfile, -1, tp, len);
- tp[alen-1] = 0;
+ rbuf = (char *) osi_AllocLargeSpace(AFS_LRALLOCSIZ);
+ code = afs_osi_Read(tfile, -1, rbuf, len);
+ rbuf[alen-1] = '\0';
osi_UFSClose(tfile);
afs_PutDCache(tdc);
+ alen = strlen(rbuf) + 1;
+ tp = afs_osi_Alloc(alen); /* make room for terminating null */
+ memcpy(tp, rbuf, alen);
+ osi_FreeLargeSpace(rbuf);
if (code != len) {
afs_osi_Free(tp, alen);
return EIO;
#include <afsconfig.h>
#include "../afs/param.h"
-RCSID("$Header: /tmp/cvstemp/openafs/src/afs/VNOPS/afs_vnop_write.c,v 1.1.1.9 2001/10/14 17:59:14 hartmans Exp $");
+RCSID("$Header: /tmp/cvstemp/openafs/src/afs/VNOPS/afs_vnop_write.c,v 1.1.1.10 2002/05/10 23:44:26 hartmans Exp $");
#include "../afs/sysincludes.h" /* Standard vendor system headers */
#include "../afs/afsincludes.h" /* Afs-based standard headers */
* top level code. */
avc->opens--;
avc->execsOrWriters--;
- AFS_RELE((struct vnode *)avc); /* VN_HOLD at set CCore(afs_FakeClose)*/
+ AFS_RELE(AFSTOV(avc)); /* VN_HOLD at set CCore(afs_FakeClose)*/
crfree((struct AFS_UCRED *)avc->linkData); /* "crheld" in afs_FakeClose */
avc->linkData = (char *)0;
}
code = afs_MemWriteUIO(tdc->f.inode, &tuio);
if (code) {
+ void *mep; /* XXX in prototype world is struct memCacheEntry * */
error = code;
ZapDCE(tdc); /* bad data */
- afs_MemCacheTruncate(tdc->f.inode, 0);
+ mep = afs_MemCacheOpen(tdc->f.inode);
+ afs_MemCacheTruncate(mep, 0);
+ afs_MemCacheClose(mep);
afs_stats_cmperf.cacheCurrDirtyChunks--;
afs_indexFlags[tdc->index] &= ~IFDataMod; /* so it does disappear */
afs_PutDCache(tdc);
afs_closex(afd)
register struct file *afd; {
struct vrequest treq;
- register struct vcache *tvc;
+ struct vcache *tvc;
afs_int32 flags;
int closeDone;
afs_int32 code = 0;
* close the file and release the lock when done. Otherwise, just
* let the regular close code work. */
if (afd->f_type == DTYPE_VNODE) {
- tvc = (struct vcache *) afd->f_data;
- if (IsAfsVnode((struct vnode *)tvc)) {
- VN_HOLD((struct vnode *) tvc);
+ tvc = VTOAFS(afd->f_data);
+ if (IsAfsVnode(AFSTOV(tvc))) {
+ VN_HOLD(AFSTOV(tvc));
flags = afd->f_flag & (FSHLOCK | FEXLOCK);
afd->f_flag &= ~(FSHLOCK | FEXLOCK);
code = vno_close(afd);
#ifdef AFS_DEC_ENV
grele((struct gnode *) tvc);
#else
- AFS_RELE((struct vnode *) tvc);
+ AFS_RELE(AFSTOV(tvc));
#endif
closeDone = 1;
}
#include <afsconfig.h>
#include "../afs/param.h"
-RCSID("$Header: /tmp/cvstemp/openafs/src/afs/afs_callback.c,v 1.1.1.7 2001/10/14 17:58:53 hartmans Exp $");
+RCSID("$Header: /tmp/cvstemp/openafs/src/afs/afs_callback.c,v 1.1.1.8 2002/05/10 23:43:09 hartmans Exp $");
#include "../afs/sysincludes.h" /*Standard vendor system headers*/
#include "../afs/afsincludes.h" /*AFS-based standard headers*/
a_result->lock.exclLocked = ((struct afs_lock *)(tl->addr))->excl_locked;
a_result->lock.readersReading = ((struct afs_lock *)(tl->addr))->readers_reading;
a_result->lock.numWaiting = ((struct afs_lock *)(tl->addr))->num_waiting;
+#ifdef INSTRUMENT_LOCKS
a_result->lock.pid_last_reader = ((struct afs_lock *)(tl->addr))->pid_last_reader;
a_result->lock.pid_writer = ((struct afs_lock *)(tl->addr))->pid_writer;
a_result->lock.src_indicator = ((struct afs_lock *)(tl->addr))->src_indicator;
+#else
+ a_result->lock.pid_last_reader = 0;
+ a_result->lock.pid_writer = 0;
+ a_result->lock.src_indicator = 0;
+#endif
code = 0;
}
/* search the list for the cell with this index */
ObtainReadLock(&afs_xcell);
- for (i=0, cq = CellLRU.next; cq != &CellLRU && i<= a_index; cq = tq, i++) {
- tq = QNext(cq);
- if (i == a_index) {
- tcell = QTOC(cq);
- p_name = tcell->cellName;
- for (j = 0 ; j < AFSMAXCELLHOSTS && tcell->cellHosts[j] ; j++) {
- a_hosts[j] = ntohl(tcell->cellHosts[j]->addr->sa_ip);
- }
- }
+
+ tcell = afs_GetCellByIndex(a_index, READ_LOCK, 0);
+
+ if (!tcell) {
+ i = 0;
+ } else {
+ p_name = tcell->cellName;
+ for (j = 0 ; j < AFSMAXCELLHOSTS && tcell->cellHosts[j] ; j++) {
+ a_hosts[j] = ntohl(tcell->cellHosts[j]->addr->sa_ip);
+ }
+ i = strlen(p_name);
+ afs_PutCell(tcell, READ_LOCK);
}
- if (p_name)
- i = strlen(p_name);
- else
- i = 0;
t_name = (char *)rxi_Alloc(i+1);
if (t_name == NULL) {
+ ReleaseReadLock(&afs_xcell);
#ifdef RX_ENABLE_LOCKS
AFS_GUNLOCK();
#endif /* RX_ENABLE_LOCKS */
* the primary cell is when no other cell is explicitly marked as
* the primary cell. */
ObtainReadLock(&afs_xcell);
+
for (cq = CellLRU.next; cq != &CellLRU; cq = tq) {
tq = QNext(cq);
tcell = QTOC(cq);
plen = 0;
t_name = (char *)rxi_Alloc(plen+1);
if (t_name == NULL) {
+ ReleaseReadLock(&afs_xcell);
#ifdef RX_ENABLE_LOCKS
AFS_GUNLOCK();
#endif /* RX_ENABLE_LOCKS */
#include <afsconfig.h>
#include "../afs/param.h"
-RCSID("$Header: /tmp/cvstemp/openafs/src/afs/afs_dcache.c,v 1.1.1.7 2001/10/14 17:58:55 hartmans Exp $");
+RCSID("$Header: /tmp/cvstemp/openafs/src/afs/afs_dcache.c,v 1.1.1.8 2002/05/10 23:43:12 hartmans Exp $");
#include "../afs/sysincludes.h" /*Standard vendor system headers*/
#include "../afs/afsincludes.h" /*AFS-based standard headers*/
if (size > dynrootLen)
size = dynrootLen;
if (size < 0) size = 0;
- code = afs_osi_Write(file, -1, dynrootDir, size);
+ code = afs_CFileWrite(file, 0, dynrootDir, size);
afs_PutDynroot();
if (code == size)
#include <afsconfig.h>
#include "../afs/param.h"
-RCSID("$Header: /tmp/cvstemp/openafs/src/afs/afs_nfsdisp.c,v 1.1.1.2 2002/01/22 19:47:58 hartmans Exp $");
+RCSID("$Header: /tmp/cvstemp/openafs/src/afs/afs_nfsdisp.c,v 1.1.1.3 2002/05/10 23:43:16 hartmans Exp $");
#include "../afs/stds.h"
#include "../afs/sysincludes.h" /* Standard vendor system headers */
#include "../rpc/auth.h"
#include "../rpc/auth_unix.h"
#include "../rpc/auth_des.h"
+#if !defined(AFS_SUN58_ENV)
#include "../rpc/auth_kerb.h"
+#endif
#include "../sys/tiuser.h"
#include "../rpc/xdr.h"
#include "../rpc/svc.h"
};
struct afs_nfs2_resp {
- nfsstat status;
+ enum nfsstat status;
};
#ifndef ACL2_NPROC
#endif
AFS_GLOCK();
- vcp = (struct vcache *)addr[0];
+ vcp = VTOAFS((struct vnode*)addr[0]);
/* See also afs_osi_vget */
if (addr[1] == AFS_XLATOR_MAGIC)
/* If we have a ref, release it */
if (vcp->vrefCount >= 1)
- AFS_RELE((struct vnode *) vcp);
+ AFS_RELE(AFSTOV(vcp));
}
AFS_GUNLOCK();
}
void
afs_nfs2_noaccess(struct afs_nfs2_resp *resp)
{
- r->status = NFSERR_ACCES;
+ resp->status = NFSERR_ACCES;
}
void afs_nfs2_null(char *args, char *xp, char *exp, char *rp, char *crp)
NFS_V2_REQ(afs_nfs2_getattr, RFS_GETATTR, 0)
NFS_V2_REQ(afs_nfs2_setattr, RFS_SETATTR, 0)
NFS_V2_REQ(afs_nfs2_lookup, RFS_LOOKUP, 1)
-NFS_V2_REQ(afs_nfs2_readlink, RFS_READLINK, 0);
-NFS_V2_REQ(afs_nfs2_read, RFS_READ, 0);
-NFS_V2_REQ(afs_nfs2_write, RFS_WRITE, 0);
-NFS_V2_REQ(afs_nfs2_create, RFS_CREATE, 1);
-NFS_V2_REQ(afs_nfs2_remove, RFS_REMOVE, 0);
-NFS_V2_REQ(afs_nfs2_rename, RFS_RENAME, 0);
-NFS_V2_REQ(afs_nfs2_link, RFS_LINK, 0);
-NFS_V2_REQ(afs_nfs2_symlink, RFS_SYMLINK, 0);
-NFS_V2_REQ(afs_nfs2_mkdir, RFS_MKDIR, 1);
-NFS_V2_REQ(afs_nfs2_rmdir, RFS_RMDIR, 0);
-NFS_V2_REQ(afs_nfs2_readdir, RFS_READDIR, 0);
-NFS_V2_REQ(afs_nfs2_statfs, RFS_STATFS, 0);
+NFS_V2_REQ(afs_nfs2_readlink, RFS_READLINK, 0)
+NFS_V2_REQ(afs_nfs2_read, RFS_READ, 0)
+NFS_V2_REQ(afs_nfs2_write, RFS_WRITE, 0)
+NFS_V2_REQ(afs_nfs2_create, RFS_CREATE, 1)
+NFS_V2_REQ(afs_nfs2_remove, RFS_REMOVE, 0)
+NFS_V2_REQ(afs_nfs2_rename, RFS_RENAME, 0)
+NFS_V2_REQ(afs_nfs2_link, RFS_LINK, 0)
+NFS_V2_REQ(afs_nfs2_symlink, RFS_SYMLINK, 0)
+NFS_V2_REQ(afs_nfs2_mkdir, RFS_MKDIR, 1)
+NFS_V2_REQ(afs_nfs2_rmdir, RFS_RMDIR, 0)
+NFS_V2_REQ(afs_nfs2_readdir, RFS_READDIR, 0)
+NFS_V2_REQ(afs_nfs2_statfs, RFS_STATFS, 0)
struct afs_nfs_disp_tbl afs_rfs_disp_tbl[RFS_NPROC] = {
{ afs_nfs2_null },
nfsstat3 status;
bool_t flags;
};
+typedef struct afs_nfs3_resp afs_nfs3_resp;
static int
is_afs_fh3(nfs_fh3 *fhp) {
}
afs_int32
-acl2_to_afs_call(int which, caddr_t *args, nfs_fh3 **fhpp)
+acl3_to_afs_call(int which, caddr_t *args, nfs_fh3 **fhpp)
{
nfs_fh3 *fhp;
static int once = 0;
struct SmallFid Sfid;
- memcpy((char *)&Sfid, fh->fh_data, SIZEOF_SMALLFID);
+ memcpy((char *)&Sfid, fh->fh3_data, SIZEOF_SMALLFID);
/* We ran */
call = 1;
}
void
-afs_nfs3_smallfidder(struct nfs_fh3 *fhp int status)
+afs_nfs3_smallfidder(struct nfs_fh3 *fhp, int status)
{
afs_int32 addr[2];
struct vcache *vcp;
#endif
AFS_GLOCK();
- vcp = (struct vcache *)addr[0];
+ vcp = VTOAFS((struct vnode*)addr[0]);
/* See also afs_osi_vget */
if (addr[1] == AFS_XLATOR_MAGIC)
/* If we have a ref, release it */
if (vcp->vrefCount >= 1)
- AFS_RELE((struct vnode *) vcp);
+ AFS_RELE(AFSTOV(vcp));
}
AFS_GUNLOCK();
}
#define NFS_V3_REQ(FUNCNAME, NFSOP, POST, RESP, RESPP) \
void FUNCNAME(char *args, char *xp, char *exp, char *rp, char *crp) { \
u_int call; \
+ afs_nfs3_resp dummy; \
struct cred *svcred = curthread->t_cred; \
curthread->t_cred = (struct cred*)crp; \
call=afs_nfs3_dispatcher(0, NFSOP, (char *)args, &exp, rp, crp); \
else { (*afs_rfs3_disp_tbl[NFSOP].orig_proc)(args, xp, exp, rp, crp); \
if (POST && afs_NFSRootOnly && call) { \
RESP *resp = ( RESP *)xp; \
- afs_nfs3_smallfidder( RESPP , resp->status); } \
+ afs_nfs3_smallfidder( RESPP , resp->status); } } \
curthread->t_cred = svcred; \
return; \
}
-NFS_V3_REQ(afs_nfs3_getattr, NFSPROC3_GETATTR, 0, x, x)
-NFS_V3_REQ(afs_nfs3_setattr, NFSPROC3_SETATTR, 0, x, x)
+NFS_V3_REQ(afs_nfs3_getattr, NFSPROC3_GETATTR, 0, afs_nfs3_resp, &dummy)
+NFS_V3_REQ(afs_nfs3_setattr, NFSPROC3_SETATTR, 0, afs_nfs3_resp, &dummy)
NFS_V3_REQ(afs_nfs3_lookup, NFSPROC3_LOOKUP, 1, LOOKUP3res, &resp->resok.object)
-NFS_V3_REQ(afs_nfs3_access, NFSPROC3_ACCESS, 0, x, x);
-NFS_V3_REQ(afs_nfs3_readlink, NFSPROC3_READLINK, 0, x, x);
-NFS_V3_REQ(afs_nfs3_read, NFSPROC3_READ, 0, x, x);
-NFS_V3_REQ(afs_nfs3_write, NFSPROC3_WRITE, 0, x, x);
-NFS_V3_REQ(afs_nfs3_create, NFSPROC3_CREATE, 1, CREATE3res, &resp->resok.obj.handle);
-NFS_V3_REQ(afs_nfs3_mkdir, NFSPROC3_MKDIR, 1, MKDIR3res, &resp->resok.obj.handle);
-NFS_V3_REQ(afs_nfs3_symlink, NFSPROC3_SYMLINK, 0, x, x);
-NFS_V3_REQ(afs_nfs3_mknod, NFSPROC3_MKNOD, 0, x, x);
-NFS_V3_REQ(afs_nfs3_remove, NFSPROC3_REMOVE, 0, x, x);
-NFS_V3_REQ(afs_nfs3_rmdir, NFSPROC3_RMDIR, 0, x, x);
-NFS_V3_REQ(afs_nfs3_rename, NFSPROC3_RENAME, 0, x, x);
-NFS_V3_REQ(afs_nfs3_link, NFSPROC3_LINK, 0, x, x);
-NFS_V3_REQ(afs_nfs3_readdir, NFSPROC3_READDIR, 0, x, x);
-NFS_V3_REQ(afs_nfs3_readdirplus, NFSPROC3_READDIRPLUS, 0, x, x);
-NFS_V3_REQ(afs_nfs3_fsstat, NFSPROC3_FSSTAT, 0, x, x);
-NFS_V3_REQ(afs_nfs3_fsinfo, NFSPROC3_FSINFO, 0, x, x);
-NFS_V3_REQ(afs_nfs3_pathconf, NFSPROC3_PATHCONF, 0, x, x);
-NFS_V3_REQ(afs_nfs3_commit, NFSPROC3_COMMIT, 0, x, x);
-
-struct afs_nfs_disp_tbl afs_rfs3_disp_tbl[RFS_NPROC] = {
+NFS_V3_REQ(afs_nfs3_access, NFSPROC3_ACCESS, 0, afs_nfs3_resp, &dummy)
+NFS_V3_REQ(afs_nfs3_readlink, NFSPROC3_READLINK, 0, afs_nfs3_resp, &dummy)
+NFS_V3_REQ(afs_nfs3_read, NFSPROC3_READ, 0, afs_nfs3_resp, &dummy)
+NFS_V3_REQ(afs_nfs3_write, NFSPROC3_WRITE, 0, afs_nfs3_resp, &dummy)
+NFS_V3_REQ(afs_nfs3_create, NFSPROC3_CREATE, 1, CREATE3res, &resp->resok.obj.handle)
+NFS_V3_REQ(afs_nfs3_mkdir, NFSPROC3_MKDIR, 1, MKDIR3res, &resp->resok.obj.handle)
+NFS_V3_REQ(afs_nfs3_symlink, NFSPROC3_SYMLINK, 0, afs_nfs3_resp, &dummy)
+NFS_V3_REQ(afs_nfs3_mknod, NFSPROC3_MKNOD, 0, afs_nfs3_resp, &dummy)
+NFS_V3_REQ(afs_nfs3_remove, NFSPROC3_REMOVE, 0, afs_nfs3_resp, &dummy)
+NFS_V3_REQ(afs_nfs3_rmdir, NFSPROC3_RMDIR, 0, afs_nfs3_resp, &dummy)
+NFS_V3_REQ(afs_nfs3_rename, NFSPROC3_RENAME, 0, afs_nfs3_resp, &dummy)
+NFS_V3_REQ(afs_nfs3_link, NFSPROC3_LINK, 0, afs_nfs3_resp, &dummy)
+NFS_V3_REQ(afs_nfs3_readdir, NFSPROC3_READDIR, 0, afs_nfs3_resp, &dummy)
+NFS_V3_REQ(afs_nfs3_readdirplus, NFSPROC3_READDIRPLUS, 0, afs_nfs3_resp, &dummy)
+NFS_V3_REQ(afs_nfs3_fsstat, NFSPROC3_FSSTAT, 0, afs_nfs3_resp, &dummy)
+NFS_V3_REQ(afs_nfs3_fsinfo, NFSPROC3_FSINFO, 0, afs_nfs3_resp, &dummy)
+NFS_V3_REQ(afs_nfs3_pathconf, NFSPROC3_PATHCONF, 0, afs_nfs3_resp, &dummy)
+NFS_V3_REQ(afs_nfs3_commit, NFSPROC3_COMMIT, 0, afs_nfs3_resp, &dummy)
+
+struct afs_nfs_disp_tbl afs_rfs3_disp_tbl[RFS3_NPROC] = {
{ afs_nfs2_null },
{ afs_nfs3_getattr },
{ afs_nfs3_setattr },
_acl_tbl[i].dis_proc = afs_acl3_disp_tbl[i].afs_proc;
}
}
-#endif /* !defined(AFS_NONFSTRANS)
+#endif /* !defined(AFS_NONFSTRANS) */
#include <afsconfig.h>
#include "../afs/param.h"
-RCSID("$Header: /tmp/cvstemp/openafs/src/afs/afs_osi.c,v 1.1.1.9 2002/01/28 00:24:06 hartmans Exp $");
+RCSID("$Header: /tmp/cvstemp/openafs/src/afs/afs_osi.c,v 1.1.1.10 2002/05/10 23:43:17 hartmans Exp $");
#include "../afs/sysincludes.h" /* Standard vendor system headers */
#include "../afs/afsincludes.h" /* Afs-based standard headers */
if (avc->opens > 0 || ((avc->v.v_flag & VTEXT) && !inode_uncache_try(avc))) return 1;
#else
#if defined(AFS_SGI_ENV)
- if ((avc->opens > 0) || AFS_VN_MAPPED((struct vnode *)avc))
+ if ((avc->opens > 0) || AFS_VN_MAPPED(AFSTOV(avc)))
return 1;
#else
- if (avc->opens > 0 || (avc->v.v_flag & VTEXT)) return(1);
+ if (avc->opens > 0 || (AFSTOV(avc)->v_flag & VTEXT)) return(1);
#endif
#endif /* AFS_MACH_ENV */
#endif
#include <afsconfig.h>
#include "../afs/param.h"
-RCSID("$Header: /tmp/cvstemp/openafs/src/afs/afs_server.c,v 1.1.1.11 2002/01/22 19:48:01 hartmans Exp $");
+RCSID("$Header: /tmp/cvstemp/openafs/src/afs/afs_server.c,v 1.1.1.12 2002/05/10 23:43:22 hartmans Exp $");
#include "../afs/stds.h"
#include "../afs/sysincludes.h" /* Standard vendor system headers */
#ifdef RX_ENABLE_LOCKS
AFS_GLOCK();
#endif /* RX_ENABLE_LOCKS */
- rx_SetConnDeadTime(tc->id, 50);
+ rx_SetConnDeadTime(tc->id, AFS_RXDEADTIME);
afs_PutConn(tc, SHARED_LOCK);
/*
* If probe worked, or probe call not yet defined (for compatibility
continue; /* have just been added by setsprefs */
/* get a connection, even if host is down; bumps conn ref count */
- tu = afs_GetUser(treq.uid, ts->cell, SHARED_LOCK);
+ tu = afs_GetUser(treq.uid, ts->cell->cell, SHARED_LOCK);
tc = afs_ConnBySA(sa, ts->cell->fsport, ts->cell->cell, tu,
1/*force*/, 1/*create*/, SHARED_LOCK);
afs_PutUser(tu, SHARED_LOCK);
afs_setTimeHost = tc->srvr->server;
}
if (setTimer)
- rx_SetConnDeadTime(tc->id, 50);
+ rx_SetConnDeadTime(tc->id, AFS_RXDEADTIME);
if (code >= 0 && (sa->sa_flags & SRVADDR_ISDOWN) && (tc->srvr == sa)) {
/* server back up */
print_internet_address("afs: file server ", sa, " is back up", 2);
#include <afsconfig.h>
#include "../afs/param.h"
-RCSID("$Header: /tmp/cvstemp/openafs/src/afs/afs_vcache.c,v 1.1.1.11 2002/01/28 00:24:08 hartmans Exp $");
+RCSID("$Header: /tmp/cvstemp/openafs/src/afs/afs_vcache.c,v 1.1.1.12 2002/05/10 23:43:26 hartmans Exp $");
#include "../afs/sysincludes.h" /*Standard vendor system headers*/
#include "../afs/afsincludes.h" /*AFS-based standard headers*/
ICL_TYPE_INT32, avc->states);
#ifdef AFS_OSF_ENV
AFS_GUNLOCK();
- VN_LOCK((struct vnode *)avc);
+ VN_LOCK(AFSTOV(avc));
AFS_GLOCK();
#endif
afs_vcount--;
vSetType(avc, VREG);
if (VREFCOUNT(avc) > 0) {
- VN_UNLOCK((struct vnode *)avc);
- AFS_RELE((struct vnode *)avc);
+ VN_UNLOCK(AFSTOV(avc));
+ AFS_RELE(AFSTOV(avc));
} else {
if (afs_norefpanic) {
printf ("flush vc refcnt < 1");
afs_norefpanic++;
(void) vgone(avc, VX_NOSLEEP, (struct vnodeops *) 0);
AFS_GLOCK();
- VN_UNLOCK((struct vnode *)avc);
+ VN_UNLOCK(AFSTOV(avc));
}
else osi_Panic ("flush vc refcnt < 1");
}
bad:
#ifdef AFS_OSF_ENV
- VN_UNLOCK((struct vnode *)avc);
+ VN_UNLOCK(AFSTOV(avc));
#endif
return code;
return 0;
}
+#ifdef AFS_LINUX22_ENV
+/* afs_TryFlushDcacheChildren -- Shakes loose vcache references held by
+ * children of the dentry
+ *
+ * LOCKS -- Called with afs_xvcache write locked. Drops and reaquires
+ * AFS_GLOCK, so it can call dput, which may call iput, but
+ * keeps afs_xvcache exclusively.
+ *
+ * Tree traversal algorithm from fs/dcache.c: select_parent()
+ */
+static void afs_TryFlushDcacheChildren(struct vcache *tvc)
+{
+ struct inode *ip = AFSTOI(tvc);
+ struct dentry *this_parent;
+ struct list_head *next;
+ struct list_head *cur;
+ struct list_head *head = &ip->i_dentry;
+ struct dentry *dentry;
+
+restart:
+ DLOCK();
+ cur = head;
+ while ((cur = cur->next) != head) {
+ dentry = list_entry(cur, struct dentry, d_alias);
+ if (DCOUNT(dentry)) {
+ this_parent = dentry;
+ repeat:
+ next = this_parent->d_subdirs.next;
+ resume:
+ while (next != &this_parent->d_subdirs) {
+ struct list_head *tmp = next;
+ struct dentry *dchld = list_entry(tmp, struct dentry, d_child);
+
+ next = tmp->next;
+ if (!DCOUNT(dchld) && !dchld->d_inode) {
+ DGET(dchld);
+ AFS_GUNLOCK();
+ DUNLOCK();
+ d_drop(dchld);
+ dput(dchld);
+ AFS_GLOCK();
+ DLOCK();
+ goto repeat;
+ }
+ /*
+ * Descend a level if the d_subdirs list is non-empty.
+ */
+ if (!list_empty(&dchld->d_subdirs)) {
+ this_parent = dchld;
+ goto repeat;
+ }
+ }
+
+ /*
+ * All done at this level ... ascend and resume the search.
+ */
+ if (this_parent != dentry) {
+ next = this_parent->d_child.next;
+ this_parent = this_parent->d_parent;
+ goto resume;
+ }
+ }
+
+ if (!DCOUNT(dentry)) {
+ AFS_GUNLOCK();
+ DGET(dentry);
+ DUNLOCK();
+ d_drop(dentry);
+ dput(dentry);
+ AFS_GLOCK();
+ goto restart;
+ }
+ }
+ DUNLOCK();
+
+}
+#endif /* AFS_LINUX22_ENV */
/*
* afs_RemoveVCB
int code, fv_slept;
AFS_STATCNT(afs_NewVCache);
-#ifdef AFS_LINUX22_ENV
- if (!freeVCList) {
- /* Free some if possible. */
- struct afs_q *tq, *uq;
- int i; char *panicstr;
- int vmax = 2 * afs_cacheStats;
- int vn = VCACHE_FREE;
-
- i = 0;
- for(tq = VLRU.prev; tq != &VLRU && vn > 0; tq = uq) {
- tvc = QTOV(tq);
- uq = QPrev(tq);
- if (tvc->states & CVFlushed)
- refpanic ("CVFlushed on VLRU");
- else if (i++ > vmax)
- refpanic ("Exceeded pool of AFS vnodes(VLRU cycle?)");
- else if (QNext(uq) != tq)
- refpanic ("VLRU inconsistent");
-
- if (tvc == afs_globalVp)
- continue;
-
- if ( VREFCOUNT(tvc) && tvc->opens == 0 ) {
- struct inode *ip = (struct inode*)tvc;
- if (list_empty(&ip->i_dentry)) {
- vn --;
- }
- else {
- struct list_head *cur;
- struct list_head *head = &ip->i_dentry;
- int all = 1;
- restart:
- DLOCK();
- cur = head;
- while ((cur = cur->next) != head) {
- struct dentry *dentry = list_entry(cur, struct dentry, d_alias);
- if (!DCOUNT(dentry)) {
- AFS_GUNLOCK();
- DGET(dentry);
- DUNLOCK();
- d_drop(dentry);
- dput(dentry);
- AFS_GLOCK();
- goto restart;
- }
- else {
- all = 0;
- }
- }
- DUNLOCK();
- if (all) vn --;
- }
- }
- if (tq == uq) break;
- }
- }
-#endif /* AFS_LINUX22_ENV */
#ifdef AFS_OSF_ENV
#ifdef AFS_OSF30_ENV
if (afs_vcount >= afs_maxvcount)
}
}
#endif
+#if defined(AFS_LINUX22_ENV)
+ if (tvc != afs_globalVp && VREFCOUNT(tvc) && tvc->opens == 0)
+ afs_TryFlushDcacheChildren(tvc);
+#endif
+
if (VREFCOUNT(tvc) == 0 && tvc->opens == 0
&& (tvc->states & CUnlinkedDel) == 0) {
code = afs_FlushVCache(tvc, &fv_slept);
hzero(tvc->m.DataVersion); /* in case we copy it into flushDV */
#ifdef AFS_OSF_ENV
/* Hold it for the LRU (should make count 2) */
- VN_HOLD((struct vnode *)tvc);
+ VN_HOLD(AFSTOV(tvc));
#else /* AFS_OSF_ENV */
VREFCOUNT_SET(tvc, 1); /* us */
#endif /* AFS_OSF_ENV */
AFS_VN_INIT_BUF_LOCK(&(tvc->v));
#endif
#else
- SetAfsVnode((struct vnode *)tvc);
+ SetAfsVnode(AFSTOV(tvc));
#endif /* AFS_SGI64_ENV */
#ifdef AFS_DARWIN_ENV
tvc->v.v_ubcinfo = UBC_INFO_NULL;
lockinit(&tvc->rwlock, PINOD, "vcache rwlock", 0, 0);
- cache_purge((struct vnode *)tvc);
+ cache_purge(AFSTOV(tvc));
tvc->v.v_data=tvc;
tvc->v.v_tag=VT_AFS;
/* VLISTNONE(&tvc->v); */
#endif /* AFS_SGI_ENV */
#if defined(AFS_LINUX22_ENV)
{
- struct inode *ip = (struct inode*)tvc;
+ struct inode *ip = AFSTOI(tvc);
sema_init(&ip->i_sem, 1);
#if defined(AFS_LINUX24_ENV)
sema_init(&ip->i_zombie, 1);
#ifdef AFS_GFS_ENV
VREFCOUNT_DEC(tvc);
#else
- AFS_RELE((struct vnode *)tvc);
+ AFS_RELE(AFSTOV(tvc));
#endif
/* Matches write code setting CCore flag */
crfree(cred);
* can be safely implemented */
int vg;
AFS_GUNLOCK();
- vg = vget((struct vnode *)tvc); /* this bumps ref count */
+ vg = vget(AFSTOV(tvc)); /* this bumps ref count */
AFS_GLOCK();
if (vg)
continue;
/* Grab this vnode, possibly reactivating from the free list */
int vg;
AFS_GUNLOCK();
- vg = vget((struct vnode *)tvc);
+ vg = vget(AFSTOV(tvc));
AFS_GLOCK();
if (vg)
continue;
/* Grab this vnode, possibly reactivating from the free list */
int vg;
AFS_GUNLOCK();
- vg = vget((struct vnode *)tvc);
+ vg = vget(AFSTOV(tvc));
AFS_GLOCK();
if (vg) {
/* This vnode no longer exists. */
/* Duplicates */
#ifdef AFS_OSF_ENV
/* Drop our reference counts. */
- vrele((struct vnode *)tvc);
- vrele((struct vnode *)found_tvc);
+ vrele(AFSTOV(tvc));
+ vrele(AFSTOV(found_tvc));
#endif
afs_duplicate_nfs_fids++;
ReleaseSharedLock(&afs_xvcache);
tvc->mvid = (struct VenusFid*)0;
}
#ifdef AFS_AIX_ENV
- aix_gnode_rele((struct vnode *)tvc);
+ aix_gnode_rele(AFSTOV(tvc));
#endif
if (tvc->linkData) {
afs_osi_Free(tvc->linkData, strlen(tvc->linkData)+1);
#include <afsconfig.h>
#include "../afs/param.h"
-RCSID("$Header: /tmp/cvstemp/openafs/src/afs/afs_volume.c,v 1.1.1.9 2002/01/22 19:48:02 hartmans Exp $");
+RCSID("$Header: /tmp/cvstemp/openafs/src/afs/afs_volume.c,v 1.1.1.10 2002/05/10 23:43:27 hartmans Exp $");
#include "../afs/stds.h"
#include "../afs/sysincludes.h" /* Standard vendor system headers */
} else
code = -1;
} while
- (afs_Analyze(tconn, code, (struct VenusFid *) 0, areq,
+ (afs_Analyze(tconn, code, (struct VenusFid *) 0, &treq,
-1, /* no op code for this */
SHARED_LOCK, tcell));