zfs_context.h revision a0965f35d4137b1f6bb1655ae1cb8fee88dfa66f
/*
* CDDL HEADER START
*
* The contents of this file are subject to the terms of the
* Common Development and Distribution License, Version 1.0 only
* (the "License"). You may not use this file except in compliance
* with the License.
*
* You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
* See the License for the specific language governing permissions
* and limitations under the License.
*
* When distributing Covered Code, include this CDDL HEADER in each
* file and include the License file at usr/src/OPENSOLARIS.LICENSE.
* If applicable, add the following below this CDDL HEADER, with the
* fields enclosed by brackets "[]" replaced with your own identifying
* information: Portions Copyright [yyyy] [name of copyright owner]
*
* CDDL HEADER END
*/
/*
* Copyright 2005 Sun Microsystems, Inc. All rights reserved.
* Use is subject to license terms.
*/
#ifndef _SYS_ZFS_CONTEXT_H
#define _SYS_ZFS_CONTEXT_H
#pragma ident "%Z%%M% %I% %E% SMI"
#ifdef __cplusplus
extern "C" {
#endif
#define _SYS_MUTEX_H
#define _SYS_RWLOCK_H
#define _SYS_CONDVAR_H
#define _SYS_SYSTM_H
#define _SYS_DEBUG_H
#define _SYS_T_LOCK_H
#define _SYS_VNODE_H
#define _SYS_VFS_H
#define _SYS_SUNDDI_H
#define _SYS_CALLB_H
#include <stdio.h>
#include <stdlib.h>
#include <stddef.h>
#include <stdarg.h>
#include <fcntl.h>
#include <unistd.h>
#include <errno.h>
#include <string.h>
#include <strings.h>
#include <synch.h>
#include <thread.h>
#include <assert.h>
#include <alloca.h>
#include <umem.h>
#include <limits.h>
#include <atomic.h>
#include <dirent.h>
#include <time.h>
#include <sys/sysmacros.h>
#include <sys/resource.h>
#include <sys/byteorder.h>
#include <sys/zfs_debug.h>
/*
* Debugging
*/
/*
* Note that we are not using the debugging levels.
*/
#define CE_CONT 0 /* continuation */
/*
* ZFS debugging
*/
#ifdef ZFS_DEBUG
#endif /* ZFS_DEBUG */
extern void cmn_err(int, const char *, ...);
extern void panic(const char *, ...);
/* This definition is copied from assert.h. */
#if defined(__STDC__)
#if __STDC_VERSION__ - 0 >= 199901L
#else
#endif /* __STDC_VERSION__ - 0 >= 199901L */
#else
#endif /* __STDC__ */
extern void __assert(const char *, const char *, int);
#ifdef lint
#define VERIFY3_IMPL(x, y, z, t) if (x == z) ((void)0)
#else
/* BEGIN CSTYLED */
} \
/* END CSTYLED */
#endif /* lint */
#ifdef NDEBUG
#define ASSERT3S(x, y, z) ((void)0)
#define ASSERT3U(x, y, z) ((void)0)
#define ASSERT3P(x, y, z) ((void)0)
#else
#endif
/*
* Dtrace SDT probes have different signatures in userland than they do in
* kernel. If they're being used in kernel code, re-define them out of
* existence for their counterparts in libzpool.
*/
#ifdef DTRACE_PROBE1
#define DTRACE_PROBE1(a, b, c) ((void)0)
#endif /* DTRACE_PROBE1 */
#ifdef DTRACE_PROBE2
#define DTRACE_PROBE2(a, b, c, d, e) ((void)0)
#endif /* DTRACE_PROBE2 */
/*
* Threads
*/
#define thread_exit() thr_exit(0)
/*
* Mutexes
*/
typedef struct kmutex {
void *m_owner;
} kmutex_t;
#define MUTEX_DEFAULT USYNC_THREAD
/*
* Argh -- we have to get cheesy here because the kernel and userland
* have different signatures for the same routine.
*/
/*
* RW locks
*/
typedef struct krwlock {
void *rw_owner;
} krwlock_t;
typedef int krw_t;
#define RW_READER 0
#define RW_WRITER 1
#define RW_DEFAULT USYNC_THREAD
#define rw_downgrade(rwlp) do { } while (0)
/*
* Condition variables
*/
typedef cond_t kcondvar_t;
#define CV_DEFAULT USYNC_THREAD
/*
* Kernel memory
*/
#define KM_SLEEP UMEM_NOFAIL
#define KM_NOSLEEP UMEM_DEFAULT
#define KMC_NODEBUG UMC_NODEBUG
#define kmem_debugging() 0
#define kmem_cache_reap_now(c)
typedef umem_cache_t kmem_cache_t;
/*
* Task queues
*/
typedef void (task_func_t)(void *);
#define TASKQ_PREPOPULATE 0x0001
extern void taskq_destroy(taskq_t *);
extern void taskq_wait(taskq_t *);
extern int taskq_member(taskq_t *, void *);
/*
* vnodes
*/
typedef struct vnode {
int v_fd;
char *v_path;
} vnode_t;
typedef struct vattr {
} vattr_t;
#define AT_TYPE 0x0001
#define AT_MODE 0x0002
#define AT_UID 0x0004
#define AT_GID 0x0008
#define AT_FSID 0x0010
#define AT_NODEID 0x0020
#define AT_NLINK 0x0040
#define AT_SIZE 0x0080
#define AT_ATIME 0x0100
#define AT_MTIME 0x0200
#define AT_CTIME 0x0400
#define AT_RDEV 0x0800
#define AT_BLKSIZE 0x1000
#define AT_NBLOCKS 0x2000
#define AT_SEQ 0x8000
#define CRCREAT 0
/*
* Random stuff
*/
#define max_ncpus 64
#define minclsyspri 60
#define maxclsyspri 99
extern void kernel_init(int);
extern void kernel_fini(void);
struct spa;
extern void show_pool_stats(struct spa *);
typedef struct callb_cpr {
} callb_cpr_t;
}
#define CALLB_CPR_SAFE_BEGIN(cp) { \
}
}
#define CALLB_CPR_EXIT(cp) { \
}
#define zone_dataset_visible(x, y) (1)
#define INGLOBALZONE(z) (1)
#ifdef __cplusplus
}
#endif
#endif /* _SYS_ZFS_CONTEXT_H */