]>
git.proxmox.com Git - mirror_zfs.git/blob - lib/libzpool/kernel.c
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.
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.
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]
22 * Copyright (c) 2005, 2010, Oracle and/or its affiliates. All rights reserved.
23 * Copyright (c) 2016 Actifio, Inc. All rights reserved.
34 #include <sys/signal.h>
37 #include <sys/processor.h>
38 #include <sys/zfs_context.h>
39 #include <sys/rrwlock.h>
40 #include <sys/utsname.h>
42 #include <sys/systeminfo.h>
43 #include <zfs_fletcher.h>
44 #include <sys/crypto/icp.h>
47 * Emulation of kernel services in userland.
52 vnode_t
*rootdir
= (vnode_t
*)0xabcd1234;
53 char hw_serial
[HW_HOSTID_LEN
];
54 struct utsname hw_utsname
;
55 vmem_t
*zio_arena
= NULL
;
57 /* If set, all blocks read will be copied to the specified directory. */
58 char *vn_dumpdir
= NULL
;
60 /* this only exists to have its address taken */
64 * =========================================================================
66 * =========================================================================
68 * TS_STACK_MIN is dictated by the minimum allowed pthread stack size. While
69 * TS_STACK_MAX is somewhat arbitrary, it was selected to be large enough for
70 * the expected stack depth while small enough to avoid exhausting address
71 * space with high thread counts.
73 #define TS_STACK_MIN MAX(PTHREAD_STACK_MIN, 32768)
74 #define TS_STACK_MAX (256 * 1024)
78 zk_thread_create(void (*func
)(void *), void *arg
, size_t stksize
, int state
)
83 int detachstate
= PTHREAD_CREATE_DETACHED
;
85 VERIFY0(pthread_attr_init(&attr
));
87 if (state
& TS_JOINABLE
)
88 detachstate
= PTHREAD_CREATE_JOINABLE
;
90 VERIFY0(pthread_attr_setdetachstate(&attr
, detachstate
));
93 * We allow the default stack size in user space to be specified by
94 * setting the ZFS_STACK_SIZE environment variable. This allows us
95 * the convenience of observing and debugging stack overruns in
96 * user space. Explicitly specified stack sizes will be honored.
97 * The usage of ZFS_STACK_SIZE is discussed further in the
98 * ENVIRONMENT VARIABLES sections of the ztest(1) man page.
101 stkstr
= getenv("ZFS_STACK_SIZE");
104 stksize
= TS_STACK_MAX
;
106 stksize
= MAX(atoi(stkstr
), TS_STACK_MIN
);
109 VERIFY3S(stksize
, >, 0);
110 stksize
= P2ROUNDUP(MAX(stksize
, TS_STACK_MIN
), PAGESIZE
);
113 * If this ever fails, it may be because the stack size is not a
114 * multiple of system page size.
116 VERIFY0(pthread_attr_setstacksize(&attr
, stksize
));
117 VERIFY0(pthread_attr_setguardsize(&attr
, PAGESIZE
));
119 VERIFY0(pthread_create(&tid
, &attr
, (void *(*)(void *))func
, arg
));
120 VERIFY0(pthread_attr_destroy(&attr
));
122 return ((void *)(uintptr_t)tid
);
126 * =========================================================================
128 * =========================================================================
132 kstat_create(const char *module
, int instance
, const char *name
,
133 const char *class, uchar_t type
, ulong_t ndata
, uchar_t ks_flag
)
140 kstat_install(kstat_t
*ksp
)
145 kstat_delete(kstat_t
*ksp
)
150 kstat_waitq_enter(kstat_io_t
*kiop
)
155 kstat_waitq_exit(kstat_io_t
*kiop
)
160 kstat_runq_enter(kstat_io_t
*kiop
)
165 kstat_runq_exit(kstat_io_t
*kiop
)
170 kstat_waitq_to_runq(kstat_io_t
*kiop
)
175 kstat_runq_back_to_waitq(kstat_io_t
*kiop
)
179 kstat_set_raw_ops(kstat_t
*ksp
,
180 int (*headers
)(char *buf
, size_t size
),
181 int (*data
)(char *buf
, size_t size
, void *data
),
182 void *(*addr
)(kstat_t
*ksp
, loff_t index
))
186 * =========================================================================
188 * =========================================================================
192 mutex_init(kmutex_t
*mp
, char *name
, int type
, void *cookie
)
194 VERIFY0(pthread_mutex_init(&mp
->m_lock
, NULL
));
195 memset(&mp
->m_owner
, 0, sizeof (pthread_t
));
199 mutex_destroy(kmutex_t
*mp
)
201 VERIFY0(pthread_mutex_destroy(&mp
->m_lock
));
205 mutex_enter(kmutex_t
*mp
)
207 VERIFY0(pthread_mutex_lock(&mp
->m_lock
));
208 mp
->m_owner
= pthread_self();
212 mutex_tryenter(kmutex_t
*mp
)
216 error
= pthread_mutex_trylock(&mp
->m_lock
);
218 mp
->m_owner
= pthread_self();
221 VERIFY3S(error
, ==, EBUSY
);
227 mutex_exit(kmutex_t
*mp
)
229 memset(&mp
->m_owner
, 0, sizeof (pthread_t
));
230 VERIFY0(pthread_mutex_unlock(&mp
->m_lock
));
234 * =========================================================================
236 * =========================================================================
240 rw_init(krwlock_t
*rwlp
, char *name
, int type
, void *arg
)
242 VERIFY0(pthread_rwlock_init(&rwlp
->rw_lock
, NULL
));
243 rwlp
->rw_readers
= 0;
248 rw_destroy(krwlock_t
*rwlp
)
250 VERIFY0(pthread_rwlock_destroy(&rwlp
->rw_lock
));
254 rw_enter(krwlock_t
*rwlp
, krw_t rw
)
256 if (rw
== RW_READER
) {
257 VERIFY0(pthread_rwlock_rdlock(&rwlp
->rw_lock
));
258 atomic_inc_uint(&rwlp
->rw_readers
);
260 VERIFY0(pthread_rwlock_wrlock(&rwlp
->rw_lock
));
261 rwlp
->rw_owner
= pthread_self();
266 rw_exit(krwlock_t
*rwlp
)
268 if (RW_READ_HELD(rwlp
))
269 atomic_dec_uint(&rwlp
->rw_readers
);
273 VERIFY0(pthread_rwlock_unlock(&rwlp
->rw_lock
));
277 rw_tryenter(krwlock_t
*rwlp
, krw_t rw
)
282 error
= pthread_rwlock_tryrdlock(&rwlp
->rw_lock
);
284 error
= pthread_rwlock_trywrlock(&rwlp
->rw_lock
);
288 atomic_inc_uint(&rwlp
->rw_readers
);
290 rwlp
->rw_owner
= pthread_self();
295 VERIFY3S(error
, ==, EBUSY
);
301 rw_tryupgrade(krwlock_t
*rwlp
)
307 * =========================================================================
308 * condition variables
309 * =========================================================================
313 cv_init(kcondvar_t
*cv
, char *name
, int type
, void *arg
)
315 VERIFY0(pthread_cond_init(cv
, NULL
));
319 cv_destroy(kcondvar_t
*cv
)
321 VERIFY0(pthread_cond_destroy(cv
));
325 cv_wait(kcondvar_t
*cv
, kmutex_t
*mp
)
327 memset(&mp
->m_owner
, 0, sizeof (pthread_t
));
328 VERIFY0(pthread_cond_wait(cv
, &mp
->m_lock
));
329 mp
->m_owner
= pthread_self();
333 cv_timedwait(kcondvar_t
*cv
, kmutex_t
*mp
, clock_t abstime
)
340 delta
= abstime
- ddi_get_lbolt();
344 VERIFY(gettimeofday(&tv
, NULL
) == 0);
346 ts
.tv_sec
= tv
.tv_sec
+ delta
/ hz
;
347 ts
.tv_nsec
= tv
.tv_usec
* NSEC_PER_USEC
+ (delta
% hz
) * (NANOSEC
/ hz
);
348 if (ts
.tv_nsec
>= NANOSEC
) {
350 ts
.tv_nsec
-= NANOSEC
;
353 memset(&mp
->m_owner
, 0, sizeof (pthread_t
));
354 error
= pthread_cond_timedwait(cv
, &mp
->m_lock
, &ts
);
355 mp
->m_owner
= pthread_self();
357 if (error
== ETIMEDOUT
)
367 cv_timedwait_hires(kcondvar_t
*cv
, kmutex_t
*mp
, hrtime_t tim
, hrtime_t res
,
375 ASSERT(flag
== 0 || flag
== CALLOUT_FLAG_ABSOLUTE
);
378 if (flag
& CALLOUT_FLAG_ABSOLUTE
)
379 delta
-= gethrtime();
384 VERIFY0(gettimeofday(&tv
, NULL
));
386 ts
.tv_sec
= tv
.tv_sec
+ delta
/ NANOSEC
;
387 ts
.tv_nsec
= tv
.tv_usec
* NSEC_PER_USEC
+ (delta
% NANOSEC
);
388 if (ts
.tv_nsec
>= NANOSEC
) {
390 ts
.tv_nsec
-= NANOSEC
;
393 memset(&mp
->m_owner
, 0, sizeof (pthread_t
));
394 error
= pthread_cond_timedwait(cv
, &mp
->m_lock
, &ts
);
395 mp
->m_owner
= pthread_self();
397 if (error
== ETIMEDOUT
)
406 cv_signal(kcondvar_t
*cv
)
408 VERIFY0(pthread_cond_signal(cv
));
412 cv_broadcast(kcondvar_t
*cv
)
414 VERIFY0(pthread_cond_broadcast(cv
));
418 * =========================================================================
420 * =========================================================================
423 * Note: for the xxxat() versions of these functions, we assume that the
424 * starting vp is always rootdir (which is true for spa_directory.c, the only
425 * ZFS consumer of these interfaces). We assert this is true, and then emulate
426 * them by adding '/' in front of the path.
431 vn_open(char *path
, int x1
, int flags
, int mode
, vnode_t
**vpp
, int x2
, int x3
)
441 realpath
= umem_alloc(MAXPATHLEN
, UMEM_NOFAIL
);
444 * If we're accessing a real disk from userland, we need to use
445 * the character interface to avoid caching. This is particularly
446 * important if we're trying to look at a real in-kernel storage
447 * pool from userland, e.g. via zdb, because otherwise we won't
448 * see the changes occurring under the segmap cache.
449 * On the other hand, the stupid character device returns zero
450 * for its size. So -- gag -- we open the block device to get
451 * its size, and remember it for subsequent VOP_GETATTR().
453 #if defined(__sun__) || defined(__sun)
454 if (strncmp(path
, "/dev/", 5) == 0) {
459 fd
= open64(path
, O_RDONLY
);
465 if (fstat64(fd
, &st
) == -1) {
472 (void) sprintf(realpath
, "%s", path
);
473 dsk
= strstr(path
, "/dsk/");
475 (void) sprintf(realpath
+ (dsk
- path
) + 1, "r%s",
478 (void) sprintf(realpath
, "%s", path
);
479 if (!(flags
& FCREAT
) && stat64(realpath
, &st
) == -1) {
486 if (!(flags
& FCREAT
) && S_ISBLK(st
.st_mode
)) {
490 /* We shouldn't be writing to block devices in userspace */
491 VERIFY(!(flags
& FWRITE
));
495 old_umask
= umask(0);
498 * The construct 'flags - FREAD' conveniently maps combinations of
499 * FREAD and FWRITE to the corresponding O_RDONLY, O_WRONLY, and O_RDWR.
501 fd
= open64(realpath
, flags
- FREAD
, mode
);
509 (void) umask(old_umask
);
511 if (vn_dumpdir
!= NULL
) {
512 char *dumppath
= umem_zalloc(MAXPATHLEN
, UMEM_NOFAIL
);
513 (void) snprintf(dumppath
, MAXPATHLEN
,
514 "%s/%s", vn_dumpdir
, basename(realpath
));
515 dump_fd
= open64(dumppath
, O_CREAT
| O_WRONLY
, 0666);
516 umem_free(dumppath
, MAXPATHLEN
);
529 if (fstat64_blk(fd
, &st
) == -1) {
537 (void) fcntl(fd
, F_SETFD
, FD_CLOEXEC
);
539 *vpp
= vp
= umem_zalloc(sizeof (vnode_t
), UMEM_NOFAIL
);
542 vp
->v_size
= st
.st_size
;
543 vp
->v_path
= spa_strdup(path
);
544 vp
->v_dump_fd
= dump_fd
;
551 vn_openat(char *path
, int x1
, int flags
, int mode
, vnode_t
**vpp
, int x2
,
552 int x3
, vnode_t
*startvp
, int fd
)
554 char *realpath
= umem_alloc(strlen(path
) + 2, UMEM_NOFAIL
);
557 ASSERT(startvp
== rootdir
);
558 (void) sprintf(realpath
, "/%s", path
);
560 /* fd ignored for now, need if want to simulate nbmand support */
561 ret
= vn_open(realpath
, x1
, flags
, mode
, vpp
, x2
, x3
);
563 umem_free(realpath
, strlen(path
) + 2);
570 vn_rdwr(int uio
, vnode_t
*vp
, void *addr
, ssize_t len
, offset_t offset
,
571 int x1
, int x2
, rlim64_t x3
, void *x4
, ssize_t
*residp
)
573 ssize_t rc
, done
= 0, split
;
575 if (uio
== UIO_READ
) {
576 rc
= pread64(vp
->v_fd
, addr
, len
, offset
);
577 if (vp
->v_dump_fd
!= -1 && rc
!= -1) {
579 status
= pwrite64(vp
->v_dump_fd
, addr
, rc
, offset
);
580 ASSERT(status
!= -1);
584 * To simulate partial disk writes, we split writes into two
585 * system calls so that the process can be killed in between.
587 int sectors
= len
>> SPA_MINBLOCKSHIFT
;
588 split
= (sectors
> 0 ? rand() % sectors
: 0) <<
590 rc
= pwrite64(vp
->v_fd
, addr
, split
, offset
);
593 rc
= pwrite64(vp
->v_fd
, (char *)addr
+ split
,
594 len
- split
, offset
+ split
);
599 if (rc
== -1 && errno
== EINVAL
) {
601 * Under Linux, this most likely means an alignment issue
602 * (memory or disk) due to O_DIRECT, so we abort() in order to
603 * catch the offender.
614 *residp
= len
- done
;
615 else if (done
!= len
)
621 vn_close(vnode_t
*vp
)
624 if (vp
->v_dump_fd
!= -1)
625 close(vp
->v_dump_fd
);
626 spa_strfree(vp
->v_path
);
627 umem_free(vp
, sizeof (vnode_t
));
631 * At a minimum we need to update the size since vdev_reopen()
632 * will no longer call vn_openat().
635 fop_getattr(vnode_t
*vp
, vattr_t
*vap
)
640 if (fstat64_blk(vp
->v_fd
, &st
) == -1) {
646 vap
->va_size
= st
.st_size
;
651 * =========================================================================
652 * Figure out which debugging statements to print
653 * =========================================================================
656 static char *dprintf_string
;
657 static int dprintf_print_all
;
660 dprintf_find_string(const char *string
)
662 char *tmp_str
= dprintf_string
;
663 int len
= strlen(string
);
666 * Find out if this is a string we want to print.
667 * String format: file1.c,function_name1,file2.c,file3.c
670 while (tmp_str
!= NULL
) {
671 if (strncmp(tmp_str
, string
, len
) == 0 &&
672 (tmp_str
[len
] == ',' || tmp_str
[len
] == '\0'))
674 tmp_str
= strchr(tmp_str
, ',');
676 tmp_str
++; /* Get rid of , */
682 dprintf_setup(int *argc
, char **argv
)
687 * Debugging can be specified two ways: by setting the
688 * environment variable ZFS_DEBUG, or by including a
689 * "debug=..." argument on the command line. The command
690 * line setting overrides the environment variable.
693 for (i
= 1; i
< *argc
; i
++) {
694 int len
= strlen("debug=");
695 /* First look for a command line argument */
696 if (strncmp("debug=", argv
[i
], len
) == 0) {
697 dprintf_string
= argv
[i
] + len
;
698 /* Remove from args */
699 for (j
= i
; j
< *argc
; j
++)
706 if (dprintf_string
== NULL
) {
707 /* Look for ZFS_DEBUG environment variable */
708 dprintf_string
= getenv("ZFS_DEBUG");
712 * Are we just turning on all debugging?
714 if (dprintf_find_string("on"))
715 dprintf_print_all
= 1;
717 if (dprintf_string
!= NULL
)
718 zfs_flags
|= ZFS_DEBUG_DPRINTF
;
722 * =========================================================================
724 * =========================================================================
727 __dprintf(const char *file
, const char *func
, int line
, const char *fmt
, ...)
733 * Get rid of annoying "../common/" prefix to filename.
735 newfile
= strrchr(file
, '/');
736 if (newfile
!= NULL
) {
737 newfile
= newfile
+ 1; /* Get rid of leading / */
742 if (dprintf_print_all
||
743 dprintf_find_string(newfile
) ||
744 dprintf_find_string(func
)) {
745 /* Print out just the function name if requested */
747 if (dprintf_find_string("pid"))
748 (void) printf("%d ", getpid());
749 if (dprintf_find_string("tid"))
750 (void) printf("%u ", (uint_t
)pthread_self());
751 if (dprintf_find_string("cpu"))
752 (void) printf("%u ", getcpuid());
753 if (dprintf_find_string("time"))
754 (void) printf("%llu ", gethrtime());
755 if (dprintf_find_string("long"))
756 (void) printf("%s, line %d: ", newfile
, line
);
757 (void) printf("%s: ", func
);
759 (void) vprintf(fmt
, adx
);
766 * =========================================================================
767 * cmn_err() and panic()
768 * =========================================================================
770 static char ce_prefix
[CE_IGNORE
][10] = { "", "NOTICE: ", "WARNING: ", "" };
771 static char ce_suffix
[CE_IGNORE
][2] = { "", "\n", "\n", "" };
774 vpanic(const char *fmt
, va_list adx
)
776 (void) fprintf(stderr
, "error: ");
777 (void) vfprintf(stderr
, fmt
, adx
);
778 (void) fprintf(stderr
, "\n");
780 abort(); /* think of it as a "user-level crash dump" */
784 panic(const char *fmt
, ...)
794 vcmn_err(int ce
, const char *fmt
, va_list adx
)
798 if (ce
!= CE_NOTE
) { /* suppress noise in userland stress testing */
799 (void) fprintf(stderr
, "%s", ce_prefix
[ce
]);
800 (void) vfprintf(stderr
, fmt
, adx
);
801 (void) fprintf(stderr
, "%s", ce_suffix
[ce
]);
807 cmn_err(int ce
, const char *fmt
, ...)
812 vcmn_err(ce
, fmt
, adx
);
817 * =========================================================================
819 * =========================================================================
822 kobj_open_file(char *name
)
827 /* set vp as the _fd field of the file */
828 if (vn_openat(name
, UIO_SYSSPACE
, FREAD
, 0, &vp
, 0, 0, rootdir
,
830 return ((void *)-1UL);
832 file
= umem_zalloc(sizeof (struct _buf
), UMEM_NOFAIL
);
833 file
->_fd
= (intptr_t)vp
;
838 kobj_read_file(struct _buf
*file
, char *buf
, unsigned size
, unsigned off
)
842 if (vn_rdwr(UIO_READ
, (vnode_t
*)file
->_fd
, buf
, size
, (offset_t
)off
,
843 UIO_SYSSPACE
, 0, 0, 0, &resid
) != 0)
846 return (size
- resid
);
850 kobj_close_file(struct _buf
*file
)
852 vn_close((vnode_t
*)file
->_fd
);
853 umem_free(file
, sizeof (struct _buf
));
857 kobj_get_filesize(struct _buf
*file
, uint64_t *size
)
860 vnode_t
*vp
= (vnode_t
*)file
->_fd
;
862 if (fstat64(vp
->v_fd
, &st
) == -1) {
871 * =========================================================================
873 * =========================================================================
879 (void) poll(0, 0, ticks
* (1000 / hz
));
883 * Find highest one bit set.
884 * Returns bit number + 1 of highest bit that is set, otherwise returns 0.
885 * The __builtin_clzll() function is supported by both GCC and Clang.
888 highbit64(uint64_t i
)
893 return (NBBY
* sizeof (uint64_t) - __builtin_clzll(i
));
897 * Find lowest one bit set.
898 * Returns bit number + 1 of lowest bit that is set, otherwise returns 0.
899 * The __builtin_ffsll() function is supported by both GCC and Clang.
907 return (__builtin_ffsll(i
));
910 static int random_fd
= -1, urandom_fd
= -1;
915 VERIFY((random_fd
= open("/dev/random", O_RDONLY
)) != -1);
916 VERIFY((urandom_fd
= open("/dev/urandom", O_RDONLY
)) != -1);
930 random_get_bytes_common(uint8_t *ptr
, size_t len
, int fd
)
938 bytes
= read(fd
, ptr
, resid
);
939 ASSERT3S(bytes
, >=, 0);
948 random_get_bytes(uint8_t *ptr
, size_t len
)
950 return (random_get_bytes_common(ptr
, len
, random_fd
));
954 random_get_pseudo_bytes(uint8_t *ptr
, size_t len
)
956 return (random_get_bytes_common(ptr
, len
, urandom_fd
));
960 ddi_strtoul(const char *hw_serial
, char **nptr
, int base
, unsigned long *result
)
964 *result
= strtoul(hw_serial
, &end
, base
);
971 ddi_strtoull(const char *str
, char **nptr
, int base
, u_longlong_t
*result
)
975 *result
= strtoull(str
, &end
, base
);
984 return (&hw_utsname
);
988 * =========================================================================
989 * kernel emulation setup & teardown
990 * =========================================================================
993 umem_out_of_memory(void)
995 char errmsg
[] = "out of memory -- generating core dump\n";
997 (void) fprintf(stderr
, "%s", errmsg
);
1003 kernel_init(int mode
)
1005 extern uint_t rrw_tsd_key
;
1007 umem_nofail_callback(umem_out_of_memory
);
1009 physmem
= sysconf(_SC_PHYS_PAGES
);
1011 dprintf("physmem = %llu pages (%.2f GB)\n", physmem
,
1012 (double)physmem
* sysconf(_SC_PAGE_SIZE
) / (1ULL << 30));
1014 (void) snprintf(hw_serial
, sizeof (hw_serial
), "%ld",
1015 (mode
& FWRITE
) ? get_system_hostid() : 0);
1019 VERIFY0(uname(&hw_utsname
));
1021 system_taskq_init();
1028 tsd_create(&rrw_tsd_key
, rrw_tsd_destroy
);
1038 system_taskq_fini();
1044 crgetuid(cred_t
*cr
)
1050 crgetruid(cred_t
*cr
)
1056 crgetgid(cred_t
*cr
)
1062 crgetngroups(cred_t
*cr
)
1068 crgetgroups(cred_t
*cr
)
1074 zfs_secpolicy_snapshot_perms(const char *name
, cred_t
*cr
)
1080 zfs_secpolicy_rename_perms(const char *from
, const char *to
, cred_t
*cr
)
1086 zfs_secpolicy_destroy_perms(const char *name
, cred_t
*cr
)
1092 secpolicy_zfs(const cred_t
*cr
)
1098 ksid_lookupdomain(const char *dom
)
1102 kd
= umem_zalloc(sizeof (ksiddomain_t
), UMEM_NOFAIL
);
1103 kd
->kd_name
= spa_strdup(dom
);
1108 ksiddomain_rele(ksiddomain_t
*ksid
)
1110 spa_strfree(ksid
->kd_name
);
1111 umem_free(ksid
, sizeof (ksiddomain_t
));
1115 kmem_vasprintf(const char *fmt
, va_list adx
)
1120 va_copy(adx_copy
, adx
);
1121 VERIFY(vasprintf(&buf
, fmt
, adx_copy
) != -1);
1128 kmem_asprintf(const char *fmt
, ...)
1134 VERIFY(vasprintf(&buf
, fmt
, adx
) != -1);
1142 zfs_onexit_fd_hold(int fd
, minor_t
*minorp
)
1150 zfs_onexit_fd_rele(int fd
)
1156 zfs_onexit_add_cb(minor_t minor
, void (*func
)(void *), void *data
,
1157 uint64_t *action_handle
)
1164 zfs_onexit_del_cb(minor_t minor
, uint64_t action_handle
, boolean_t fire
)
1171 zfs_onexit_cb_data(minor_t minor
, uint64_t action_handle
, void **data
)
1177 spl_fstrans_mark(void)
1179 return ((fstrans_cookie_t
)0);
1183 spl_fstrans_unmark(fstrans_cookie_t cookie
)
1188 __spl_pf_fstrans_check(void)
1193 void *zvol_tag
= "zvol_tag";
1196 zvol_create_minors(spa_t
*spa
, const char *name
, boolean_t async
)
1201 zvol_remove_minor(spa_t
*spa
, const char *name
, boolean_t async
)
1206 zvol_remove_minors(spa_t
*spa
, const char *name
, boolean_t async
)
1211 zvol_rename_minors(spa_t
*spa
, const char *oldname
, const char *newname
,