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 #define M_AFSFID (M_TEMP-1)
27 #define M_AFSBUFHDR (M_TEMP-2)
28 #define M_AFSBUFFER (M_TEMP-3)
29 #define M_AFSGENERIC (M_TEMP-4)
33 #define osi_vfs_bsize mnt_stat.f_bsize
34 #define osi_vfs_fsid mnt_stat.f_fsid
35 #define vfs_bsize mnt_stat.f_bsize
36 #define vfs_fsid mnt_stat.f_fsid
37 #define vfs_vnodecovered mnt_vnodecovered
38 #define v_vfsp v_mount
41 #define VN_HOLD(vp) afs_vget((vp), 0)
42 #define VN_RELE(vp) vrele(vp)
43 #define osi_vnhold(avc, r) afs_vget(AFSTOV(avc), 0)
44 #define va_nodeid va_fileid
45 #define vnode_t struct vnode
48 #define afsio_iov uio_iov
49 #define afsio_iovcnt uio_iovcnt
50 #define afsio_offset uio_offset
51 #define afsio_resid uio_resid
52 #define afsio_seg uio_segflg
53 #define AFS_UIOSYS UIO_SYSSPACE
54 #define AFS_UIOUSER UIO_USERSPACE
57 #define AFS_KALLOC(s) afs_nbsd_Alloc(s)
58 #define AFS_KFREE(p, s) afs_nbsd_Free((p), (s))
61 #define AFS_PROC struct proc
62 #define AFS_UCRED ucred
63 #define afs_suser(x) afs_osi_suser(osi_curcred())
64 #define getpid() curproc
65 #define osi_curcred() (curproc->p_cred->pc_ucred)
66 #define osi_curproc() curproc
67 #define p_rcred p_ucred
71 #define osi_GetTime(x) microtime(x)
72 #define osi_Time() (time.tv_sec)
75 #define afs_strcasecmp(s1, s2) strncasecmp((s1), (s2), 65535)
77 #define strcpy(s1, s2) afs_strcpy((s1), (s2))
78 #define strcat(s1, s2) afs_strcat((s1), (s2))
80 #define afs_strcat(s1, s2) strcat((s1), (s2))
84 #define afs_bufferpages bufpages
86 #define iodone biodone
88 #define printk printf /* for RX version of xdr_* */
89 #define setgroups sys_setgroups
92 /* This is not always in scope yet */
95 extern int afs_nbsd_lookupname(char *fnamep, enum uio_seg segflg,
96 int followlink, struct vnode **compvpp);
97 extern void afs_nbsd_getnewvnode(struct vcache *tvc);
98 extern void *afs_nbsd_Alloc(size_t asize);
99 extern void afs_nbsd_Free(void *p, size_t asize);
100 extern int afs_vget();
102 #undef gop_lookupname
103 #define gop_lookupname(fnamep, segflg, followlink, compvpp) \
104 afs_nbsd_lookupname((fnamep), (segflg), (followlink), (compvpp))
106 #ifdef AFS_OBSD39_ENV
107 #define afs_osi_lockmgr(l, f, i, p) lockmgr((l), (f), (i))
109 #define afs_osi_lockmgr(l, f, i, p) lockmgr((l), (f), (i), (p))
114 #define AFS_GLOCK() AFS_GLOCKP(curproc)
115 #define AFS_GUNLOCK() AFS_GUNLOCKP(curproc)
116 #ifdef AFS_GLOBAL_SUNLOCK
117 extern struct proc *afs_global_owner;
118 extern struct lock afs_global_lock;
119 #define AFS_GLOCKP(p) \
122 afs_osi_lockmgr(&afs_global_lock, LK_EXCLUSIVE, 0, (p)); \
123 osi_Assert(afs_global_owner == NULL); \
124 afs_global_owner = (p); \
126 #define AFS_GUNLOCKP(p) \
129 osi_Assert(afs_global_owner == (p)); \
130 afs_global_owner = NULL; \
131 afs_osi_lockmgr(&afs_global_lock, LK_RELEASE, 0, (p)); \
133 #define ISAFS_GLOCK() (afs_global_owner == curproc && curproc)
135 extern struct lock afs_global_lock;
136 #define AFS_GLOCKP(p)
137 #define AFS_GUNLOCKP(p)
138 #define AFS_ASSERT_GLOCK()
139 #define ISAFS_GLOCK() 1
143 #define SPLVAR int splvar
145 #define NETPRI splvar=splnet()
147 #define USERPRI splx(splvar)
150 #endif /* _OSI_MACHDEP_H_ */