1/* $NetBSD: zfs_context.h,v 1.11 2011/11/21 05:50:11 christos Exp $ */ 2 3/* 4 * CDDL HEADER START 5 * 6 * The contents of this file are subject to the terms of the 7 * Common Development and Distribution License, Version 1.0 only 8 * (the "License"). You may not use this file except in compliance 9 * with the License. 10 * 11 * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE 12 * or http://www.opensolaris.org/os/licensing. 13 * See the License for the specific language governing permissions 14 * and limitations under the License. 15 * 16 * When distributing Covered Code, include this CDDL HEADER in each 17 * file and include the License file at usr/src/OPENSOLARIS.LICENSE. 18 * If applicable, add the following below this CDDL HEADER, with the 19 * fields enclosed by brackets "[]" replaced with your own identifying 20 * information: Portions Copyright [yyyy] [name of copyright owner] 21 * 22 * CDDL HEADER END 23 */ 24/* 25 * Copyright 2005 Sun Microsystems, Inc. All rights reserved. 26 * Use is subject to license terms. 27 */ 28 29#ifndef _SYS_ZFS_CONTEXT_H 30#define _SYS_ZFS_CONTEXT_H 31 32#pragma ident "%Z%%M% %I% %E% SMI" 33 34#ifdef __cplusplus 35extern "C" { 36#endif 37 38#include <sys/types.h> 39 40#ifndef _KERNEL 41 42#include <sys/mutex.h> 43#include <sys/rwlock.h> 44#include <sys/condvar.h> 45 46#define _SYS_SYSTM_H 47#define _SYS_DEBUG_H 48#define _SYS_T_LOCK_H 49#define _SYS_VNODE_H 50#define _SYS_VFS_H 51#define _SYS_SUNDDI_H 52#define _SYS_CALLB_H 53#define _SYS_SCHED_H 54#define _SYS_TASKQ_ 55 56#include <thread.h> 57#include <umem.h> 58#include <paths.h> 59#include <strings.h> 60#include <string.h> 61#include <stdio.h> 62#include <stdlib.h> 63#include <errno.h> 64#include <unistd.h> 65 66#include <sys/kstat.h> 67#include <sys/param.h> 68#include <sys/stdint.h> 69#include <sys/note.h> 70#include <sys/uio.h> 71#include <sys/atomic.h> 72#include <sys/zfs_debug.h> 73#include <sys/misc.h> 74#include <sys/sdt.h> 75#include <sys/list.h> 76#include <sys/ccompile.h> 77#include <sys/byteorder.h> 78#include <sys/utsname.h> 79#include <sys/cred.h> 80#include <sys/pset.h> 81#include <sys/u8_textprep.h> 82#include <sys/zone.h> 83#include <sys/pathname.h> 84#include <sys/sysevent.h> 85 86extern void panic(const char *, ...); 87 88#include <sys/cmn_err.h> 89 90#include <sys/sysevent/eventdefs.h> 91 92/* #include <libzfs.h> */ 93 94#ifndef ABS 95#define ABS(a) ((a) < 0 ? -(a) : (a)) 96#endif 97 98extern int aok; 99 100/* 101 * Debugging 102 */ 103 104/* 105 * Note that we are not using the debugging levels. 106 */ 107 108#define CE_CONT 0 /* continuation */ 109#define CE_NOTE 1 /* notice */ 110#define CE_WARN 2 /* warning */ 111#define CE_PANIC 3 /* panic */ 112#define CE_IGNORE 4 /* print nothing */ 113 114/* 115 * ZFS debugging 116 */ 117 118#define ZFS_LOG(...) do { } while (0) 119 120typedef u_longlong_t rlim64_t; 121#define RLIM64_INFINITY ((rlim64_t)-3) 122 123#ifdef ZFS_DEBUG 124extern void dprintf_setup(int *argc, char **argv); 125#endif /* ZFS_DEBUG */ 126 127/* extern void cmn_err(int, const char *, ...); 128extern void vcmn_err(int, const char *, va_list); */ 129/* extern void vpanic(const char *, va_list); */ 130 131#define fm_panic panic 132 133#if !defined(_LIBZFS_H) && !defined(_ZFS_CONTEXT_NO_VERIFY) 134#define verify(EX) (void)((EX) || \ 135 (__assert13(__FILE__, __LINE__, __func__, #EX), 0)) 136#define VERIFY verify 137#endif 138 139#define ASSERT assert 140 141#ifdef lint 142#define VERIFY3_IMPL(x, y, z, t) if (x == z) ((void)0) 143#else 144/* BEGIN CSTYLED */ 145#define VERIFY3_IMPL(LEFT, OP, RIGHT, TYPE) do { \ 146 const TYPE __left = (TYPE)(LEFT); \ 147 const TYPE __right = (TYPE)(RIGHT); \ 148 if (!(__left OP __right)) { \ 149 char *__buf = alloca(256); \ 150 (void) snprintf(__buf, 256, "%s %s %s (0x%llx %s 0x%llx)", \ 151 #LEFT, #OP, #RIGHT, \ 152 (u_longlong_t)__left, #OP, (u_longlong_t)__right); \ 153 __assert13(__FILE__, __LINE__, __func__,__buf); \ 154 } \ 155_NOTE(CONSTCOND) } while (0) 156/* END CSTYLED */ 157#endif /* lint */ 158 159#define VERIFY3S(x, y, z) VERIFY3_IMPL(x, y, z, int64_t) 160#define VERIFY3U(x, y, z) VERIFY3_IMPL(x, y, z, uint64_t) 161#define VERIFY3P(x, y, z) VERIFY3_IMPL(x, y, z, uintptr_t) 162 163#ifdef NDEBUG 164#define ASSERT3S(x, y, z) ((void)0) 165#define ASSERT3U(x, y, z) ((void)0) 166#define ASSERT3P(x, y, z) ((void)0) 167#else 168#define ASSERT3S(x, y, z) VERIFY3S(x, y, z) 169#define ASSERT3U(x, y, z) VERIFY3U(x, y, z) 170#define ASSERT3P(x, y, z) VERIFY3P(x, y, z) 171#endif 172 173/* 174 * Dtrace SDT probes have different signatures in userland than they do in 175 * kernel. If they're being used in kernel code, re-define them out of 176 * existence for their counterparts in libzpool. 177 */ 178 179#ifdef DTRACE_PROBE1 180#undef DTRACE_PROBE1 181#define DTRACE_PROBE1(a, b, c) ((void)0) 182#endif /* DTRACE_PROBE1 */ 183 184#ifdef DTRACE_PROBE2 185#undef DTRACE_PROBE2 186#define DTRACE_PROBE2(a, b, c, d, e) ((void)0) 187#endif /* DTRACE_PROBE2 */ 188 189#ifdef DTRACE_PROBE3 190#undef DTRACE_PROBE3 191#define DTRACE_PROBE3(a, b, c, d, e, f, g) ((void)0) 192#endif /* DTRACE_PROBE3 */ 193 194#ifdef DTRACE_PROBE4 195#undef DTRACE_PROBE4 196#define DTRACE_PROBE4(a, b, c, d, e, f, g, h, i) ((void)0) 197#endif /* DTRACE_PROBE4 */ 198 199/* 200 * Threads 201 */ 202#define curthread ((void *)(uintptr_t)thr_self()) 203 204typedef pthread_t kthread_t; 205 206#define thread_create(stk, stksize, func, arg, len, pp, state, pri) \ 207 zk_thread_create(func, arg) 208#define thread_exit() thr_exit(NULL) 209#define thread_join(t) panic("libzpool cannot join threads") 210 211#define newproc(f, a, cid, pri, ctp, pid) (ENOSYS) 212 213extern kthread_t *zk_thread_create(void (*func)(), void *arg); 214 215/* In NetBSD struct proc is visible in userspace therefore we use it's original 216 definition. */ 217/* struct proc { 218 uintptr_t this_is_never_used_dont_dereference_it; 219 }; */ 220 221extern struct proc p0; 222 223#define issig(why) (FALSE) 224#define ISSIG(thr, why) (FALSE) 225#define makedevice(min, maj) makedev((min), (maj)) 226 227/* 228 * Mutexes 229 */ 230 231#define MUTEX_DEFAULT USYNC_THREAD 232#define MUTEX_HELD(m) (mutex_owned(m)) 233 234extern void mutex_init(kmutex_t *mp, void *, kmutex_type_t, void *); 235extern void mutex_destroy(kmutex_t *mp); 236extern void mutex_enter(kmutex_t *mp); 237extern void mutex_exit(kmutex_t *mp); 238extern int mutex_tryenter(kmutex_t *mp); 239extern void *mutex_owner(kmutex_t *mp); 240extern int mutex_owned(kmutex_t *mp); 241 242/* 243 * RW locks 244 */ 245#define RW_DEFAULT USYNC_THREAD 246 247#define RW_LOCK_HELD(x) rw_lock_held(x) 248#define RW_WRITE_HELD(x) rw_write_held(x) 249#define RW_READ_HELD(x) rw_read_held(x) 250 251extern void rw_init(krwlock_t *rwlp, char *name, int type, void *arg); 252extern void rw_destroy(krwlock_t *rwlp); 253extern void rw_enter(krwlock_t *rwlp, krw_t rw); 254extern int rw_tryenter(krwlock_t *rwlp, krw_t rw); 255extern int rw_tryupgrade(krwlock_t *rwlp); 256extern void rw_exit(krwlock_t *rwlp); 257extern int rw_lock_held(krwlock_t *rwlp); 258extern int rw_write_held(krwlock_t *rwlp); 259extern int rw_read_held(krwlock_t *rwlp); 260#define rw_downgrade(rwlp) do { } while (0) 261 262extern uid_t crgetuid(cred_t *cr); 263extern gid_t crgetgid(cred_t *cr); 264extern int crgetngroups(cred_t *cr); 265extern gid_t *crgetgroups(cred_t *cr); 266 267/* 268 * Condition variables 269 */ 270#define CV_DEFAULT USYNC_THREAD 271 272extern void cv_init(kcondvar_t *cv, char *name, int type, void *arg); 273extern void cv_destroy(kcondvar_t *cv); 274extern void cv_wait(kcondvar_t *cv, kmutex_t *mp); 275extern clock_t cv_timedwait(kcondvar_t *cv, kmutex_t *mp, clock_t abstime); 276extern void cv_signal(kcondvar_t *cv); 277extern void cv_broadcast(kcondvar_t *cv); 278 279/* 280 * Kernel memory 281 */ 282#define KM_SLEEP UMEM_NOFAIL 283#define KM_NOSLEEP UMEM_DEFAULT 284#define KM_PUSHPAGE UMEM_NOFAIL 285#define KMC_NODEBUG UMC_NODEBUG 286#define kmem_alloc(_s, _f) umem_alloc(_s, _f) 287#define kmem_zalloc(_s, _f) umem_zalloc(_s, _f) 288#define kmem_free(_b, _s) umem_free(_b, _s) 289#define kmem_size() (physmem * PAGESIZE) 290#define kmem_cache_create(_a, _b, _c, _d, _e, _f, _g, _h, _i) \ 291 umem_cache_create(_a, _b, _c, _d, _e, _f, _g, _h, _i) 292#define kmem_cache_destroy(_c) umem_cache_destroy(_c) 293#define kmem_cache_alloc(_c, _f) umem_cache_alloc(_c, _f) 294#define kmem_cache_free(_c, _b) umem_cache_free(_c, _b) 295#define kmem_debugging() 0 296#define kmem_cache_reap_now(c) 297 298typedef umem_cache_t kmem_cache_t; 299typedef struct vmem vmem_t; 300 301#define ZFS_EXPORTS_PATH "/etc/zfs/exports" 302 303/* 304 * Task queues 305 */ 306typedef struct taskq taskq_t; 307typedef uintptr_t taskqid_t; 308typedef void (task_func_t)(void *); 309 310#define TASKQ_PREPOPULATE 0x0001 311#define TASKQ_CPR_SAFE 0x0002 /* Use CPR safe protocol */ 312#define TASKQ_DYNAMIC 0x0004 /* Use dynamic thread scheduling */ 313#define TASKQ_THREADS_CPU_PCT 0x0008 /* Scale # threads by # cpus */ 314#define TASKQ_DC_BATCH 0x0010 /* Mark threads as batch */ 315 316#define TQ_SLEEP KM_SLEEP /* Can block for memory */ 317#define TQ_NOSLEEP KM_NOSLEEP /* cannot block for memory; may fail */ 318#define TQ_NOQUEUE 0x02 /* Do not enqueue if can't dispatch */ 319#define TQ_FRONT 0x08 /* Queue in front */ 320 321extern taskq_t *system_taskq; 322 323extern taskq_t *taskq_create(const char *, int, pri_t, int, int, uint_t); 324#define taskq_create_proc(a, b, c, d, e, p, f) \ 325 (taskq_create(a, b, c, d, e, f)) 326#define taskq_create_sysdc(a, b, d, e, p, dc, f) \ 327 (taskq_create(a, b, maxclsyspri, d, e, f)) 328extern taskqid_t taskq_dispatch(taskq_t *, task_func_t, void *, uint_t); 329extern void taskq_destroy(taskq_t *); 330extern void taskq_wait(taskq_t *); 331extern int taskq_member(taskq_t *, void *); 332extern void system_taskq_init(void); 333extern void system_taskq_fini(void); 334 335#define XVA_MAPSIZE 3 336#define XVA_MAGIC 0x78766174 337 338/* 339 * vnodes 340 */ 341typedef struct vnode { 342 uint64_t v_size; 343 int v_fd; 344 char *v_path; 345} vnode_t; 346 347typedef struct vattr { 348 uint_t va_mask; /* bit-mask of attributes */ 349 u_offset_t va_size; /* file size in bytes */ 350} vattr_t; 351 352#define AT_TYPE 0x0001 353#define AT_MODE 0x0002 354#define AT_UID 0x0004 355#define AT_GID 0x0008 356#define AT_FSID 0x0010 357#define AT_NODEID 0x0020 358#define AT_NLINK 0x0040 359#define AT_SIZE 0x0080 360#define AT_ATIME 0x0100 361#define AT_MTIME 0x0200 362#define AT_CTIME 0x0400 363#define AT_RDEV 0x0800 364#define AT_BLKSIZE 0x1000 365#define AT_NBLOCKS 0x2000 366#define AT_SEQ 0x8000 367 368#define CRCREAT 0 369 370#define VOP_CLOSE(vp, f, c, o, cr, unk) 0 371#define VOP_PUTPAGE(vp, of, sz, fl, cr, unk) 0 372#define VOP_GETATTR(vp, vap, fl, cr, unk) vn_getattr(vp, vap) 373#define VOP_FSYNC(vp, f, cr, unk) fsync((vp)->v_fd) 374 375#define VN_RELE(vp) vn_close(vp) 376 377extern int vn_open(char *path, int x1, int oflags, int mode, vnode_t **vpp, 378 int x2, int x3); 379extern int vn_openat(char *path, int x1, int oflags, int mode, vnode_t **vpp, 380 int x2, int x3, vnode_t *vp, int unk); 381extern int vn_rdwr(int uio, vnode_t *vp, void *addr, ssize_t len, 382 offset_t offset, int x1, int x2, rlim64_t x3, void *x4, ssize_t *residp); 383extern void vn_close(vnode_t *vp); 384extern int vn_getattr(vnode_t *vp, vattr_t *va); 385 386#define vn_remove(path, x1, x2) remove(path) 387#define vn_rename(from, to, seg) rename((from), (to)) 388#define vn_is_readonly(vp) B_FALSE 389 390extern vnode_t *rootdir; 391 392#include <sys/file.h> /* for FREAD, FWRITE, etc */ 393#define FTRUNC O_TRUNC 394#define openat64 openat 395 396 397/* 398 * Random stuff 399 */ 400#define lbolt (gethrtime() >> 23) 401#define lbolt64 (gethrtime() >> 23) 402#define hz 119 /* frequency when using gethrtime() >> 23 for lbolt */ 403 404extern void delay(clock_t ticks); 405 406#define gethrestime_sec() time(NULL) 407#define gethrestime(t) \ 408 do {\ 409 (t)->tv_sec = gethrestime_sec();\ 410 (t)->tv_nsec = 0;\ 411 } while (0); 412 413#define max_ncpus 64 414 415#define minclsyspri 60 416#define maxclsyspri 99 417 418#define CPU_SEQID (thr_self() & (max_ncpus - 1)) 419 420#define kcred NULL 421#define CRED() NULL 422 423extern uint64_t physmem; 424 425extern int random_get_bytes(uint8_t *ptr, size_t len); 426extern int random_get_pseudo_bytes(uint8_t *ptr, size_t len); 427 428extern void kernel_init(int); 429extern void kernel_fini(void); 430 431struct spa; 432extern void nicenum(uint64_t num, char *buf); 433extern void show_pool_stats(struct spa *); 434 435typedef struct callb_cpr { 436 kmutex_t *cc_lockp; 437} callb_cpr_t; 438 439#define CALLB_CPR_INIT(cp, lockp, func, name) { \ 440 (cp)->cc_lockp = lockp; \ 441} 442 443#define CALLB_CPR_SAFE_BEGIN(cp) { \ 444 ASSERT(MUTEX_HELD((cp)->cc_lockp)); \ 445} 446 447#define CALLB_CPR_SAFE_END(cp, lockp) { \ 448 ASSERT(MUTEX_HELD((cp)->cc_lockp)); \ 449} 450 451#define CALLB_CPR_EXIT(cp) { \ 452 ASSERT(MUTEX_HELD((cp)->cc_lockp)); \ 453 mutex_exit((cp)->cc_lockp); \ 454} 455 456#define zone_dataset_visible(x, y) (1) 457#define INGLOBALZONE(z) (1) 458 459#define open64 open 460int mkdirp(const char *, mode_t); 461 462/* 463 * Hostname information 464 */ 465extern struct utsname utsname; 466extern char hw_serial[]; 467extern int ddi_strtoul(const char *str, char **nptr, int base, 468 unsigned long *result); 469#define ddi_get_lbolt() (gethrtime() >> 23) 470#define ddi_get_lbolt64() (gethrtime() >> 23) 471 472/* ZFS Boot Related stuff. */ 473 474struct _buf { 475 intptr_t _fd; 476}; 477 478struct bootstat { 479 uint64_t st_size; 480}; 481 482extern int zfs_secpolicy_snapshot_perms(const char *name, cred_t *cr); 483extern int zfs_secpolicy_rename_perms(const char *from, const char *to, 484 cred_t *cr); 485extern int zfs_secpolicy_destroy_perms(const char *name, cred_t *cr); 486 487extern struct _buf *kobj_open_file(char *name); 488extern int kobj_read_file(struct _buf *file, char *buf, unsigned size, 489 unsigned off); 490extern void kobj_close_file(struct _buf *file); 491extern int kobj_get_filesize(struct _buf *file, uint64_t *size); 492/* Random compatibility stuff. */ 493#define lbolt (gethrtime() >> 23) 494#define lbolt64 (gethrtime() >> 23) 495 496/* extern int hz; */ 497extern uint64_t physmem; 498 499#define gethrestime_sec() time(NULL) 500 501#define pwrite64(d, p, n, o) pwrite(d, p, n, o) 502#define readdir64(d) readdir(d) 503#define sigispending(td, sig) (0) 504#define root_mount_wait() do { } while (0) 505#define root_mounted() (1) 506 507struct file { 508 void *dummy; 509}; 510 511#define FCREAT O_CREAT 512#define FOFFMAX 0x0 513 514#define SYSCTL_DECL(...) 515#define SYSCTL_NODE(...) 516#define SYSCTL_INT(...) 517#define SYSCTL_ULONG(...) 518#ifdef TUNABLE_INT 519#undef TUNABLE_INT 520#undef TUNABLE_ULONG 521#endif 522#define TUNABLE_INT(...) 523#define TUNABLE_ULONG(...) 524 525/* Errors */ 526 527#ifndef ERESTART 528#define ERESTART (-1) 529#endif 530 531#ifdef ptob 532#undef ptob 533#endif 534 535size_t ptob(size_t); 536 537 538typedef struct ksiddomain { 539 uint_t kd_ref; 540 uint_t kd_len; 541 char *kd_name; 542} ksiddomain_t; 543 544ksiddomain_t *ksid_lookupdomain(const char *); 545void ksiddomain_rele(ksiddomain_t *); 546 547typedef struct ace_object { 548 uid_t a_who; 549 uint32_t a_access_mask; 550 uint16_t a_flags; 551 uint16_t a_type; 552 uint8_t a_obj_type[16]; 553 uint8_t a_inherit_obj_type[16]; 554} ace_object_t; 555 556#define ACE_ACCESS_ALLOWED_OBJECT_ACE_TYPE 0x05 557#define ACE_ACCESS_DENIED_OBJECT_ACE_TYPE 0x06 558#define ACE_SYSTEM_AUDIT_OBJECT_ACE_TYPE 0x07 559#define ACE_SYSTEM_ALARM_OBJECT_ACE_TYPE 0x08 560 561/* libzfs_dataset.c */ 562#define priv_allocset() (NULL) 563#define getppriv(a, b) (0) 564#define priv_isfullset(a) (B_FALSE) 565#define priv_freeset(a) (0) 566 567#define di_devlink_init(a, b) (NULL) 568#define di_devlink_fini(a) (0) 569typedef void *di_devlink_handle_t; 570 571extern char *kmem_asprintf(const char *fmt, ...); 572#define strfree(str) kmem_free((str), strlen(str)+1) 573 574#define DEV_PHYS_PATH "phys_path" 575 576#define DDI_SLEEP KM_SLEEP 577#define ddi_log_sysevent(_a, _b, _c, _d, _e, _f, _g) 0 578 579#else /* _KERNEL */ 580 581#include <sys/systm.h> 582#include <sys/kcondvar.h> 583#include <sys/limits.h> 584#include <sys/kmem.h> 585#include <sys/param.h> 586#include <sys/stdint.h> 587#include <sys/note.h> 588#include <sys/kernel.h> 589#include <sys/kstat.h> 590#include <sys/debug.h> 591#include <sys/proc.h> 592#include <sys/sysmacros.h> 593#include <sys/bitmap.h> 594#include <sys/cmn_err.h> 595#include <sys/taskq.h> 596#include <sys/conf.h> 597#include <sys/mutex.h> 598#include <sys/rwlock.h> 599#include <sys/list.h> 600#include <sys/uio.h> 601#include <sys/dirent.h> 602#include <sys/time.h> 603#include <sys/uio.h> 604#include <sys/fcntl.h> 605#include <sys/string.h> 606#include <sys/buf.h> 607#include <sys/cred.h> 608#include <sys/sdt.h> 609#include <sys/file.h> 610#include <sys/vfs.h> 611#include <sys/lockf.h> 612#include <sys/zone.h> 613#include <sys/misc.h> 614#include <sys/zfs_debug.h> 615#include <sys/byteorder.h> 616#include <sys/mman.h> 617#include <sys/random.h> 618#include <sys/pset.h> 619#include <sys/u8_textprep.h> 620#include <sys/sysevent.h> 621#include <sys/sysevent/eventdefs.h> 622 623#include <uvm/uvm_extern.h> 624 625#define CPU_SEQID (curcpu()->ci_data.cpu_index) 626#define lbolt hardclock_ticks 627#define lbolt64 lbolt 628 629clock_t ddi_get_lbolt(void); 630int64_t ddi_get_lbolt64(void); 631 632#ifdef __cplusplus 633} 634#endif 635 636extern int zfs_debug_level; 637extern kmutex_t zfs_debug_mtx; 638#define ZFS_LOG(lvl, ...) do { \ 639 if (((lvl) & 0xff) <= zfs_debug_level) { \ 640 mutex_enter(&zfs_debug_mtx); \ 641 printf("%s:%u[%d]: ", __func__, __LINE__, (lvl)); \ 642 printf(__VA_ARGS__); \ 643 printf("\n"); \ 644 if ((lvl) & 0x100) \ 645 /* XXXNETBSD backtrace */ \ 646 mutex_exit(&zfs_debug_mtx); \ 647 } \ 648} while (0) 649 650extern struct utsname utsname; 651 652#define makedevice(a, b) makedev(a, b) 653#define getmajor(a) major(a) 654#define getminor(a) minor(a) 655#define issig(x) (sigispending(curlwp, 0)) 656#define ISSIG(thr, why) (sigispending(thr, 0)) 657#define fm_panic panic 658 659#ifdef ptob 660#undef ptob 661#endif 662#define ptob(x) ((x) * PAGE_SIZE) 663 664#define strncat(a, b, c) strlcat(a, b, c) 665#define tsd_get(x) lwp_getspecific(x) 666#define tsd_set(x, y) (lwp_setspecific(x, y), 0) 667#define kmem_debugging() 0 668 669#define zone_get_hostid(a) 0 670 671extern char *kmem_asprintf(const char *fmt, ...); 672#define strfree(str) kmem_free((str), strlen(str)+1) 673 674/* NetBSD doesn't need this routines in zfs code, yet */ 675#define taskq_create_proc(a, b, c, d, e, p, f) \ 676 (taskq_create(a, b, c, d, e, f)) 677#define taskq_create_sysdc(a, b, d, e, p, dc, f) \ 678 (taskq_create(a, b, maxclsyspri, d, e, f)) 679 680#define MAXUID UID_MAX 681#define FIGNORECASE 0 682#define CREATE_XATTR_DIR 0 683 684#define DEV_PHYS_PATH "phys_path" 685 686#define DDI_SLEEP KM_SLEEP 687#define ddi_log_sysevent(_a, _b, _c, _d, _e, _f, _g) 0 688 689#define sys_shutdown 0 690 691#endif /* _KERNEL */ 692 693#endif /* _SYS_ZFS_CONTEXT_H */ 694