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.
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.
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]
22 * Copyright 2009 Sun Microsystems, Inc. All rights reserved.
23 * Use is subject to license terms.
26 * Copyright 2011 Nexenta Systems, Inc. All rights reserved.
27 * Copyright (c) 2013 by Delphix. All rights reserved.
30 #ifndef _SYS_ZFS_CONTEXT_H
31 #define _SYS_ZFS_CONTEXT_H
37 #include <sys/param.h>
38 #include <sys/stdint.h>
40 #include <sys/kernel.h>
41 #include <sys/debug.h>
42 #include <sys/systm.h>
44 #include <sys/sysmacros.h>
45 #include <sys/bitmap.h>
46 #include <sys/cmn_err.h>
48 #include <sys/taskq.h>
49 #include <sys/taskqueue.h>
50 #include <sys/systm.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>
59 #include <sys/zfs_debug.h>
60 #include <sys/sysevent.h>
62 #include <sys/dirent.h>
65 #include <sys/fcntl.h>
66 #include <sys/limits.h>
67 #include <sys/string.h>
74 #include <sys/sysctl.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>
85 #include <sys/eventhandler.h>
86 #include <sys/extattr.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>
96 #include <sys/cyclic.h>
98 #include <sys/callo.h>
100 #include <machine/stdarg.h>
103 #include <vm/vm_page.h>
104 #include <vm/vm_object.h>
105 #include <vm/vm_kern.h>
106 #include <vm/vm_map.h>
107 /* There is clash. vm_map.h defines the two below and vdev_cache.c use them. */
114 #include <vm/vm_extern.h>
115 #include <vm/vnode_pager.h>
117 #define CPU_SEQID (curcpu)
119 #define tsd_create(keyp, destructor) do { \
120 *(keyp) = osd_thread_register((destructor)); \
121 KASSERT(*(keyp) > 0, ("cannot register OSD")); \
123 #define tsd_destroy(keyp) osd_thread_deregister(*(keyp))
124 #define tsd_get(key) osd_thread_get(curthread, (key))
125 #define tsd_set(key, value) osd_thread_set(curthread, (key), (value))
131 extern int zfs_debug_level;
132 extern struct mtx zfs_debug_mtx;
133 #define ZFS_LOG(lvl, ...) do { \
134 if (((lvl) & 0xff) <= zfs_debug_level) { \
135 mtx_lock(&zfs_debug_mtx); \
136 printf("%s:%u[%d]: ", __func__, __LINE__, (lvl)); \
137 printf(__VA_ARGS__); \
141 mtx_unlock(&zfs_debug_mtx); \
145 #define sys_shutdown rebooting
147 #endif /* _SYS_ZFS_CONTEXT_H */