Whamcloud - gitweb
Branch HEAD
[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 <lnet/lnet.h>
26
27 #define our_cond_resched() cfs_schedule_timeout(CFS_TASK_INTERRUPTIBLE, 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 #define LASSERT_SEM_LOCKED(sem) do {} while(0) /* XXX */
35
36 #define LIBCFS_PANIC(msg) panic(msg)
37 #error libcfs_register_panic_notifier() missing
38 #error libcfs_unregister_panic_notifier() missing
39
40 /* --------------------------------------------------------------------- */
41
42 #define PORTAL_SYMBOL_REGISTER(x)               cfs_symbol_register(#x, &x)
43 #define PORTAL_SYMBOL_UNREGISTER(x)             cfs_symbol_unregister(#x)
44
45 #define PORTAL_SYMBOL_GET(x)                    ((typeof(&x))cfs_symbol_get(#x))
46 #define PORTAL_SYMBOL_PUT(x)                    cfs_symbol_put(#x)
47
48 #define PORTAL_MODULE_USE                       do{int i = 0; i++;}while(0)
49 #define PORTAL_MODULE_UNUSE                     do{int i = 0; i--;}while(0)
50
51 #define num_online_cpus()                       cfs_online_cpus()
52
53 /******************************************************************************/
54 /* XXX Liang: There is no module parameter supporting in OSX */
55 #define CFS_MODULE_PARM(name, t, type, perm, desc)
56
57 #define CFS_SYSFS_MODULE_PARM    0 /* no sysfs access to module parameters */
58 /******************************************************************************/
59
60 #else  /* !__KERNEL__ */
61 # include <stdio.h>
62 # include <stdlib.h>
63 # include <stdint.h>
64 # include <unistd.h>
65 # include <time.h>
66 # include <machine/limits.h>
67 # include <sys/types.h>
68 #endif
69
70 #define BITS_PER_LONG   LONG_BIT
71 /******************************************************************************/
72 /* Light-weight trace
73  * Support for temporary event tracing with minimal Heisenberg effect. */
74 #define LWT_SUPPORT  0
75
76 typedef struct {
77         long long   lwte_when;
78         char       *lwte_where;
79         void       *lwte_task;
80         long        lwte_p1;
81         long        lwte_p2;
82         long        lwte_p3;
83         long        lwte_p4;
84 } lwt_event_t;
85
86 # define LWT_EVENT(p1,p2,p3,p4)     /* no lwt implementation yet */
87
88 /* -------------------------------------------------------------------------- */
89
90 #define IOCTL_LIBCFS_TYPE struct libcfs_ioctl_data
91
92 #define LPU64 "%llu"
93 #define LPD64 "%lld"
94 #define LPX64 "%#llx"
95 #define LPSZ  "%lu"
96 #define LPSSZ "%ld"
97 # define LI_POISON ((int)0x5a5a5a5a)
98 # define LL_POISON ((long)0x5a5a5a5a)
99 # define LP_POISON ((void *)(long)0x5a5a5a5a)
100
101 #endif