Whamcloud - gitweb
7f765e17d420205c8332cbee4e690e4a0d31a56d
[fs/lustre-release.git] / lnet / include / libcfs / darwin / kp30.h
1 /* -*- mode: c; c-basic-offset: 8; indent-tabs-mode: nil; -*-
2  * vim:expandtab:shiftwidth=8:tabstop=8:
3  */
4 #ifndef __LIBCFS_DARWIN_KP30__
5 #define __LIBCFS_DARWIN_KP30__
6
7 #ifndef __LIBCFS_KP30_H__
8 #error Do not #include this file directly. #include <libcfs/kp30.h> instead
9 #endif
10
11 #ifdef __KERNEL__
12
13 #include <sys/types.h>
14 #include <sys/malloc.h>
15 #include <sys/systm.h>
16 #include <mach/mach_types.h>
17 #include <string.h>
18 #include <sys/file.h>
19 #include <sys/conf.h>
20 #include <miscfs/devfs/devfs.h>
21 #include <stdarg.h>
22
23 #include <libcfs/darwin/darwin-lock.h>
24 #include <libcfs/darwin/darwin-prim.h>
25 #include <portals/p30.h>
26
27 #define our_cond_resched()              schedule_timeout(1);
28
29 #ifdef CONFIG_SMP
30 #define LASSERT_SPIN_LOCKED(lock) do {} while(0) /* XXX */
31 #else
32 #define LASSERT_SPIN_LOCKED(lock) do {} while(0)
33 #endif
34
35 #define LBUG_WITH_LOC(file, func, line)         do {} while(0)
36
37 /* --------------------------------------------------------------------- */
38
39 #define PORTAL_SYMBOL_REGISTER(x)               cfs_symbol_register(#x, &x)
40 #define PORTAL_SYMBOL_UNREGISTER(x)             cfs_symbol_unregister(#x)
41
42 #define PORTAL_SYMBOL_GET(x)                    ((typeof(&x))cfs_symbol_get(#x))
43 #define PORTAL_SYMBOL_PUT(x)                    cfs_symbol_put(#x)
44
45 #define PORTAL_MODULE_USE                       do{int i = 0; i++;}while(0)
46 #define PORTAL_MODULE_UNUSE                     do{int i = 0; i--;}while(0)
47
48 #define printk(format, args...)                 printf(format, ## args)
49
50 #else  /* !__KERNEL__ */
51 # include <stdio.h>
52 # include <stdlib.h>
53 # include <stdint.h>
54 # include <unistd.h>
55 # include <time.h>
56 # include <machine/limits.h>
57 # include <sys/types.h>
58 #endif
59
60 /******************************************************************************/
61 /* Light-weight trace
62  * Support for temporary event tracing with minimal Heisenberg effect. */
63 #define LWT_SUPPORT  0
64
65 typedef struct { 
66         long long   lwte_when; 
67         char       *lwte_where; 
68         void       *lwte_task; 
69         long        lwte_p1; 
70         long        lwte_p2; 
71         long        lwte_p3; 
72         long        lwte_p4; 
73 } lwt_event_t;
74
75 # define LWT_EVENT(p1,p2,p3,p4)     /* no lwt implementation yet */
76
77 /* -------------------------------------------------------------------------- */
78
79 #define IOCTL_PORTAL_TYPE struct portal_ioctl_data
80
81 #define LPU64 "%llu"
82 #define LPD64 "%lld"
83 #define LPX64 "%llx"
84 #define LPSZ  "%lu"
85 #define LPSSZ "%ld"
86 # define LI_POISON ((int)0x5a5a5a5a)
87 # define LL_POISON ((long)0x5a5a5a5a)
88 # define LP_POISON ((void *)(long)0x5a5a5a5a)
89
90 #endif