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 (c) 2005, 2010, Oracle and/or its affiliates. All rights reserved. 23 * Copyright 2011 Nexenta Systems, Inc. All rights reserved. 24 * Copyright (c) 2012 by Delphix. All rights reserved. 25 */ 26 27 #ifndef _SYS_ZFS_CONTEXT_H 28 #define _SYS_ZFS_CONTEXT_H 29 30 #ifdef __cplusplus 31 extern "C" { 32 #endif 33 34 #define _SYS_MUTEX_H 35 #define _SYS_RWLOCK_H 36 #define _SYS_CONDVAR_H 37 #define _SYS_SYSTM_H 38 #define _SYS_DEBUG_H 39 #define _SYS_T_LOCK_H 40 #define _SYS_VNODE_H 41 #define _SYS_VFS_H 42 #define _SYS_SUNDDI_H 43 #define _SYS_CALLB_H 44 45 #include <stdio.h> 46 #include <stdlib.h> 47 #include <stddef.h> 48 #include <stdarg.h> 49 #include <fcntl.h> 50 #include <unistd.h> 51 #include <errno.h> 52 #include <string.h> 53 #include <strings.h> 54 #include <synch.h> 55 #include <thread.h> 56 #include <assert.h> 57 #include <alloca.h> 58 #include <umem.h> 59 #include <limits.h> 60 #include <atomic.h> 61 #include <dirent.h> 62 #include <time.h> 63 #include <libsysevent.h> 64 #include <sys/note.h> 65 #include <sys/types.h> 66 #include <sys/cred.h> 67 #include <sys/sysmacros.h> 68 #include <sys/bitmap.h> 69 #include <sys/resource.h> 70 #include <sys/byteorder.h> 71 #include <sys/list.h> 72 #include <sys/uio.h> 73 #include <sys/zfs_debug.h> 74 #include <sys/sdt.h> 75 #include <sys/kstat.h> 76 #include <sys/u8_textprep.h> 77 #include <sys/sysevent/eventdefs.h> 78 #include <sys/sysevent/dev.h> 79 #include <sys/sunddi.h> 80 81 /* 82 * Debugging 83 */ 84 85 /* 86 * Note that we are not using the debugging levels. 87 */ 88 89 #define CE_CONT 0 /* continuation */ 90 #define CE_NOTE 1 /* notice */ 91 #define CE_WARN 2 /* warning */ 92 #define CE_PANIC 3 /* panic */ 93 #define CE_IGNORE 4 /* print nothing */ 94 95 /* 96 * ZFS debugging 97 */ 98 99 #ifdef ZFS_DEBUG 100 extern void dprintf_setup(int *argc, char **argv); 101 #endif /* ZFS_DEBUG */ 102 103 extern void cmn_err(int, const char *, ...); 104 extern void vcmn_err(int, const char *, __va_list); 105 extern void panic(const char *, ...); 106 extern void vpanic(const char *, __va_list); 107 108 #define fm_panic panic 109 110 extern int aok; 111 112 /* This definition is copied from assert.h. */ 113 #if defined(__STDC__) 114 #if __STDC_VERSION__ - 0 >= 199901L 115 #define zverify(EX) (void)((EX) || (aok) || \ 116 (__assert_c99(#EX, __FILE__, __LINE__, __func__), 0)) 117 #else 118 #define zverify(EX) (void)((EX) || (aok) || \ 119 (__assert(#EX, __FILE__, __LINE__), 0)) 120 #endif /* __STDC_VERSION__ - 0 >= 199901L */ 121 #else 122 #define zverify(EX) (void)((EX) || (aok) || \ 123 (_assert("EX", __FILE__, __LINE__), 0)) 124 #endif /* __STDC__ */ 125 126 127 #define VERIFY zverify 128 #define ASSERT zverify 129 #undef assert 130 #define assert zverify 131 132 extern void __assert(const char *, const char *, int); 133 134 #ifdef lint 135 #define VERIFY3_IMPL(x, y, z, t) if (x == z) ((void)0) 136 #else 137 /* BEGIN CSTYLED */ 138 #define VERIFY3_IMPL(LEFT, OP, RIGHT, TYPE) do { \ 139 const TYPE __left = (TYPE)(LEFT); \ 140 const TYPE __right = (TYPE)(RIGHT); \ 141 if (!(__left OP __right) && (!aok)) { \ 142 char *__buf = alloca(256); \ 143 (void) snprintf(__buf, 256, "%s %s %s (0x%llx %s 0x%llx)", \ 144 #LEFT, #OP, #RIGHT, \ 145 (u_longlong_t)__left, #OP, (u_longlong_t)__right); \ 146 __assert(__buf, __FILE__, __LINE__); \ 147 } \ 148 _NOTE(CONSTCOND) } while (0) 149 /* END CSTYLED */ 150 #endif /* lint */ 151 152 #define VERIFY3S(x, y, z) VERIFY3_IMPL(x, y, z, int64_t) 153 #define VERIFY3U(x, y, z) VERIFY3_IMPL(x, y, z, uint64_t) 154 #define VERIFY3P(x, y, z) VERIFY3_IMPL(x, y, z, uintptr_t) 155 156 #ifdef NDEBUG 157 #define ASSERT3S(x, y, z) ((void)0) 158 #define ASSERT3U(x, y, z) ((void)0) 159 #define ASSERT3P(x, y, z) ((void)0) 160 #else 161 #define ASSERT3S(x, y, z) VERIFY3S(x, y, z) 162 #define ASSERT3U(x, y, z) VERIFY3U(x, y, z) 163 #define ASSERT3P(x, y, z) VERIFY3P(x, y, z) 164 #endif 165 166 /* 167 * DTrace SDT probes have different signatures in userland than they do in 168 * kernel. If they're being used in kernel code, re-define them out of 169 * existence for their counterparts in libzpool. 170 */ 171 172 #ifdef DTRACE_PROBE 173 #undef DTRACE_PROBE 174 #define DTRACE_PROBE(a) ((void)0) 175 #endif /* DTRACE_PROBE */ 176 177 #ifdef DTRACE_PROBE1 178 #undef DTRACE_PROBE1 179 #define DTRACE_PROBE1(a, b, c) ((void)0) 180 #endif /* DTRACE_PROBE1 */ 181 182 #ifdef DTRACE_PROBE2 183 #undef DTRACE_PROBE2 184 #define DTRACE_PROBE2(a, b, c, d, e) ((void)0) 185 #endif /* DTRACE_PROBE2 */ 186 187 #ifdef DTRACE_PROBE3 188 #undef DTRACE_PROBE3 189 #define DTRACE_PROBE3(a, b, c, d, e, f, g) ((void)0) 190 #endif /* DTRACE_PROBE3 */ 191 192 #ifdef DTRACE_PROBE4 193 #undef DTRACE_PROBE4 194 #define DTRACE_PROBE4(a, b, c, d, e, f, g, h, i) ((void)0) 195 #endif /* DTRACE_PROBE4 */ 196 197 /* 198 * Threads 199 */ 200 #define curthread ((void *)(uintptr_t)thr_self()) 201 202 typedef struct kthread kthread_t; 203 204 #define thread_create(stk, stksize, func, arg, len, pp, state, pri) \ 205 zk_thread_create(func, arg) 206 #define thread_exit() thr_exit(NULL) 207 #define thread_join(t) panic("libzpool cannot join threads") 208 209 #define newproc(f, a, cid, pri, ctp, pid) (ENOSYS) 210 211 /* in libzpool, p0 exists only to have its address taken */ 212 struct proc { 213 uintptr_t this_is_never_used_dont_dereference_it; 214 }; 215 216 extern struct proc p0; 217 218 #define PS_NONE -1 219 220 extern kthread_t *zk_thread_create(void (*func)(), void *arg); 221 222 #define issig(why) (FALSE) 223 #define ISSIG(thr, why) (FALSE) 224 225 /* 226 * Mutexes 227 */ 228 typedef struct kmutex { 229 void *m_owner; 230 boolean_t initialized; 231 mutex_t m_lock; 232 } kmutex_t; 233 234 #define MUTEX_DEFAULT USYNC_THREAD 235 #undef MUTEX_HELD 236 #undef MUTEX_NOT_HELD 237 #define MUTEX_HELD(m) _mutex_held(&(m)->m_lock) 238 #define MUTEX_NOT_HELD(m) (!MUTEX_HELD(m)) 239 240 /* 241 * Argh -- we have to get cheesy here because the kernel and userland 242 * have different signatures for the same routine. 243 */ 244 extern int _mutex_init(mutex_t *mp, int type, void *arg); 245 extern int _mutex_destroy(mutex_t *mp); 246 247 #define mutex_init(mp, b, c, d) zmutex_init((kmutex_t *)(mp)) 248 #define mutex_destroy(mp) zmutex_destroy((kmutex_t *)(mp)) 249 250 extern void zmutex_init(kmutex_t *mp); 251 extern void zmutex_destroy(kmutex_t *mp); 252 extern void mutex_enter(kmutex_t *mp); 253 extern void mutex_exit(kmutex_t *mp); 254 extern int mutex_tryenter(kmutex_t *mp); 255 extern void *mutex_owner(kmutex_t *mp); 256 257 /* 258 * RW locks 259 */ 260 typedef struct krwlock { 261 void *rw_owner; 262 boolean_t initialized; 263 rwlock_t rw_lock; 264 } krwlock_t; 265 266 typedef int krw_t; 267 268 #define RW_READER 0 269 #define RW_WRITER 1 270 #define RW_DEFAULT USYNC_THREAD 271 272 #undef RW_READ_HELD 273 #define RW_READ_HELD(x) _rw_read_held(&(x)->rw_lock) 274 275 #undef RW_WRITE_HELD 276 #define RW_WRITE_HELD(x) _rw_write_held(&(x)->rw_lock) 277 278 extern void rw_init(krwlock_t *rwlp, char *name, int type, void *arg); 279 extern void rw_destroy(krwlock_t *rwlp); 280 extern void rw_enter(krwlock_t *rwlp, krw_t rw); 281 extern int rw_tryenter(krwlock_t *rwlp, krw_t rw); 282 extern int rw_tryupgrade(krwlock_t *rwlp); 283 extern void rw_exit(krwlock_t *rwlp); 284 #define rw_downgrade(rwlp) do { } while (0) 285 286 extern uid_t crgetuid(cred_t *cr); 287 extern gid_t crgetgid(cred_t *cr); 288 extern int crgetngroups(cred_t *cr); 289 extern gid_t *crgetgroups(cred_t *cr); 290 291 /* 292 * Condition variables 293 */ 294 typedef cond_t kcondvar_t; 295 296 #define CV_DEFAULT USYNC_THREAD 297 298 extern void cv_init(kcondvar_t *cv, char *name, int type, void *arg); 299 extern void cv_destroy(kcondvar_t *cv); 300 extern void cv_wait(kcondvar_t *cv, kmutex_t *mp); 301 extern clock_t cv_timedwait(kcondvar_t *cv, kmutex_t *mp, clock_t abstime); 302 extern void cv_signal(kcondvar_t *cv); 303 extern void cv_broadcast(kcondvar_t *cv); 304 305 /* 306 * kstat creation, installation and deletion 307 */ 308 extern kstat_t *kstat_create(char *, int, 309 char *, char *, uchar_t, ulong_t, uchar_t); 310 extern void kstat_install(kstat_t *); 311 extern void kstat_delete(kstat_t *); 312 313 /* 314 * Kernel memory 315 */ 316 #define KM_SLEEP UMEM_NOFAIL 317 #define KM_PUSHPAGE KM_SLEEP 318 #define KM_NOSLEEP UMEM_DEFAULT 319 #define KMC_NODEBUG UMC_NODEBUG 320 #define KMC_NOTOUCH 0 /* not needed for userland caches */ 321 #define kmem_alloc(_s, _f) umem_alloc(_s, _f) 322 #define kmem_zalloc(_s, _f) umem_zalloc(_s, _f) 323 #define kmem_free(_b, _s) umem_free(_b, _s) 324 #define kmem_cache_create(_a, _b, _c, _d, _e, _f, _g, _h, _i) \ 325 umem_cache_create(_a, _b, _c, _d, _e, _f, _g, _h, _i) 326 #define kmem_cache_destroy(_c) umem_cache_destroy(_c) 327 #define kmem_cache_alloc(_c, _f) umem_cache_alloc(_c, _f) 328 #define kmem_cache_free(_c, _b) umem_cache_free(_c, _b) 329 #define kmem_debugging() 0 330 #define kmem_cache_reap_now(_c) /* nothing */ 331 #define kmem_cache_set_move(_c, _cb) /* nothing */ 332 #define vmem_qcache_reap(_v) /* nothing */ 333 #define POINTER_INVALIDATE(_pp) /* nothing */ 334 #define POINTER_IS_VALID(_p) 0 335 336 extern vmem_t *zio_arena; 337 338 typedef umem_cache_t kmem_cache_t; 339 340 typedef enum kmem_cbrc { 341 KMEM_CBRC_YES, 342 KMEM_CBRC_NO, 343 KMEM_CBRC_LATER, 344 KMEM_CBRC_DONT_NEED, 345 KMEM_CBRC_DONT_KNOW 346 } kmem_cbrc_t; 347 348 /* 349 * Task queues 350 */ 351 typedef struct taskq taskq_t; 352 typedef uintptr_t taskqid_t; 353 typedef void (task_func_t)(void *); 354 355 typedef struct taskq_ent { 356 struct taskq_ent *tqent_next; 357 struct taskq_ent *tqent_prev; 358 task_func_t *tqent_func; 359 void *tqent_arg; 360 uintptr_t tqent_flags; 361 } taskq_ent_t; 362 363 #define TQENT_FLAG_PREALLOC 0x1 /* taskq_dispatch_ent used */ 364 365 #define TASKQ_PREPOPULATE 0x0001 366 #define TASKQ_CPR_SAFE 0x0002 /* Use CPR safe protocol */ 367 #define TASKQ_DYNAMIC 0x0004 /* Use dynamic thread scheduling */ 368 #define TASKQ_THREADS_CPU_PCT 0x0008 /* Scale # threads by # cpus */ 369 #define TASKQ_DC_BATCH 0x0010 /* Mark threads as batch */ 370 371 #define TQ_SLEEP KM_SLEEP /* Can block for memory */ 372 #define TQ_NOSLEEP KM_NOSLEEP /* cannot block for memory; may fail */ 373 #define TQ_NOQUEUE 0x02 /* Do not enqueue if can't dispatch */ 374 #define TQ_FRONT 0x08 /* Queue in front */ 375 376 377 extern taskq_t *system_taskq; 378 379 extern taskq_t *taskq_create(const char *, int, pri_t, int, int, uint_t); 380 #define taskq_create_proc(a, b, c, d, e, p, f) \ 381 (taskq_create(a, b, c, d, e, f)) 382 #define taskq_create_sysdc(a, b, d, e, p, dc, f) \ 383 (taskq_create(a, b, maxclsyspri, d, e, f)) 384 extern taskqid_t taskq_dispatch(taskq_t *, task_func_t, void *, uint_t); 385 extern void taskq_dispatch_ent(taskq_t *, task_func_t, void *, uint_t, 386 taskq_ent_t *); 387 extern void taskq_destroy(taskq_t *); 388 extern void taskq_wait(taskq_t *); 389 extern int taskq_member(taskq_t *, void *); 390 extern void system_taskq_init(void); 391 extern void system_taskq_fini(void); 392 393 #define XVA_MAPSIZE 3 394 #define XVA_MAGIC 0x78766174 395 396 /* 397 * vnodes 398 */ 399 typedef struct vnode { 400 uint64_t v_size; 401 int v_fd; 402 char *v_path; 403 } vnode_t; 404 405 #define AV_SCANSTAMP_SZ 32 /* length of anti-virus scanstamp */ 406 407 typedef struct xoptattr { 408 timestruc_t xoa_createtime; /* Create time of file */ 409 uint8_t xoa_archive; 410 uint8_t xoa_system; 411 uint8_t xoa_readonly; 412 uint8_t xoa_hidden; 413 uint8_t xoa_nounlink; 414 uint8_t xoa_immutable; 415 uint8_t xoa_appendonly; 416 uint8_t xoa_nodump; 417 uint8_t xoa_settable; 418 uint8_t xoa_opaque; 419 uint8_t xoa_av_quarantined; 420 uint8_t xoa_av_modified; 421 uint8_t xoa_av_scanstamp[AV_SCANSTAMP_SZ]; 422 uint8_t xoa_reparse; 423 uint8_t xoa_offline; 424 uint8_t xoa_sparse; 425 } xoptattr_t; 426 427 typedef struct vattr { 428 uint_t va_mask; /* bit-mask of attributes */ 429 u_offset_t va_size; /* file size in bytes */ 430 } vattr_t; 431 432 433 typedef struct xvattr { 434 vattr_t xva_vattr; /* Embedded vattr structure */ 435 uint32_t xva_magic; /* Magic Number */ 436 uint32_t xva_mapsize; /* Size of attr bitmap (32-bit words) */ 437 uint32_t *xva_rtnattrmapp; /* Ptr to xva_rtnattrmap[] */ 438 uint32_t xva_reqattrmap[XVA_MAPSIZE]; /* Requested attrs */ 439 uint32_t xva_rtnattrmap[XVA_MAPSIZE]; /* Returned attrs */ 440 xoptattr_t xva_xoptattrs; /* Optional attributes */ 441 } xvattr_t; 442 443 typedef struct vsecattr { 444 uint_t vsa_mask; /* See below */ 445 int vsa_aclcnt; /* ACL entry count */ 446 void *vsa_aclentp; /* pointer to ACL entries */ 447 int vsa_dfaclcnt; /* default ACL entry count */ 448 void *vsa_dfaclentp; /* pointer to default ACL entries */ 449 size_t vsa_aclentsz; /* ACE size in bytes of vsa_aclentp */ 450 } vsecattr_t; 451 452 #define AT_TYPE 0x00001 453 #define AT_MODE 0x00002 454 #define AT_UID 0x00004 455 #define AT_GID 0x00008 456 #define AT_FSID 0x00010 457 #define AT_NODEID 0x00020 458 #define AT_NLINK 0x00040 459 #define AT_SIZE 0x00080 460 #define AT_ATIME 0x00100 461 #define AT_MTIME 0x00200 462 #define AT_CTIME 0x00400 463 #define AT_RDEV 0x00800 464 #define AT_BLKSIZE 0x01000 465 #define AT_NBLOCKS 0x02000 466 #define AT_SEQ 0x08000 467 #define AT_XVATTR 0x10000 468 469 #define CRCREAT 0 470 471 extern int fop_getattr(vnode_t *vp, vattr_t *vap); 472 473 #define VOP_CLOSE(vp, f, c, o, cr, ct) 0 474 #define VOP_PUTPAGE(vp, of, sz, fl, cr, ct) 0 475 #define VOP_GETATTR(vp, vap, fl, cr, ct) fop_getattr((vp), (vap)); 476 477 #define VOP_FSYNC(vp, f, cr, ct) fsync((vp)->v_fd) 478 479 #define VN_RELE(vp) vn_close(vp) 480 481 extern int vn_open(char *path, int x1, int oflags, int mode, vnode_t **vpp, 482 int x2, int x3); 483 extern int vn_openat(char *path, int x1, int oflags, int mode, vnode_t **vpp, 484 int x2, int x3, vnode_t *vp, int fd); 485 extern int vn_rdwr(int uio, vnode_t *vp, void *addr, ssize_t len, 486 offset_t offset, int x1, int x2, rlim64_t x3, void *x4, ssize_t *residp); 487 extern void vn_close(vnode_t *vp); 488 489 #define vn_remove(path, x1, x2) remove(path) 490 #define vn_rename(from, to, seg) rename((from), (to)) 491 #define vn_is_readonly(vp) B_FALSE 492 493 extern vnode_t *rootdir; 494 495 #include <sys/file.h> /* for FREAD, FWRITE, etc */ 496 497 /* 498 * Random stuff 499 */ 500 #define ddi_get_lbolt() (gethrtime() >> 23) 501 #define ddi_get_lbolt64() (gethrtime() >> 23) 502 #define hz 119 /* frequency when using gethrtime() >> 23 for lbolt */ 503 504 extern void delay(clock_t ticks); 505 506 #define gethrestime_sec() time(NULL) 507 #define gethrestime(t) \ 508 do {\ 509 (t)->tv_sec = gethrestime_sec();\ 510 (t)->tv_nsec = 0;\ 511 } while (0); 512 513 #define max_ncpus 64 514 515 #define minclsyspri 60 516 #define maxclsyspri 99 517 518 #define CPU_SEQID (thr_self() & (max_ncpus - 1)) 519 520 #define kcred NULL 521 #define CRED() NULL 522 523 #define ptob(x) ((x) * PAGESIZE) 524 525 extern uint64_t physmem; 526 527 extern int highbit(ulong_t i); 528 extern int random_get_bytes(uint8_t *ptr, size_t len); 529 extern int random_get_pseudo_bytes(uint8_t *ptr, size_t len); 530 531 extern void kernel_init(int); 532 extern void kernel_fini(void); 533 534 struct spa; 535 extern void nicenum(uint64_t num, char *buf); 536 extern void show_pool_stats(struct spa *); 537 538 typedef struct callb_cpr { 539 kmutex_t *cc_lockp; 540 } callb_cpr_t; 541 542 #define CALLB_CPR_INIT(cp, lockp, func, name) { \ 543 (cp)->cc_lockp = lockp; \ 544 } 545 546 #define CALLB_CPR_SAFE_BEGIN(cp) { \ 547 ASSERT(MUTEX_HELD((cp)->cc_lockp)); \ 548 } 549 550 #define CALLB_CPR_SAFE_END(cp, lockp) { \ 551 ASSERT(MUTEX_HELD((cp)->cc_lockp)); \ 552 } 553 554 #define CALLB_CPR_EXIT(cp) { \ 555 ASSERT(MUTEX_HELD((cp)->cc_lockp)); \ 556 mutex_exit((cp)->cc_lockp); \ 557 } 558 559 #define zone_dataset_visible(x, y) (1) 560 #define INGLOBALZONE(z) (1) 561 562 extern char *kmem_asprintf(const char *fmt, ...); 563 #define strfree(str) kmem_free((str), strlen(str)+1) 564 565 /* 566 * Hostname information 567 */ 568 extern char hw_serial[]; /* for userland-emulated hostid access */ 569 extern int ddi_strtoul(const char *str, char **nptr, int base, 570 unsigned long *result); 571 572 extern int ddi_strtoull(const char *str, char **nptr, int base, 573 u_longlong_t *result); 574 575 /* ZFS Boot Related stuff. */ 576 577 struct _buf { 578 intptr_t _fd; 579 }; 580 581 struct bootstat { 582 uint64_t st_size; 583 }; 584 585 typedef struct ace_object { 586 uid_t a_who; 587 uint32_t a_access_mask; 588 uint16_t a_flags; 589 uint16_t a_type; 590 uint8_t a_obj_type[16]; 591 uint8_t a_inherit_obj_type[16]; 592 } ace_object_t; 593 594 595 #define ACE_ACCESS_ALLOWED_OBJECT_ACE_TYPE 0x05 596 #define ACE_ACCESS_DENIED_OBJECT_ACE_TYPE 0x06 597 #define ACE_SYSTEM_AUDIT_OBJECT_ACE_TYPE 0x07 598 #define ACE_SYSTEM_ALARM_OBJECT_ACE_TYPE 0x08 599 600 extern struct _buf *kobj_open_file(char *name); 601 extern int kobj_read_file(struct _buf *file, char *buf, unsigned size, 602 unsigned off); 603 extern void kobj_close_file(struct _buf *file); 604 extern int kobj_get_filesize(struct _buf *file, uint64_t *size); 605 extern int zfs_secpolicy_snapshot_perms(const char *name, cred_t *cr); 606 extern int zfs_secpolicy_rename_perms(const char *from, const char *to, 607 cred_t *cr); 608 extern int zfs_secpolicy_destroy_perms(const char *name, cred_t *cr); 609 extern zoneid_t getzoneid(void); 610 611 /* SID stuff */ 612 typedef struct ksiddomain { 613 uint_t kd_ref; 614 uint_t kd_len; 615 char *kd_name; 616 } ksiddomain_t; 617 618 ksiddomain_t *ksid_lookupdomain(const char *); 619 void ksiddomain_rele(ksiddomain_t *); 620 621 #define DDI_SLEEP KM_SLEEP 622 #define ddi_log_sysevent(_a, _b, _c, _d, _e, _f, _g) \ 623 sysevent_post_event(_c, _d, _b, "libzpool", _e, _f) 624 625 #ifdef __cplusplus 626 } 627 #endif 628 629 #endif /* _SYS_ZFS_CONTEXT_H */ 630