darwin rx if structure fix
[openafs.git] / src / rx / rx_kernel.h
1 /*
2  * Copyright 2000, International Business Machines Corporation and others.
3  * All Rights Reserved.
4  * 
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
8  */
9
10 /* Definitions specific to the in-kernel implementation of Rx, for in-kernel clients */
11
12 #ifndef __RX_KERNEL_INCL_
13 #define __RX_KERNEL_INCL_   1
14
15 #define osi_Alloc afs_osi_Alloc
16 #define osi_Free  afs_osi_Free
17
18 #define rxi_ReScheduleEvents    0       /* Not needed by kernel */
19
20 /* This is a no-op, because the kernel server procs are pre-allocated */
21 #define rxi_StartServerProcs(x) (void)0
22
23 /* Socket stuff */
24 typedef struct socket *osi_socket;
25 #define OSI_NULLSOCKET  ((osi_socket) 0)
26
27 #if (!defined(AFS_GLOBAL_SUNLOCK) && !defined(RX_ENABLE_LOCKS))
28 #include "afs/icl.h"
29 #include "afs/afs_trace.h"
30 #endif
31 #define osi_rxSleep(a)  afs_Trace2(afs_iclSetp, CM_TRACE_RXSLEEP, \
32         ICL_TYPE_STRING, __FILE__, ICL_TYPE_INT32, __LINE__); afs_osi_Sleep(a)
33 #define osi_rxWakeup(a) if (afs_osi_Wakeup(a) == 0) afs_Trace2(afs_iclSetp, \
34         CM_TRACE_RXWAKE, ICL_TYPE_STRING, __FILE__, ICL_TYPE_INT32, __LINE__)
35
36 extern int osi_utoa(char *buf, size_t len, unsigned long val);
37 #define osi_Assert(e) (void)((e) || (osi_AssertFailK(#e, __FILE__, __LINE__), 0))
38
39 #define osi_Msg printf)(
40 #define osi_VMsg vprintf)(
41
42 #define osi_YieldIfPossible()
43 #define osi_WakeupAndYieldIfPossible(x)     rx_Wakeup(x)
44
45 #if !defined(AFS_DARWIN80_ENV) || defined(UKERNEL)
46 # ifdef UKERNEL
47 # define rx_ifnet_t struct usr_ifnet *
48 # define rx_ifaddr_t struct usr_ifaddr *
49 # else
50 # define rx_ifnet_t struct ifnet *
51 # define rx_ifaddr_t struct ifaddr *
52 #endif
53 #define rx_ifnet_mtu(x) (x)->if_mtu
54 #define rx_ifnet_flags(x) (x?(x)->if_flags:0)
55 #define rx_ifaddr_withnet(x) ifa_ifwithnet(x)
56 #define rx_ifnet_metric(x) (x?(x)->if_data.ifi_metric:0)
57 #define rx_ifaddr_ifnet(x) (x?(x)->ifa_ifp:0)
58 #define rx_ifaddr_address_family(x) (x)->ifa_addr->sa_family
59 #define rx_ifaddr_address(x, y, z) memcpy(y, (x)->ifa_addr, z)
60 #define rx_ifaddr_netmask(x, y, z) memcpy(y, (x)->ifa_netmask, z)
61 #define rx_ifaddr_dstaddress(x, y, z) memcpy(y, (x)->ifa_dstaddr, z)
62 #else
63 #define rx_ifnet_t ifnet_t
64 #define rx_ifaddr_t ifaddr_t
65 #define rx_ifaddr_withnet(x) ifaddr_withnet(x)
66 #define rx_ifnet_mtu(x) ifnet_mtu(x)
67 #define rx_ifnet_flags(x) ifnet_flags(x)
68 #define rx_ifnet_metric(x) ifnet_metric(x)
69 #define rx_ifaddr_ifnet(x) ifaddr_ifnet(x)
70 #define rx_ifaddr_address_family(x) ifaddr_address_family(x)
71 #define rx_ifaddr_address(x, y, z) ifaddr_address(x, y, z)
72 #define rx_ifaddr_netmask(x, y, z) ifaddr_netmask(x, y, z)
73 #define rx_ifaddr_dstaddress(x, y, z) ifaddr_dstaddress(x, y, z)
74 #endif
75
76 #endif /* __RX_KERNEL_INCL_ */