zfs_context.h revision 297108
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) 2013 by Delphix. All rights reserved. 28 */ 29 30#ifndef _SYS_ZFS_CONTEXT_H 31#define _SYS_ZFS_CONTEXT_H 32 33#ifdef __cplusplus 34extern "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#endif 98#include <sys/callo.h> 99#include <sys/disp.h> 100#include <machine/stdarg.h> 101 102#include <vm/vm.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. */ 108#ifdef min_offset 109#undef min_offset 110#endif 111#ifdef max_offset 112#undef max_offset 113#endif 114#include <vm/vm_extern.h> 115#include <vm/vnode_pager.h> 116 117#define CPU_SEQID (curcpu) 118 119#define tsd_create(keyp, destructor) do { \ 120 *(keyp) = osd_thread_register((destructor)); \ 121 KASSERT(*(keyp) > 0, ("cannot register OSD")); \ 122} while (0) 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)) 126 127#ifdef __cplusplus 128} 129#endif 130 131extern int zfs_debug_level; 132extern 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__); \ 138 printf("\n"); \ 139 if ((lvl) & 0x100) \ 140 kdb_backtrace(); \ 141 mtx_unlock(&zfs_debug_mtx); \ 142 } \ 143} while (0) 144 145#define sys_shutdown rebooting 146 147#endif /* _SYS_ZFS_CONTEXT_H */ 148