]> CyberLeo.Net >> Repos - FreeBSD/releng/9.0.git/blob - sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys/zfs_context.h
Copy stable/9 to releng/9.0 as part of the FreeBSD 9.0-RELEASE release
[FreeBSD/releng/9.0.git] / sys / cddl / contrib / opensolaris / uts / common / fs / zfs / sys / zfs_context.h
1 /*
2  * CDDL HEADER START
3  *
4  * The contents of this file are subject to the terms of the
5  * Common Development and Distribution License (the "License").
6  * You may not use this file except in compliance with the License.
7  *
8  * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
9  * or http://www.opensolaris.org/os/licensing.
10  * See the License for the specific language governing permissions
11  * and limitations under the License.
12  *
13  * When distributing Covered Code, include this CDDL HEADER in each
14  * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
15  * If applicable, add the following below this CDDL HEADER, with the
16  * fields enclosed by brackets "[]" replaced with your own identifying
17  * information: Portions Copyright [yyyy] [name of copyright owner]
18  *
19  * CDDL HEADER END
20  */
21 /*
22  * Copyright 2009 Sun Microsystems, Inc.  All rights reserved.
23  * Use is subject to license terms.
24  */
25
26 #ifndef _SYS_ZFS_CONTEXT_H
27 #define _SYS_ZFS_CONTEXT_H
28
29 #ifdef  __cplusplus
30 extern "C" {
31 #endif
32
33 #include <sys/param.h>
34 #include <sys/stdint.h>
35 #include <sys/note.h>
36 #include <sys/kernel.h>
37 #include <sys/debug.h>
38 #include <sys/systm.h>
39 #include <sys/proc.h>
40 #include <sys/sysmacros.h>
41 #include <sys/bitmap.h>
42 #include <sys/cmn_err.h>
43 #include <sys/kmem.h>
44 #include <sys/taskq.h>
45 #include <sys/taskqueue.h>
46 #include <sys/systm.h>
47 #include <sys/conf.h>
48 #include <sys/mutex.h>
49 #include <sys/rwlock.h>
50 #include <sys/kcondvar.h>
51 #include <sys/random.h>
52 #include <sys/byteorder.h>
53 #include <sys/systm.h>
54 #include <sys/list.h>
55 #include <sys/zfs_debug.h>
56 #include <sys/sysevent.h>
57 #include <sys/uio.h>
58 #include <sys/dirent.h>
59 #include <sys/time.h>
60 #include <sys/uio.h>
61 #include <sys/fcntl.h>
62 #include <sys/limits.h>
63 #include <sys/string.h>
64 #include <sys/bio.h>
65 #include <sys/buf.h>
66 #include <sys/cred.h>
67 #include <sys/sdt.h>
68 #include <sys/file.h>
69 #include <sys/vfs.h>
70 #include <sys/sysctl.h>
71 #include <sys/sbuf.h>
72 #include <sys/priv.h>
73 #include <sys/kdb.h>
74 #include <sys/ktr.h>
75 #include <sys/stack.h>
76 #include <sys/lockf.h>
77 #include <sys/pathname.h>
78 #include <sys/policy.h>
79 #include <sys/refstr.h>
80 #include <sys/zone.h>
81 #include <sys/eventhandler.h>
82 #include <sys/extattr.h>
83 #include <sys/misc.h>
84 #include <sys/sig.h>
85 #include <sys/osd.h>
86 #include <sys/sysevent/dev.h>
87 #include <sys/sysevent/eventdefs.h>
88 #include <sys/u8_textprep.h>
89 #include <sys/fm/util.h>
90 #include <sys/sunddi.h>
91
92 #include <machine/stdarg.h>
93
94 #include <vm/vm.h>
95 #include <vm/vm_page.h>
96 #include <vm/vm_object.h>
97 #include <vm/vm_pager.h>
98 #include <vm/vm_kern.h>
99 #include <vm/vm_map.h>
100 /* There is clash. vm_map.h defines the two below and vdev_cache.c use them. */
101 #ifdef min_offset
102 #undef min_offset
103 #endif
104 #ifdef max_offset
105 #undef max_offset
106 #endif
107 #include <vm/vm_extern.h>
108 #include <vm/vnode_pager.h>
109
110 #define CPU_SEQID       (curcpu)
111
112 #define tsd_create(keyp, destructor)    do {                            \
113         *(keyp) = osd_thread_register((destructor));                    \
114         KASSERT(*(keyp) > 0, ("cannot register OSD"));                  \
115 } while (0)
116 #define tsd_destroy(keyp)               osd_thread_deregister(*(keyp))
117 #define tsd_get(key)                    osd_thread_get(curthread, (key))
118 #define tsd_set(key, value)             osd_thread_set(curthread, (key), (value))
119
120 #ifdef  __cplusplus
121 }
122 #endif
123
124 extern int zfs_debug_level;
125 extern struct mtx zfs_debug_mtx;
126 #define ZFS_LOG(lvl, ...)       do {                                    \
127         if (((lvl) & 0xff) <= zfs_debug_level) {                        \
128                 mtx_lock(&zfs_debug_mtx);                               \
129                 printf("%s:%u[%d]: ", __func__, __LINE__, (lvl));       \
130                 printf(__VA_ARGS__);                                    \
131                 printf("\n");                                           \
132                 if ((lvl) & 0x100)                                      \
133                         kdb_backtrace();                                \
134                 mtx_unlock(&zfs_debug_mtx);                             \
135         }                                                               \
136 } while (0)
137
138 #define sys_shutdown    rebooting
139
140 #endif  /* _SYS_ZFS_CONTEXT_H */