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
19 #ifndef _OSI_MACHDEP_H_
20 #define _OSI_MACHDEP_H_
24 #define getpid() curproc
25 extern struct simplelock afs_rxglobal_lock;
30 extern struct timeval time;
31 #define osi_Time() (time.tv_sec)
34 #define M_AFSFID (M_TEMP-1)
35 #define M_AFSBUFHDR (M_TEMP-2)
36 #define M_AFSBUFFER (M_TEMP-3)
37 #define M_AFSGENERIC (M_TEMP-4)
41 #define AFS_UCRED ucred
42 #define AFS_PROC struct proc
44 #define afs_bufferpages bufpages
46 #define osi_vnhold(avc,r) do { \
47 if ((avc)->vrefCount) { VN_HOLD((struct vnode *)(avc)); } \
48 else osi_Panic("refcnt==0"); } while(0)
50 #define gop_rdwr(rw,gp,base,len,offset,segflg,unit,cred,aresid) \
51 vn_rdwr((rw),(gp),(base),(len),(offset),(segflg),(unit),(cred),(aresid), curproc)
53 #define afs_suser() afs_osi_suser(osi_curcred())
55 extern int (**afs_vnodeop_p)();
56 #define SetAfsVnode(vn) /* nothing; done in getnewvnode() */
57 #define IsAfsVnode(vn) ((vn)->v_op == afs_vnodeop_p)
59 #define AFS_HOLD(vp) afs_nbsd_ref(vp)
60 #define AFS_RELE(vp) afs_nbsd_rele(vp)
61 extern void afs_nbsd_ref(struct vnode *);
62 extern void afs_nbsd_rele(struct vnode *);
64 #define va_nodeid va_fileid
65 #define v_vfsp v_mount
66 #define vfs_vnodecovered mnt_vnodecovered
67 #define vfs_bsize mnt_stat.f_bsize
68 typedef void (*osi_timeout_t)(void *);
69 #define osi_timeout_t_done
70 #define osi_curproc() (curproc)
71 #define osi_curcred() (curproc->p_cred->pc_ucred)
73 #define osi_vfs_bsize mnt_stat.f_bsize
74 #define osi_vfs_fsid mnt_stat.f_fsid
75 #define afs_osi_alloc osi_Alloc
76 #define afs_osi_free osi_Free
77 #define printk printf /* for RX version of xdr_* */
78 #define vType(vc) (vc)->v->v_type
79 #define vSetType(vc, type) AFSTOV(vc)->v_type = (type)
80 #define vSetVfsp(vc, vfsp) AFSTOV(vc)->v_mount = (vfsp)
81 #define osi_sleep(chan, pri) tsleep((chan), pri, "afs", 0)
82 #define afs_osi_Sleep(chan) tsleep((chan), PVFS, "afs", 0)
83 #define afs_osi_Wakeup(chan) (wakeup(chan), 1)
84 #define FTRUNC O_TRUNC
85 #define FEXLOCK O_EXLOCK
86 #define FSHLOCK O_SHLOCK
89 /* no protoytpe 'cuz our includers don't always have uio_rw in scope first */
90 extern int afs_nbsd_rdwr();
91 extern int afs_nbsd_lookupname();
92 extern void afs_nbsd_getnewvnode();
94 #define VOP_RDWR afs_nbsd_rdwr
95 #define gop_lookupname(fnamep, segflg, followlink, dirvpp, compvpp) \
96 afs_nbsd_lookupname((fnamep), (segflg), (followlink), (dirvpp), (compvpp))
99 extern struct simplelock afs_global_lock;
101 #ifndef AFS_GLOBAL_SUNLOCK
102 #define AFS_ASSERT_GLOCK()
105 #define AFS_GUNLOCK()
106 #define AFS_RXGLOCK()
107 #define AFS_RXGUNLOCK()
108 #define ISAFS_RXGLOCK() 1
109 #define ISAFS_GLOCK() 1
119 #endif /* _OSI_MACHDEP_H_ */