X-Git-Url: https://git.openafs.org/?p=openafs.git;a=blobdiff_plain;f=src%2Fafs%2FOBSD%2Fosi_machdep.h;h=1cb9d781ae75c3cf5e12545e070d2f42efd7846d;hp=bbcdce5c1b44f85842bc56e57e293eedc50c4fe8;hb=0bc7169a9c7abf2dc1b2a13cb97bf366a3174649;hpb=4caeeb438887b94d70e23ed4bc7317d23b48edee diff --git a/src/afs/OBSD/osi_machdep.h b/src/afs/OBSD/osi_machdep.h index bbcdce5..1cb9d78 100644 --- a/src/afs/OBSD/osi_machdep.h +++ b/src/afs/OBSD/osi_machdep.h @@ -16,77 +16,95 @@ * afs_osi.h. */ -/* Id: $ */ +/* $Id$ */ #ifndef _OSI_MACHDEP_H_ #define _OSI_MACHDEP_H_ #include -#define getpid() curproc extern struct simplelock afs_rxglobal_lock; -/* - * Time related macros - */ -extern struct timeval time; -#define osi_Time() (time.tv_sec) -#define afs_hz hz - #define M_AFSFID (M_TEMP-1) #define M_AFSBUFHDR (M_TEMP-2) #define M_AFSBUFFER (M_TEMP-3) #define M_AFSGENERIC (M_TEMP-4) -#define PAGESIZE 8192 - -#define AFS_UCRED ucred -#define AFS_PROC struct proc - -#define SetAfsVnode(vn) /* nothing; done in getnewvnode() */ -#define IsAfsVnode(vn) ((vn)->v_op == afs_vnodeop_p) - -#define p_rcred p_ucred +/* vfs */ +#define osi_vfs mount +#define osi_vfs_bsize mnt_stat.f_bsize +#define osi_vfs_fsid mnt_stat.f_fsid +#define vfs_bsize mnt_stat.f_bsize +#define vfs_fsid mnt_stat.f_fsid +#define vfs_vnodecovered mnt_vnodecovered +#define v_vfsp v_mount +/* vnode */ +#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) +#define VN_HOLD(vp) afs_vget((vp), 0) #define osi_vnhold(avc, r) afs_vget(AFSTOV(avc), 0) +#define va_nodeid va_fileid +#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 +/* uio */ #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()) + +/* malloc */ +#define AFS_KALLOC(s) afs_nbsd_Alloc(s) +#define AFS_KFREE(p, s) afs_nbsd_Free((p), (s)) + +/* proc, cred */ +#define AFS_PROC struct proc +#define AFS_UCRED ucred +#define afs_suser() afs_osi_suser(osi_curcred()) +#define getpid() curproc #define osi_curcred() (curproc->p_cred->pc_ucred) -#define osi_curproc() (curproc) +#define osi_curproc() curproc +#define p_rcred p_ucred + +/* time */ +extern struct timeval time; +#define afs_hz hz #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 printk printf /* for RX version of xdr_* */ +#define osi_Time() (time.tv_sec) + +/* str */ +#define afs_strcasecmp(s1, s2) strncasecmp((s1), (s2), 65535) +#ifdef AFS_OBSD34_ENV +#define strcpy(s1, s2) afs_strcpy((s1), (s2)) +#define strcat(s1, s2) afs_strcat((s1), (s2)) +#else +#define afs_strcat(s1, s2) strcat((s1), (s2)) +#endif + +/* other */ +#define afs_bufferpages bufpages +#ifndef iodone +#define iodone biodone +#endif +#define PAGESIZE 8192 +#define printk printf /* for RX version of xdr_* */ #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 /* 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 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 *); @@ -98,25 +116,43 @@ extern int afs_vget(); afs_nbsd_lookupname((fnamep), (segflg), (followlink), (dirvpp), (compvpp)) #ifdef KERNEL -extern int (**afs_vnodeop_p)(); +extern int (**afs_vnodeop_p) (); + +#ifdef AFS_GLOBAL_SUNLOCK +extern struct proc *afs_global_owner; +extern struct lock afs_global_lock; +#define AFS_GLOCK() \ + do { \ + osi_Assert(curproc); \ + lockmgr(&afs_global_lock, LK_EXCLUSIVE, 0, curproc); \ + osi_Assert(afs_global_owner == NULL); \ + afs_global_owner = curproc; \ + } while (0) +#define AFS_GUNLOCK() \ + do { \ + osi_Assert(curproc); \ + osi_Assert(afs_global_owner == curproc); \ + afs_global_owner = NULL; \ + lockmgr(&afs_global_lock, LK_RELEASE, 0, curproc); \ + } while(0) +#define ISAFS_GLOCK() (afs_global_owner == curproc && curproc) +#else extern struct simplelock afs_global_lock; - -#ifndef AFS_GLOBAL_SUNLOCK -#define AFS_ASSERT_GLOCK() -#endif #define AFS_GLOCK() #define AFS_GUNLOCK() +#define AFS_ASSERT_GLOCK() +#define ISAFS_GLOCK() 1 +#endif #define AFS_RXGLOCK() #define AFS_RXGUNLOCK() #define ISAFS_RXGLOCK() 1 -#define ISAFS_GLOCK() 1 #undef SPLVAR -#define SPLVAR +#define SPLVAR int splvar #undef NETPRI -#define NETPRI +#define NETPRI splvar=splnet() #undef USERPRI -#define USERPRI +#define USERPRI splx(splvar) #endif /* KERNEL */ #endif /* _OSI_MACHDEP_H_ */