2 * Copyright 2000, International Business Machines Corporation and others.
5 * This software has been released under the terms of the IBM Public
6 * License. For details, see the LICENSE file in the top-level source
7 * directory or online at http://www.openafs.org/dl/license10.html
12 * OpenBSD OSI header file. Extends afs_osi.h.
14 * afs_osi.h includes this file, which is the only way this file should
15 * be included in a source file. This file can redefine macros declared in
21 #ifndef _OSI_MACHDEP_H_
22 #define _OSI_MACHDEP_H_
26 extern struct simplelock afs_rxglobal_lock;
28 #define M_AFSFID (M_TEMP-1)
29 #define M_AFSBUFHDR (M_TEMP-2)
30 #define M_AFSBUFFER (M_TEMP-3)
31 #define M_AFSGENERIC (M_TEMP-4)
35 #define osi_vfs_bsize mnt_stat.f_bsize
36 #define osi_vfs_fsid mnt_stat.f_fsid
37 #define vfs_bsize mnt_stat.f_bsize
38 #define vfs_fsid mnt_stat.f_fsid
39 #define vfs_vnodecovered mnt_vnodecovered
40 #define v_vfsp v_mount
43 #define SetAfsVnode(vn) /* nothing; done in getnewvnode() */
44 #define IsAfsVnode(vn) ((vn)->v_op == afs_vnodeop_p)
45 #define VN_HOLD(vp) afs_vget((vp), 0)
46 #define VN_RELE(vp) vrele(vp)
47 #define osi_vnhold(avc, r) afs_vget(AFSTOV(avc), 0)
48 #define va_nodeid va_fileid
49 #define vnode_t struct vnode
50 #define vSetType(vc, type) AFSTOV(vc)->v_type = (type)
51 #define vSetVfsp(vc, vfsp) AFSTOV(vc)->v_mount = (vfsp)
52 #define vType(vc) (vc)->v->v_type
55 #define afsio_iov uio_iov
56 #define afsio_iovcnt uio_iovcnt
57 #define afsio_offset uio_offset
58 #define afsio_resid uio_resid
59 #define afsio_seg uio_segflg
60 #define AFS_UIOSYS UIO_SYSSPACE
61 #define AFS_UIOUSER UIO_USERSPACE
64 #define AFS_KALLOC(s) afs_nbsd_Alloc(s)
65 #define AFS_KFREE(p, s) afs_nbsd_Free((p), (s))
68 #define AFS_PROC struct proc
69 #define AFS_UCRED ucred
70 #define afs_suser(x) afs_osi_suser(osi_curcred())
71 #define getpid() curproc
72 #define osi_curcred() (curproc->p_cred->pc_ucred)
73 #define osi_curproc() curproc
74 #define p_rcred p_ucred
77 extern struct timeval time;
79 #define osi_GetTime(x) microtime(x)
80 #define osi_Time() (time.tv_sec)
83 #define afs_strcasecmp(s1, s2) strncasecmp((s1), (s2), 65535)
85 #define strcpy(s1, s2) afs_strcpy((s1), (s2))
86 #define strcat(s1, s2) afs_strcat((s1), (s2))
88 #define afs_strcat(s1, s2) strcat((s1), (s2))
92 #define afs_bufferpages bufpages
94 #define iodone biodone
97 #define printk printf /* for RX version of xdr_* */
98 #define setgroups sys_setgroups
101 /* This is not always in scope yet */
104 extern int afs_nbsd_lookupname(char *fnamep, enum uio_seg segflg,
105 int followlink, struct vnode **compvpp);
106 extern void afs_nbsd_getnewvnode(struct vcache *tvc);
107 extern void *afs_nbsd_Alloc(size_t asize);
108 extern void afs_nbsd_Free(void *p, size_t asize);
109 extern int afs_vget();
111 #define gop_lookupname(fnamep, segflg, followlink, compvpp) \
112 afs_nbsd_lookupname((fnamep), (segflg), (followlink), (compvpp))
115 extern int (**afs_vnodeop_p) ();
117 #ifdef AFS_GLOBAL_SUNLOCK
118 extern struct proc *afs_global_owner;
119 extern struct lock afs_global_lock;
120 #define AFS_GLOCK() \
122 osi_Assert(curproc); \
123 lockmgr(&afs_global_lock, LK_EXCLUSIVE, 0, curproc); \
124 osi_Assert(afs_global_owner == NULL); \
125 afs_global_owner = curproc; \
127 #define AFS_GUNLOCK() \
129 osi_Assert(curproc); \
130 osi_Assert(afs_global_owner == curproc); \
131 afs_global_owner = NULL; \
132 lockmgr(&afs_global_lock, LK_RELEASE, 0, curproc); \
134 #define ISAFS_GLOCK() (afs_global_owner == curproc && curproc)
136 extern struct simplelock afs_global_lock;
138 #define AFS_GUNLOCK()
139 #define AFS_ASSERT_GLOCK()
140 #define ISAFS_GLOCK() 1
142 #define AFS_RXGLOCK()
143 #define AFS_RXGUNLOCK()
144 #define ISAFS_RXGLOCK() 1
147 #define SPLVAR int splvar
149 #define NETPRI splvar=splnet()
151 #define USERPRI splx(splvar)
154 #endif /* _OSI_MACHDEP_H_ */