FreeBSD ZFS
The Zettabyte File System

sys/zfs_context.h

Go to the documentation of this file.
00001 /*
00002  * CDDL HEADER START
00003  *
00004  * The contents of this file are subject to the terms of the
00005  * Common Development and Distribution License (the "License").
00006  * You may not use this file except in compliance with the License.
00007  *
00008  * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
00009  * or http://www.opensolaris.org/os/licensing.
00010  * See the License for the specific language governing permissions
00011  * and limitations under the License.
00012  *
00013  * When distributing Covered Code, include this CDDL HEADER in each
00014  * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
00015  * If applicable, add the following below this CDDL HEADER, with the
00016  * fields enclosed by brackets "[]" replaced with your own identifying
00017  * information: Portions Copyright [yyyy] [name of copyright owner]
00018  *
00019  * CDDL HEADER END
00020  */
00021 /*
00022  * Copyright 2009 Sun Microsystems, Inc.  All rights reserved.
00023  * Use is subject to license terms.
00024  */
00025 
00026 #ifndef _SYS_ZFS_CONTEXT_H
00027 #define _SYS_ZFS_CONTEXT_H
00028 
00029 #ifdef  __cplusplus
00030 extern "C" {
00031 #endif
00032 
00033 #include <sys/param.h>
00034 #include <sys/stdint.h>
00035 #include <sys/note.h>
00036 #include <sys/kernel.h>
00037 #include <sys/debug.h>
00038 #include <sys/systm.h>
00039 #include <sys/proc.h>
00040 #include <sys/sysmacros.h>
00041 #include <sys/bitmap.h>
00042 #include <sys/cmn_err.h>
00043 #include <sys/kmem.h>
00044 #include <sys/taskq.h>
00045 #include <sys/taskqueue.h>
00046 #include <sys/systm.h>
00047 #include <sys/conf.h>
00048 #include <sys/mutex.h>
00049 #include <sys/rwlock.h>
00050 #include <sys/kcondvar.h>
00051 #include <sys/random.h>
00052 #include <sys/byteorder.h>
00053 #include <sys/systm.h>
00054 #include <sys/list.h>
00055 #include <sys/zfs_debug.h>
00056 #include <sys/sysevent.h>
00057 #include <sys/uio.h>
00058 #include <sys/dirent.h>
00059 #include <sys/time.h>
00060 #include <sys/uio.h>
00061 #include <sys/fcntl.h>
00062 #include <sys/limits.h>
00063 #include <sys/string.h>
00064 #include <sys/bio.h>
00065 #include <sys/buf.h>
00066 #include <sys/cred.h>
00067 #include <sys/sdt.h>
00068 #include <sys/file.h>
00069 #include <sys/vfs.h>
00070 #include <sys/sysctl.h>
00071 #include <sys/sbuf.h>
00072 #include <sys/priv.h>
00073 #include <sys/kdb.h>
00074 #include <sys/ktr.h>
00075 #include <sys/stack.h>
00076 #include <sys/lockf.h>
00077 #include <sys/pathname.h>
00078 #include <sys/policy.h>
00079 #include <sys/refstr.h>
00080 #include <sys/zone.h>
00081 #include <sys/eventhandler.h>
00082 #include <sys/extattr.h>
00083 #include <sys/misc.h>
00084 #include <sys/sig.h>
00085 #include <sys/osd.h>
00086 #include <sys/sysevent/dev.h>
00087 #include <sys/sysevent/eventdefs.h>
00088 #include <sys/u8_textprep.h>
00089 #include <sys/fm/util.h>
00090 #include <sys/sunddi.h>
00091 
00092 #include <machine/stdarg.h>
00093 
00094 #include <vm/vm.h>
00095 #include <vm/vm_page.h>
00096 #include <vm/vm_object.h>
00097 #include <vm/vm_pager.h>
00098 #include <vm/vm_kern.h>
00099 #include <vm/vm_map.h>
00100 /* There is clash. vm_map.h defines the two below and vdev_cache.c use them. */
00101 #ifdef min_offset
00102 #undef min_offset
00103 #endif
00104 #ifdef max_offset
00105 #undef max_offset
00106 #endif
00107 #include <vm/vm_extern.h>
00108 #include <vm/vnode_pager.h>
00109 
00110 #define CPU_SEQID       (curcpu)
00111 
00112 #define tsd_create(keyp, destructor)    do {                            \
00113         *(keyp) = osd_thread_register((destructor));                    \
00114         KASSERT(*(keyp) > 0, ("cannot register OSD"));                  \
00115 } while (0)
00116 #define tsd_destroy(keyp)               osd_thread_deregister(*(keyp))
00117 #define tsd_get(key)                    osd_thread_get(curthread, (key))
00118 #define tsd_set(key, value)             osd_thread_set(curthread, (key), (value))
00119 
00120 #ifdef  __cplusplus
00121 }
00122 #endif
00123 
00124 extern int zfs_debug_level;
00125 extern struct mtx zfs_debug_mtx;
00126 #define ZFS_LOG(lvl, ...)       do {                                    \
00127         if (((lvl) & 0xff) <= zfs_debug_level) {                        \
00128                 mtx_lock(&zfs_debug_mtx);                               \
00129                 printf("%s:%u[%d]: ", __func__, __LINE__, (lvl));       \
00130                 printf(__VA_ARGS__);                                    \
00131                 printf("\n");                                           \
00132                 if ((lvl) & 0x100)                                      \
00133                         kdb_backtrace();                                \
00134                 mtx_unlock(&zfs_debug_mtx);                             \
00135         }                                                               \
00136 } while (0)
00137 
00138 #define sys_shutdown    rebooting
00139 
00140 #endif  /* _SYS_ZFS_CONTEXT_H */
 All Data Structures Files Functions Variables Typedefs Enumerations Enumerator Defines