]> CyberLeo.Net >> Repos - FreeBSD/releng/10.0.git/blob - sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys/zfs_context.h
- Copy stable/10 (r259064) to releng/10.0 as part of the
[FreeBSD/releng/10.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  * Copyright 2011 Nexenta Systems, Inc.  All rights reserved.
27  * Copyright (c) 2012 by Delphix. All rights reserved.
28  */
29
30 #ifndef _SYS_ZFS_CONTEXT_H
31 #define _SYS_ZFS_CONTEXT_H
32
33 #ifdef  __cplusplus
34 extern "C" {
35 #endif
36
37 #include <sys/param.h>
38 #include <sys/stdint.h>
39 #include <sys/note.h>
40 #include <sys/kernel.h>
41 #include <sys/debug.h>
42 #include <sys/systm.h>
43 #include <sys/proc.h>
44 #include <sys/sysmacros.h>
45 #include <sys/bitmap.h>
46 #include <sys/cmn_err.h>
47 #include <sys/kmem.h>
48 #include <sys/taskq.h>
49 #include <sys/taskqueue.h>
50 #include <sys/systm.h>
51 #include <sys/conf.h>
52 #include <sys/mutex.h>
53 #include <sys/rwlock.h>
54 #include <sys/kcondvar.h>
55 #include <sys/random.h>
56 #include <sys/byteorder.h>
57 #include <sys/systm.h>
58 #include <sys/list.h>
59 #include <sys/zfs_debug.h>
60 #include <sys/sysevent.h>
61 #include <sys/uio.h>
62 #include <sys/dirent.h>
63 #include <sys/time.h>
64 #include <sys/uio.h>
65 #include <sys/fcntl.h>
66 #include <sys/limits.h>
67 #include <sys/string.h>
68 #include <sys/bio.h>
69 #include <sys/buf.h>
70 #include <sys/cred.h>
71 #include <sys/sdt.h>
72 #include <sys/file.h>
73 #include <sys/vfs.h>
74 #include <sys/sysctl.h>
75 #include <sys/sbuf.h>
76 #include <sys/priv.h>
77 #include <sys/kdb.h>
78 #include <sys/ktr.h>
79 #include <sys/stack.h>
80 #include <sys/lockf.h>
81 #include <sys/pathname.h>
82 #include <sys/policy.h>
83 #include <sys/refstr.h>
84 #include <sys/zone.h>
85 #include <sys/eventhandler.h>
86 #include <sys/extattr.h>
87 #include <sys/misc.h>
88 #include <sys/sig.h>
89 #include <sys/osd.h>
90 #include <sys/sysevent/dev.h>
91 #include <sys/sysevent/eventdefs.h>
92 #include <sys/u8_textprep.h>
93 #include <sys/fm/util.h>
94 #include <sys/sunddi.h>
95 #ifdef illumos
96 #include <sys/cyclic.h>
97 #else   /* FreeBSD */
98 #include <sys/callout.h>
99 #endif
100
101 #include <machine/stdarg.h>
102
103 #include <vm/vm.h>
104 #include <vm/vm_page.h>
105 #include <vm/vm_object.h>
106 #include <vm/vm_kern.h>
107 #include <vm/vm_map.h>
108 /* There is clash. vm_map.h defines the two below and vdev_cache.c use them. */
109 #ifdef min_offset
110 #undef min_offset
111 #endif
112 #ifdef max_offset
113 #undef max_offset
114 #endif
115 #include <vm/vm_extern.h>
116 #include <vm/vnode_pager.h>
117
118 #define CPU_SEQID       (curcpu)
119
120 #define tsd_create(keyp, destructor)    do {                            \
121         *(keyp) = osd_thread_register((destructor));                    \
122         KASSERT(*(keyp) > 0, ("cannot register OSD"));                  \
123 } while (0)
124 #define tsd_destroy(keyp)               osd_thread_deregister(*(keyp))
125 #define tsd_get(key)                    osd_thread_get(curthread, (key))
126 #define tsd_set(key, value)             osd_thread_set(curthread, (key), (value))
127
128 #ifdef  __cplusplus
129 }
130 #endif
131
132 extern int zfs_debug_level;
133 extern struct mtx zfs_debug_mtx;
134 #define ZFS_LOG(lvl, ...)       do {                                    \
135         if (((lvl) & 0xff) <= zfs_debug_level) {                        \
136                 mtx_lock(&zfs_debug_mtx);                               \
137                 printf("%s:%u[%d]: ", __func__, __LINE__, (lvl));       \
138                 printf(__VA_ARGS__);                                    \
139                 printf("\n");                                           \
140                 if ((lvl) & 0x100)                                      \
141                         kdb_backtrace();                                \
142                 mtx_unlock(&zfs_debug_mtx);                             \
143         }                                                               \
144 } while (0)
145
146 #define sys_shutdown    rebooting
147
148 #endif  /* _SYS_ZFS_CONTEXT_H */