#define AFS_UCRED ucred
#define AFS_PROC struct proc
-#define afs_bufferpages bufpages
-
-#define osi_vnhold(avc, r) afs_vget(AFSTOV(avc), 0)
-
-#define afs_suser() afs_osi_suser(osi_curcred())
-
-extern int (**afs_vnodeop_p)();
#define SetAfsVnode(vn) /* nothing; done in getnewvnode() */
#define IsAfsVnode(vn) ((vn)->v_op == afs_vnodeop_p)
-#define AFS_HOLD(vp) afs_nbsd_ref(vp)
-#define AFS_RELE(vp) afs_nbsd_rele(vp)
-extern int afs_vget();
-extern void afs_nbsd_ref(struct vnode *);
-extern void afs_nbsd_rele(struct vnode *);
+#define p_rcred p_ucred
-#define va_nodeid va_fileid
-#define v_vfsp v_mount
-#define vfs_vnodecovered mnt_vnodecovered
-#define vfs_bsize mnt_stat.f_bsize
-typedef void (*osi_timeout_t)(void *);
-#define osi_timeout_t_done
-#define osi_curproc() (curproc)
-#define osi_curcred() (curproc->p_cred->pc_ucred)
+#define AFS_HOLD(vp) afs_nbsd_ref(vp)
+#define AFS_RELE(vp) afs_nbsd_rele(vp)
+#define osi_vnhold(avc, r) afs_vget(AFSTOV(avc), 0)
+
+#define afsio_iov uio_iov
+#define afsio_iovcnt uio_iovcnt
+#define afsio_offset uio_offset
+#define afsio_resid uio_resid
+#define afsio_seg uio_segflg
+#define AFS_KALLOC(s) afs_nbsd_Alloc(s)
+#define AFS_KFREE(p, s) afs_nbsd_Free((p), (s))
+#define AFS_UIOSYS UIO_SYSSPACE
+#define AFS_UIOUSER UIO_USERSPACE
+#define afs_bufferpages bufpages
+#define afs_suser() afs_osi_suser(osi_curcred())
+#define osi_curcred() (curproc->p_cred->pc_ucred)
+#define osi_curproc() (curproc)
+#define osi_GetTime(x) microtime(x)
#define osi_vfs mount
-#define osi_vfs_bsize mnt_stat.f_bsize
-#define osi_vfs_fsid mnt_stat.f_fsid
-#define afs_osi_alloc osi_Alloc
-#define afs_osi_free osi_Free
+#define osi_vfs_bsize mnt_stat.f_bsize
+#define osi_vfs_fsid mnt_stat.f_fsid
#define printk printf /* for RX version of xdr_* */
-#define vType(vc) (vc)->v->v_type
-#define vSetType(vc, type) AFSTOV(vc)->v_type = (type)
-#define vSetVfsp(vc, vfsp) AFSTOV(vc)->v_mount = (vfsp)
-#define FTRUNC O_TRUNC
-#define FEXLOCK O_EXLOCK
-#define FSHLOCK O_SHLOCK
+#define setgroups sys_setgroups
#define UVM
+#define va_nodeid va_fileid
+#define vfs_bsize mnt_stat.f_bsize
+#define vfs_fsid mnt_stat.f_fsid
+#define vfs_vnodecovered mnt_vnodecovered
+#define vnode_t struct vnode
+#define vSetType(vc, type) AFSTOV(vc)->v_type = (type)
+#define vSetVfsp(vc, vfsp) AFSTOV(vc)->v_mount = (vfsp)
+#define vType(vc) (vc)->v->v_type
+#define v_vfsp v_mount
-/* no protoytpe 'cuz our includers don't always have uio_rw in scope first */
-extern int afs_nbsd_rdwr();
-extern int afs_nbsd_lookupname();
-extern void afs_nbsd_getnewvnode();
+/* This is not always in scope yet */
+struct vcache;
+
+extern int afs_nbsd_lookupname(char *fnamep, enum uio_seg segflg, int followlink,
+ struct vnode **dirvpp, struct vnode **compvpp);
+extern void afs_nbsd_getnewvnode(struct vcache *tvc);
+extern void afs_nbsd_ref(struct vnode *);
+extern void afs_nbsd_rele(struct vnode *);
+extern void *afs_nbsd_Alloc(size_t asize);
+extern void afs_nbsd_Free(void *p, size_t asize);
+extern int afs_vget();
-#define VOP_RDWR afs_nbsd_rdwr
#define gop_lookupname(fnamep, segflg, followlink, dirvpp, compvpp) \
afs_nbsd_lookupname((fnamep), (segflg), (followlink), (dirvpp), (compvpp))
#ifdef KERNEL
+extern int (**afs_vnodeop_p)();
extern struct simplelock afs_global_lock;
#ifndef AFS_GLOBAL_SUNLOCK
+/*
+ * osi_misc.c
+ *
+ * $Id$
+ */
+
+/*
+copyright 2002
+the regents of the university of michigan
+all rights reserved
+
+permission is granted to use, copy, create derivative works
+and redistribute this software and such derivative works
+for any purpose, so long as the name of the university of
+michigan is not used in any advertising or publicity
+pertaining to the use or distribution of this software
+without specific, written prior authorization. if the
+above copyright notice or any other identification of the
+university of michigan is included in any copy of any
+portion of this software, then the disclaimer below must
+also be included.
+
+this software is provided as is, without representation
+from the university of michigan as to its fitness for any
+purpose, and without warranty by the university of
+michigan of any kind, either express or implied, including
+without limitation the implied warranties of
+merchantability and fitness for a particular purpose. the
+regents of the university of michigan shall not be liable
+for any damages, including special, indirect, incidental, or
+consequential damages, with respect to any claim arising
+out of or in connection with the use of the software, even
+if it has been or is hereafter advised of the possibility of
+such damages.
+*/
+
/*
* Copyright 2000, International Business Machines Corporation and others.
* All Rights Reserved.
* directory or online at http://www.openafs.org/dl/license10.html
*/
-/*
- * osi_misc.c
- *
- * OpenBSD version of afs_osi_suser() by Jim Rees.
- * See osi_machdep.h for afs_suser macro. It simply calls afs_osi_suser()
- * with the creds of the current process.
- */
-
#include <afsconfig.h>
#include "afs/param.h"
* Note that it must NOT set errno.
*/
+/*
+ * OpenBSD version of afs_osi_suser() by Jim Rees.
+ * See osi_machdep.h for afs_suser macro. It simply calls afs_osi_suser()
+ * with the creds of the current process.
+ */
+
int
afs_osi_suser(void *credp)
{
return (suser((struct ucred *) credp, &curproc->p_acflag) ? 0 : 1);
}
+void *
+afs_nbsd_Alloc(size_t asize)
+{
+ void *p;
+
+ MALLOC(p, void *, asize, M_AFSGENERIC, M_WAITOK);
+ return p;
+}
+
+void
+afs_nbsd_Free(void *p, size_t asize)
+{
+ FREE(p, M_AFSGENERIC);
+}
+
int
afs_syscall_icreate(dev, near_inode, param1, param2, param3, param4, retval)
- long *retval;
- long dev, near_inode, param1, param2, param3, param4;
+long *retval;
+long dev, near_inode, param1, param2, param3, param4;
{
return EINVAL;
}
int
afs_syscall_iopen(dev, inode, usrmod, retval)
- long *retval;
- int dev, inode, usrmod;
+long *retval;
+int dev, inode, usrmod;
{
return EINVAL;
}
int
afs_syscall_iincdec(dev, inode, inode_p1, amount)
- int dev, inode, inode_p1, amount;
+int dev, inode, inode_p1, amount;
{
return EINVAL;
}
return error;
}
-#if 0
-int
-afs_rdwr(struct vnode *vp, struct uio *uiop, enum uio_rw op,
- int flags, struct AFS_UCRED *cred)
-{
- uiop->uio_rw = op;
- if (op == UIO_READ)
- return VOP_READ(vp, uiop, flags, cred);
- if (op == UIO_WRITE)
- return VOP_WRITE(vp, uiop, flags, cred);
-#ifdef DIAGNOSTIC
- panic("afs_rdwr mode");
-#endif
- return EINVAL;
-}
-#endif
-
int
afs_quotactl()
{
extern int afs_NFSRootOnly; /* 1 => only allow NFS mounts of /afs. */
+
+int
#if !defined(AFS_DEC_ENV) && !defined(AFS_ATHENA_ENV)
#ifdef AFS_AIX41_ENV
afs_fid(OSI_VC_ARG(avc), fidpp, credp)
SizeOfSmallFid = sizeof(addr);
#endif /* defined(AFS_SGI61_ENV) && (_MIPS_SZPTR == 64) */
addr[0] = (long)avc;
-#ifndef AFS_AIX41_ENV
+#if defined(AFS_OBSD_ENV)
+ osi_vnhold(avc, 0);
+#elif !defined(AFS_AIX41_ENV)
/* No post processing, so don't hold ref count. */
VN_HOLD(AFSTOV(avc));
#endif
* afs_lookup
* EvalMountPoint
* afs_DoBulkStat
- *
- * Locals:
- * afs_strcat
- * AFS_EQ_ATSYS (macro)
- * afs_index
*/
#include <afsconfig.h>
/* was: (AFS_DEC_ENV) || defined(AFS_OSF30_ENV) || defined(AFS_NCR_ENV) */
static int AFSDOBULK = 1;
+int
#ifdef AFS_OSF_ENV
afs_lookup(adp, ndp)
struct vcache *adp;
/* Note that we don't set CDirty here, this is OK because the unlink
* RPC is called synchronously */
+int
#ifdef AFS_OSF_ENV
afs_remove(ndp)
struct nameidata *ndp; {
cred = avc->uncred;
avc->uncred = NULL;
-#ifdef AFS_DARWIN_ENV
+#if defined(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
refcounts and hope nobody else can touch the file now */
osi_Assert(VREFCOUNT(avc) == 0);
VREFCOUNT_SET(avc, 1);
+#elif defined(AFS_OBSD_ENV)
+ /*
+ * I suspect OpenBSD has the same problem as Darwin, but I'm
+ * going to be brave and try it this way for now.
+ */
+ osi_vnhold(avc, 0);
+#else
+ VN_HOLD(AFSTOV(avc));
#endif
- VN_HOLD(&avc->v);
/* We'll only try this once. If it fails, just release the vnode.
* Clear after doing hold so that NewVCache doesn't find us yet.
#ifdef AFS_DEC_ENV
avc->vrefCount++;
#else
-#ifdef AFS_NETBSD_ENV
+#if defined(AFS_NETBSD_ENV) || defined(AFS_OBSD_ENV)
AFS_HOLD(AFSTOV(avc));
#else
VN_HOLD(AFSTOV(avc));
return osi_linux_alloc(x, 1);
#else
size = x;
-#ifdef AFS_OBSD_ENV
- MALLOC(tm, struct osimem *, size, M_AFSGENERIC, M_WAITOK);
-#else
tm = (struct osimem *) AFS_KALLOC(size);
-#endif
#ifdef AFS_SUN_ENV
if (!tm)
osi_Panic("osi_Alloc: Couldn't allocate %d bytes; out of memory!\n",
size = x;
AFS_STATS(afs_stats_cmperf.OutStandingAllocs++);
AFS_STATS(afs_stats_cmperf.OutStandingMemUsage += x);
-#ifdef AFS_OBSD_ENV
- MALLOC(tm, struct osimem *, size, M_AFSGENERIC, 0);
-#else
tm = (struct osimem *) AFS_KALLOC_NOSLEEP(size);
-#endif
return (void *) tm;
}
AFS_STATS(afs_stats_cmperf.OutStandingMemUsage -= asize);
#if defined(AFS_LINUX20_ENV)
osi_linux_free(x);
-#elif defined(AFS_OBSD_ENV)
- FREE(x, M_AFSGENERIC);
#else
AFS_KFREE((struct osimem *)x, asize);
#endif
#endif
/* afs_osi_pag.c */
+extern int afs_setpag();
extern afs_uint32 genpag(void);
extern afs_uint32 getpag(void);
#if defined(AFS_OSF_ENV) || defined(AFS_DARWIN_ENV) || defined(AFS_XBSD_ENV)
extern int afs_osi_SleepSig(void *event);
#endif
+
+/* ARCH/osi_inode.c */
+extern int afs_syscall_icreate();
+extern int afs_syscall_iopen();
+extern int afs_syscall_iincdec();
+
+
/* ARCH/osi_file.c */
extern int afs_osicred_initialized;
#if defined(AFS_SUN57_64BIT_ENV) || defined(AFS_SGI62_ENV)
/* VNOPS/afs_vnop_lookup.c */
-extern char *afs_strcat(register char *s1, register char *s2);
-extern char *afs_index(register char *a, register char c);
extern int EvalMountPoint(register struct vcache *avc, struct vcache *advc,
struct volume **avolpp, register struct vrequest *areq);
extern void afs_InitFakeStat(struct afs_fakestat_state *state);
extern int Next_AtSys(register struct vcache *avc, struct vrequest *areq,
struct sysname_info *state);
extern int afs_DoBulkStat(struct vcache *adp, long dirCookie, struct vrequest *areqp);
-
+extern int afs_lookup();
/* VNOPS/afs_vnop_read.c */
extern int afs_remunlink(register struct vcache *avc, register int doit);
+/* VNOPS/afs_vnop_rename.c */
+extern int afsrename();
+
+
/* VNOPS/afs_vnop_symlink.c */
extern int afs_MemHandleLink(register struct vcache *avc, struct vrequest *areq);
static struct volume *afs_NewVolumeByName(char *aname, afs_int32 acell, int agood,
struct vrequest *areq, afs_int32 locktype);
static struct volume *afs_NewDynrootVolume(struct VenusFid *fid);
-static inVolList();
+static int inVolList(struct VenusFid *fid, afs_int32 nvols, afs_int32 *vID, afs_int32 *cID);
/* Convert a volume name to a #; return 0 if can't parse as a number */
#define AFS_OBSD_ENV 1
#define AFS_NONFSTRANS 1
#define AFS_KERBEROS_ENV 1
-#define FTRUNC O_TRUNC
-
-#define IUPD 0x0010
-#define IACC 0x0020
-#define ICHG 0x0040
-#define IMOD 0x0080
-
-#define IN_LOCK(ip) lockmgr(&ip->i_lock, LK_EXCLUSIVE, \
- NULL, curproc)
-#define IN_UNLOCK(ip) lockmgr(&ip->i_lock, LK_RELEASE, \
- NULL, curproc)
-
-#define AFS_VM_RDWR_ENV 0
+#define AFS_VM_RDWR_ENV 1
#define AFS_VFS_ENV 1
#define AFS_VFSINCL_ENV 1
-#define AFS_GREEDY43_ENV 1
-#define AFS_ENV 1
+
+#define FTRUNC O_TRUNC
#define AFS_SYSCALL 210
#define AFS_MOUNT_AFS "afs"
#define SYS_NAME "i386_obsd31"
#define SYS_NAME_ID 2002
-#define AFS_HAVE_FFS 1 /* Use system's ffs. */
-#define AFS_HAVE_STATVFS 0 /* System doesn't supports statvfs */
-
#define RXK_LISTENER_ENV 1
#define AFS_GCPAGS 0 /* if nonzero, garbage collect PAGs */
#define AFS_USE_GETTIMEOFDAY 1 /* use gettimeofday to implement rx clock */
/* Extra kernel definitions (from kdefs file) */
#ifdef _KERNEL
-/* #define AFS_GLOBAL_SUNLOCK 1 */
-#define AFS_VFS34 1 /* What is VFS34??? */
#define AFS_SHORTGID 0 /* are group id's short? */
-#define afsio_iov uio_iov
-#define afsio_iovcnt uio_iovcnt
-#define afsio_offset uio_offset
-#define afsio_seg uio_segflg
-#define afsio_resid uio_resid
-#define AFS_UIOSYS UIO_SYSSPACE
-#define AFS_UIOUSER UIO_USERSPACE
-#define AFS_CLBYTES MB_CLBYTES
-#define osi_GetTime(x) microtime(x)
-#define AFS_KALLOC(x) osi_Alloc(x)
-#define AFS_KFREE(x, y) osi_Free((x), (y))
-#define v_count v_usecount
-#define v_vfsp v_mount
-#define vfs_bsize mnt_stat.f_bsize
-#define vfs_fsid mnt_stat.f_fsid
-#define va_nodeid va_fileid
-#define vfs_vnodecovered mnt_vnodecovered
-#define vnode_t struct vnode
-#define setgroups sys_setgroups
-
-#ifndef MUTEX_DEFAULT
-#define MUTEX_DEFAULT 0
-#endif /* MUTEX_DEFAULT */
-
-#ifndef SSYS
-#define SSYS 0x00002
-#endif /* SSYS */
-
-#define p_rcred p_ucred
-
-#define VN_RELE(vp) vrele(((struct vnode *)(vp)))
-#define VN_HOLD(vp) VREF(((struct vnode *)(vp)))
#if !defined(ASSEMBLER) && !defined(__LANGUAGE_ASSEMBLY__)
enum vcexcl {NONEXCL, EXCL};
-#ifdef KERNEL
#ifndef MIN
#define MIN(A,B) ((A) < (B) ? (A) : (B))
#endif
#ifndef MAX
#define MAX(A,B) ((A) > (B) ? (A) : (B))
#endif
-#endif /* KERNEL */
#endif /* ! ASSEMBLER & ! __LANGUAGE_ASSEMBLY__ */
#endif /* _KERNEL */
afs_vnop_attrs.o \
afs_vnop_create.o \
afs_vnop_dirops.o \
- afs_vnop_fid.o \
afs_vnop_flock.o \
afs_vnop_link.o \
afs_vnop_lookup.o \
afs_nfsdisp.o \
afs_call_nfs.o \
afs_pioctl_nfs.o \
+ afs_vnop_fid.o \
$(AFS_OS_NFSOBJS)
AFSNONFSOBJS = \
/* common.c */
/* vsprocs.c */
+struct nvldbentry;
extern void MapPartIdIntoName(afs_int32 partId, char *partName);
extern int yesprompt(char *str);
extern int PrintError(char *msg, afs_int32 errcode);