Commit | Line | Data |
---|---|---|
805e021f CE |
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 | #ifndef RXK_TIMEDSLEEP_ENV | |
19 | #define rxi_ReScheduleEvents 0 /* Not needed by kernel */ | |
20 | #endif | |
21 | ||
22 | /* This is a no-op, because the kernel server procs are pre-allocated */ | |
23 | #define rxi_StartServerProcs(x) (void)0 | |
24 | ||
25 | /* Socket stuff */ | |
26 | typedef struct socket *osi_socket; | |
27 | #define OSI_NULLSOCKET ((osi_socket) 0) | |
28 | ||
29 | #if (!defined(AFS_GLOBAL_SUNLOCK) && !defined(RX_ENABLE_LOCKS)) | |
30 | #include "afs/icl.h" | |
31 | #include "afs/afs_trace.h" | |
32 | #endif | |
33 | #define osi_rxSleep(a) afs_Trace2(afs_iclSetp, CM_TRACE_RXSLEEP, \ | |
34 | ICL_TYPE_STRING, __FILE__, ICL_TYPE_INT32, __LINE__); afs_osi_Sleep(a) | |
35 | #define osi_rxWakeup(a) if (afs_osi_Wakeup(a) == 0) afs_Trace2(afs_iclSetp, \ | |
36 | CM_TRACE_RXWAKE, ICL_TYPE_STRING, __FILE__, ICL_TYPE_INT32, __LINE__) | |
37 | ||
38 | extern int osi_utoa(char *buf, size_t len, unsigned long val); | |
39 | ||
40 | # if defined(AFS_LINUX26_ENV) | |
41 | # define osi_Panic(msg...) \ | |
42 | do { printk(KERN_CRIT "openafs: " msg); BUG(); } while (0) | |
43 | # define osi_Assert(expr) \ | |
44 | do { \ | |
45 | if (!(expr)) \ | |
46 | osi_Panic("assertion failed: %s, file: %s, line: %d\n", \ | |
47 | #expr, __FILE__, __LINE__); \ | |
48 | } while (0) | |
49 | # elif defined(AFS_AIX_ENV) | |
50 | extern void osi_Panic(char *fmt, void *a1, void *a2, void *a3); | |
51 | # define osi_Assert(exp) \ | |
52 | (void)((exp) || (osi_AssertFailK( #exp , __FILE__, __LINE__), 0)) | |
53 | # else | |
54 | extern void osi_Panic(char *fmt, ...) | |
55 | AFS_ATTRIBUTE_FORMAT(__printf__, 1, 2) | |
56 | AFS_NORETURN; | |
57 | # define osi_Assert(exp) \ | |
58 | (void)((exp) || (osi_AssertFailK( #exp , __FILE__, __LINE__), 0)) | |
59 | # endif | |
60 | ||
61 | #ifdef AFS_LINUX20_ENV | |
62 | # define osi_Msg printk)( | |
63 | #else | |
64 | # define osi_Msg printf)( | |
65 | #endif | |
66 | #define osi_VMsg vprintf)( | |
67 | ||
68 | #define osi_YieldIfPossible() | |
69 | #define osi_WakeupAndYieldIfPossible(x) rx_Wakeup(x) | |
70 | ||
71 | #if !defined(AFS_DARWIN80_ENV) || defined(UKERNEL) | |
72 | # ifdef UKERNEL | |
73 | # define rx_ifnet_t struct usr_ifnet * | |
74 | # define rx_ifaddr_t struct usr_ifaddr * | |
75 | # else | |
76 | # define rx_ifnet_t struct ifnet * | |
77 | # define rx_ifaddr_t struct ifaddr * | |
78 | #endif | |
79 | #define rx_ifnet_mtu(x) (x)->if_mtu | |
80 | #define rx_ifnet_flags(x) (x?(x)->if_flags:0) | |
81 | #if defined(FBSD_IFA_IFWITHNET_THREE_ARGS) | |
82 | #define rx_ifaddr_withnet(x) ifa_ifwithnet(x, 0, RT_ALL_FIBS) | |
83 | #elif defined(AFS_OBSD46_ENV) || defined(AFS_FBSD81_ENV) | |
84 | #define rx_ifaddr_withnet(x) ifa_ifwithnet(x, 0) | |
85 | #else | |
86 | #define rx_ifaddr_withnet(x) ifa_ifwithnet(x) | |
87 | #endif | |
88 | #if defined(FBSD_IF_METRIC_IN_STRUCT_IFNET) | |
89 | #define rx_ifnet_metric(x) (x?(x)->if_metric:0) | |
90 | #else | |
91 | #define rx_ifnet_metric(x) (x?(x)->if_data.ifi_metric:0) | |
92 | #endif | |
93 | #define rx_ifaddr_ifnet(x) (x?(x)->ifa_ifp:0) | |
94 | #define rx_ifaddr_address_family(x) (x)->ifa_addr->sa_family | |
95 | #define rx_ifaddr_address(x, y, z) memcpy(y, (x)->ifa_addr, z) | |
96 | #define rx_ifaddr_netmask(x, y, z) memcpy(y, (x)->ifa_netmask, z) | |
97 | #define rx_ifaddr_dstaddress(x, y, z) memcpy(y, (x)->ifa_dstaddr, z) | |
98 | #else | |
99 | #define rx_ifnet_t ifnet_t | |
100 | #define rx_ifaddr_t ifaddr_t | |
101 | #define rx_ifaddr_withnet(x) ifaddr_withnet(x) | |
102 | #define rx_ifnet_mtu(x) ifnet_mtu(x) | |
103 | #define rx_ifnet_flags(x) ifnet_flags(x) | |
104 | #define rx_ifnet_metric(x) ifnet_metric(x) | |
105 | #define rx_ifaddr_ifnet(x) ifaddr_ifnet(x) | |
106 | #define rx_ifaddr_address_family(x) ifaddr_address_family(x) | |
107 | #define rx_ifaddr_address(x, y, z) ifaddr_address(x, y, z) | |
108 | #define rx_ifaddr_netmask(x, y, z) ifaddr_netmask(x, y, z) | |
109 | #define rx_ifaddr_dstaddress(x, y, z) ifaddr_dstaddress(x, y, z) | |
110 | #endif | |
111 | ||
112 | #endif /* __RX_KERNEL_INCL_ */ |