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 2007 Sun Microsystems, Inc. All rights reserved.
23 * Use is subject to license terms.
26 #ifndef _SYS_ZFS_CONTEXT_H
27 #define _SYS_ZFS_CONTEXT_H
29 #pragma ident "%Z%%M% %I% %E% SMI"
35 #include <sys/param.h>
36 #include <sys/stdint.h>
38 #include <sys/kernel.h>
39 #include <sys/debug.h>
40 #include <sys/systm.h>
42 #include <sys/sysmacros.h>
43 #include <sys/bitmap.h>
44 #include <sys/cmn_err.h>
46 #include <sys/taskq.h>
47 #include <sys/taskqueue.h>
48 #include <sys/systm.h>
50 #include <sys/mutex.h>
51 #include <sys/rwlock.h>
52 #include <sys/random.h>
53 #include <sys/byteorder.h>
54 #include <sys/systm.h>
57 #include <sys/dirent.h>
60 #include <sys/fcntl.h>
61 #include <sys/limits.h>
62 #include <sys/string.h>
69 #include <sys/sysctl.h>
74 #include <sys/stack.h>
75 #include <sys/lockf.h>
76 #include <sys/pathname.h>
77 #include <sys/policy.h>
78 #include <sys/refstr.h>
80 #include <sys/eventhandler.h>
81 #include <sys/extattr.h>
85 #include <sys/zfs_debug.h>
86 #include <sys/sysevent/eventdefs.h>
87 #include <sys/u8_textprep.h>
88 #include <sys/fm/util.h>
90 #include <machine/stdarg.h>
93 #include <vm/vm_page.h>
94 #include <vm/vm_object.h>
95 #include <vm/vm_pager.h>
96 #include <vm/vm_kern.h>
97 #include <vm/vm_map.h>
98 /* There is clash. vm_map.h defines the two below and vdev_cache.c use them. */
105 #include <vm/vm_extern.h>
106 #include <vm/vnode_pager.h>
108 #define CPU_SEQID (curcpu)
110 #define tsd_create(keyp, destructor) do { \
111 *(keyp) = osd_thread_register((destructor)); \
112 KASSERT(*(keyp) > 0, ("cannot register OSD")); \
114 #define tsd_destroy(keyp) osd_thread_deregister(*(keyp))
115 #define tsd_get(key) osd_thread_get(curthread, (key))
116 #define tsd_set(key, value) osd_thread_set(curthread, (key), (value))
122 extern int zfs_debug_level;
123 extern struct mtx zfs_debug_mtx;
124 #define ZFS_LOG(lvl, ...) do { \
125 if (((lvl) & 0xff) <= zfs_debug_level) { \
126 mtx_lock(&zfs_debug_mtx); \
127 printf("%s:%u[%d]: ", __func__, __LINE__, (lvl)); \
128 printf(__VA_ARGS__); \
132 mtx_unlock(&zfs_debug_mtx); \
136 #endif /* _SYS_ZFS_CONTEXT_H */