*/
/*
* Copyright 2011 Nexenta Systems, Inc. All rights reserved.
+ * Copyright (c) 2012, Joyent, Inc. All rights reserved.
*/
#ifndef _SYS_ZFS_CONTEXT_H
#include <sys/zfs_debug.h>
#include <sys/fm/fs/zfs.h>
#include <sys/sunddi.h>
+#include <sys/ctype.h>
+#include <sys/disp.h>
#include <linux/dcache_compat.h>
#else /* _KERNEL */
#include <atomic.h>
#include <dirent.h>
#include <time.h>
+#include <ctype.h>
#include <sys/note.h>
#include <sys/types.h>
#include <sys/cred.h>
* ZFS debugging
*/
-#ifdef ZFS_DEBUG
extern void dprintf_setup(int *argc, char **argv);
-#endif /* ZFS_DEBUG */
-
+extern void __dprintf(const char *file, const char *func,
+ int line, const char *fmt, ...);
extern void cmn_err(int, const char *, ...);
extern void vcmn_err(int, const char *, __va_list);
extern void panic(const char *, ...);
#define STACK_SIZE 24576 /* Solaris */
#endif
-#ifdef NPTL_GUARD_WITHIN_STACK
-#define EXTRA_GUARD_BYTES PAGESIZE
-#else
-#define EXTRA_GUARD_BYTES 0
-#endif
-
/* in libzpool, p0 exists only to have its address taken */
typedef struct proc {
uintptr_t this_is_never_used_dont_dereference_it;
} proc_t;
extern struct proc p0;
+#define curproc (&p0)
typedef void (*thread_func_t)(void *);
typedef void (*thread_func_arg_t)(void *);
#define thread_exit zk_thread_exit
#define thread_create(stk, stksize, func, arg, len, pp, state, pri) \
zk_thread_create(stk, stksize, (thread_func_t)func, arg, \
- len, NULL, state, pri)
+ len, NULL, state, pri, PTHREAD_CREATE_DETACHED)
#define thread_join(t) zk_thread_join(t)
#define newproc(f,a,cid,pri,ctp,pid) (ENOSYS)
extern void zk_thread_exit(void);
extern kthread_t *zk_thread_create(caddr_t stk, size_t stksize,
thread_func_t func, void *arg, size_t len,
- proc_t *pp, int state, pri_t pri);
+ proc_t *pp, int state, pri_t pri, int detachstate);
extern void zk_thread_join(kt_did_t tid);
+#define kpreempt_disable() ((void)0)
+#define kpreempt_enable() ((void)0)
+
#define PS_NONE -1
#define issig(why) (FALSE)
extern void cv_broadcast(kcondvar_t *cv);
#define cv_timedwait_interruptible(cv, mp, at) cv_timedwait(cv, mp, at)
#define cv_wait_interruptible(cv, mp) cv_wait(cv, mp)
+#define cv_wait_io(cv, mp) cv_wait(cv, mp)
/*
* kstat creation, installation and deletion
#define TASKQ_DYNAMIC 0x0004 /* Use dynamic thread scheduling */
#define TASKQ_THREADS_CPU_PCT 0x0008 /* Scale # threads by # cpus */
#define TASKQ_DC_BATCH 0x0010 /* Mark threads as batch */
-#define TASKQ_NORECLAIM 0x0020 /* Disable direct memory reclaim */
#define TQ_SLEEP KM_SLEEP /* Can block for memory */
#define TQ_NOSLEEP KM_NOSLEEP /* cannot block for memory; may fail */
+#define TQ_PUSHPAGE KM_PUSHPAGE /* Cannot perform I/O */
#define TQ_NOQUEUE 0x02 /* Do not enqueue if can't dispatch */
#define TQ_FRONT 0x08 /* Queue in front */
extern int fop_getattr(vnode_t *vp, vattr_t *vap);
-#define VOP_CLOSE(vp, f, c, o, cr, ct) 0
+#define VOP_CLOSE(vp, f, c, o, cr, ct) vn_close(vp)
#define VOP_PUTPAGE(vp, of, sz, fl, cr, ct) 0
#define VOP_GETATTR(vp, vap, fl, cr, ct) fop_getattr((vp), (vap));