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]
23 * Copyright (c) 2005, 2010, Oracle and/or its affiliates. All rights reserved.
24 * Copyright (c) 2013, Joyent, Inc. All rights reserved.
25 * Copyright (c) 2012 by Delphix. All rights reserved.
29 * Internal utility routines for the ZFS library.
43 #include <sys/mnttab.h>
44 #include <sys/mntent.h>
45 #include <sys/types.h>
49 #include <libzfs_core.h>
51 #include "libzfs_impl.h"
53 #include "zfeature_common.h"
56 libzfs_errno(libzfs_handle_t
*hdl
)
58 return (hdl
->libzfs_error
);
62 libzfs_error_action(libzfs_handle_t
*hdl
)
64 return (hdl
->libzfs_action
);
68 libzfs_error_description(libzfs_handle_t
*hdl
)
70 if (hdl
->libzfs_desc
[0] != '\0')
71 return (hdl
->libzfs_desc
);
73 switch (hdl
->libzfs_error
) {
75 return (dgettext(TEXT_DOMAIN
, "out of memory"));
77 return (dgettext(TEXT_DOMAIN
, "invalid property value"));
78 case EZFS_PROPREADONLY
:
79 return (dgettext(TEXT_DOMAIN
, "read-only property"));
81 return (dgettext(TEXT_DOMAIN
, "property doesn't apply to "
82 "datasets of this type"));
83 case EZFS_PROPNONINHERIT
:
84 return (dgettext(TEXT_DOMAIN
, "property cannot be inherited"));
86 return (dgettext(TEXT_DOMAIN
, "invalid quota or reservation"));
88 return (dgettext(TEXT_DOMAIN
, "operation not applicable to "
89 "datasets of this type"));
91 return (dgettext(TEXT_DOMAIN
, "pool or dataset is busy"));
93 return (dgettext(TEXT_DOMAIN
, "pool or dataset exists"));
95 return (dgettext(TEXT_DOMAIN
, "no such pool or dataset"));
97 return (dgettext(TEXT_DOMAIN
, "invalid backup stream"));
99 return (dgettext(TEXT_DOMAIN
, "dataset is read-only"));
101 return (dgettext(TEXT_DOMAIN
, "volume size exceeds limit for "
103 case EZFS_INVALIDNAME
:
104 return (dgettext(TEXT_DOMAIN
, "invalid name"));
105 case EZFS_BADRESTORE
:
106 return (dgettext(TEXT_DOMAIN
, "unable to restore to "
109 return (dgettext(TEXT_DOMAIN
, "backup failed"));
111 return (dgettext(TEXT_DOMAIN
, "invalid target vdev"));
113 return (dgettext(TEXT_DOMAIN
, "no such device in pool"));
115 return (dgettext(TEXT_DOMAIN
, "invalid device"));
116 case EZFS_NOREPLICAS
:
117 return (dgettext(TEXT_DOMAIN
, "no valid replicas"));
118 case EZFS_RESILVERING
:
119 return (dgettext(TEXT_DOMAIN
, "currently resilvering"));
120 case EZFS_BADVERSION
:
121 return (dgettext(TEXT_DOMAIN
, "unsupported version or "
123 case EZFS_POOLUNAVAIL
:
124 return (dgettext(TEXT_DOMAIN
, "pool is unavailable"));
125 case EZFS_DEVOVERFLOW
:
126 return (dgettext(TEXT_DOMAIN
, "too many devices in one vdev"));
128 return (dgettext(TEXT_DOMAIN
, "must be an absolute path"));
129 case EZFS_CROSSTARGET
:
130 return (dgettext(TEXT_DOMAIN
, "operation crosses datasets or "
133 return (dgettext(TEXT_DOMAIN
, "dataset in use by local zone"));
134 case EZFS_MOUNTFAILED
:
135 return (dgettext(TEXT_DOMAIN
, "mount failed"));
136 case EZFS_UMOUNTFAILED
:
137 return (dgettext(TEXT_DOMAIN
, "umount failed"));
138 case EZFS_UNSHARENFSFAILED
:
139 return (dgettext(TEXT_DOMAIN
, "unshare(1M) failed"));
140 case EZFS_SHARENFSFAILED
:
141 return (dgettext(TEXT_DOMAIN
, "share(1M) failed"));
142 case EZFS_UNSHARESMBFAILED
:
143 return (dgettext(TEXT_DOMAIN
, "smb remove share failed"));
144 case EZFS_SHARESMBFAILED
:
145 return (dgettext(TEXT_DOMAIN
, "smb add share failed"));
147 return (dgettext(TEXT_DOMAIN
, "permission denied"));
149 return (dgettext(TEXT_DOMAIN
, "out of space"));
151 return (dgettext(TEXT_DOMAIN
, "bad address"));
153 return (dgettext(TEXT_DOMAIN
, "I/O error"));
155 return (dgettext(TEXT_DOMAIN
, "signal received"));
157 return (dgettext(TEXT_DOMAIN
, "device is reserved as a hot "
159 case EZFS_INVALCONFIG
:
160 return (dgettext(TEXT_DOMAIN
, "invalid vdev configuration"));
162 return (dgettext(TEXT_DOMAIN
, "recursive dataset dependency"));
164 return (dgettext(TEXT_DOMAIN
, "no history available"));
166 return (dgettext(TEXT_DOMAIN
, "failed to retrieve "
168 case EZFS_POOL_NOTSUP
:
169 return (dgettext(TEXT_DOMAIN
, "operation not supported "
170 "on this type of pool"));
171 case EZFS_POOL_INVALARG
:
172 return (dgettext(TEXT_DOMAIN
, "invalid argument for "
173 "this pool operation"));
174 case EZFS_NAMETOOLONG
:
175 return (dgettext(TEXT_DOMAIN
, "dataset name is too long"));
176 case EZFS_OPENFAILED
:
177 return (dgettext(TEXT_DOMAIN
, "open failed"));
179 return (dgettext(TEXT_DOMAIN
,
180 "disk capacity information could not be retrieved"));
181 case EZFS_LABELFAILED
:
182 return (dgettext(TEXT_DOMAIN
, "write of label failed"));
184 return (dgettext(TEXT_DOMAIN
, "invalid user/group"));
186 return (dgettext(TEXT_DOMAIN
, "invalid permission"));
187 case EZFS_BADPERMSET
:
188 return (dgettext(TEXT_DOMAIN
, "invalid permission set name"));
189 case EZFS_NODELEGATION
:
190 return (dgettext(TEXT_DOMAIN
, "delegated administration is "
191 "disabled on pool"));
193 return (dgettext(TEXT_DOMAIN
, "invalid or missing cache file"));
195 return (dgettext(TEXT_DOMAIN
, "device is in use as a cache"));
196 case EZFS_VDEVNOTSUP
:
197 return (dgettext(TEXT_DOMAIN
, "vdev specification is not "
200 return (dgettext(TEXT_DOMAIN
, "operation not supported "
202 case EZFS_ACTIVE_SPARE
:
203 return (dgettext(TEXT_DOMAIN
, "pool has active shared spare "
205 case EZFS_UNPLAYED_LOGS
:
206 return (dgettext(TEXT_DOMAIN
, "log device has unplayed intent "
208 case EZFS_REFTAG_RELE
:
209 return (dgettext(TEXT_DOMAIN
, "no such tag on this dataset"));
210 case EZFS_REFTAG_HOLD
:
211 return (dgettext(TEXT_DOMAIN
, "tag already exists on this "
213 case EZFS_TAGTOOLONG
:
214 return (dgettext(TEXT_DOMAIN
, "tag too long"));
215 case EZFS_PIPEFAILED
:
216 return (dgettext(TEXT_DOMAIN
, "pipe create failed"));
217 case EZFS_THREADCREATEFAILED
:
218 return (dgettext(TEXT_DOMAIN
, "thread create failed"));
219 case EZFS_POSTSPLIT_ONLINE
:
220 return (dgettext(TEXT_DOMAIN
, "disk was split from this pool "
223 return (dgettext(TEXT_DOMAIN
, "currently scrubbing; "
224 "use 'zpool scrub -s' to cancel current scrub"));
226 return (dgettext(TEXT_DOMAIN
, "there is no active scrub"));
228 return (dgettext(TEXT_DOMAIN
, "unable to generate diffs"));
230 return (dgettext(TEXT_DOMAIN
, "invalid diff data"));
231 case EZFS_POOLREADONLY
:
232 return (dgettext(TEXT_DOMAIN
, "pool is read-only"));
234 return (dgettext(TEXT_DOMAIN
, "unknown error"));
236 assert(hdl
->libzfs_error
== 0);
237 return (dgettext(TEXT_DOMAIN
, "no error"));
243 zfs_error_aux(libzfs_handle_t
*hdl
, const char *fmt
, ...)
249 (void) vsnprintf(hdl
->libzfs_desc
, sizeof (hdl
->libzfs_desc
),
251 hdl
->libzfs_desc_active
= 1;
257 zfs_verror(libzfs_handle_t
*hdl
, int error
, const char *fmt
, va_list ap
)
259 (void) vsnprintf(hdl
->libzfs_action
, sizeof (hdl
->libzfs_action
),
261 hdl
->libzfs_error
= error
;
263 if (hdl
->libzfs_desc_active
)
264 hdl
->libzfs_desc_active
= 0;
266 hdl
->libzfs_desc
[0] = '\0';
268 if (hdl
->libzfs_printerr
) {
269 if (error
== EZFS_UNKNOWN
) {
270 (void) fprintf(stderr
, dgettext(TEXT_DOMAIN
, "internal "
271 "error: %s\n"), libzfs_error_description(hdl
));
275 (void) fprintf(stderr
, "%s: %s\n", hdl
->libzfs_action
,
276 libzfs_error_description(hdl
));
277 if (error
== EZFS_NOMEM
)
283 zfs_error(libzfs_handle_t
*hdl
, int error
, const char *msg
)
285 return (zfs_error_fmt(hdl
, error
, "%s", msg
));
290 zfs_error_fmt(libzfs_handle_t
*hdl
, int error
, const char *fmt
, ...)
296 zfs_verror(hdl
, error
, fmt
, ap
);
304 zfs_common_error(libzfs_handle_t
*hdl
, int error
, const char *fmt
,
310 zfs_verror(hdl
, EZFS_PERM
, fmt
, ap
);
314 zfs_verror(hdl
, EZFS_NODELEGATION
, fmt
, ap
);
318 zfs_verror(hdl
, EZFS_IO
, fmt
, ap
);
322 zfs_verror(hdl
, EZFS_FAULT
, fmt
, ap
);
326 zfs_verror(hdl
, EZFS_INTR
, fmt
, ap
);
334 zfs_standard_error(libzfs_handle_t
*hdl
, int error
, const char *msg
)
336 return (zfs_standard_error_fmt(hdl
, error
, "%s", msg
));
341 zfs_standard_error_fmt(libzfs_handle_t
*hdl
, int error
, const char *fmt
, ...)
347 if (zfs_common_error(hdl
, error
, fmt
, ap
) != 0) {
356 zfs_verror(hdl
, EZFS_IO
, fmt
, ap
);
360 zfs_error_aux(hdl
, dgettext(TEXT_DOMAIN
,
361 "dataset does not exist"));
362 zfs_verror(hdl
, EZFS_NOENT
, fmt
, ap
);
367 zfs_verror(hdl
, EZFS_NOSPC
, fmt
, ap
);
371 zfs_error_aux(hdl
, dgettext(TEXT_DOMAIN
,
372 "dataset already exists"));
373 zfs_verror(hdl
, EZFS_EXISTS
, fmt
, ap
);
377 zfs_error_aux(hdl
, dgettext(TEXT_DOMAIN
,
379 zfs_verror(hdl
, EZFS_BUSY
, fmt
, ap
);
382 zfs_verror(hdl
, EZFS_POOLREADONLY
, fmt
, ap
);
385 zfs_verror(hdl
, EZFS_NAMETOOLONG
, fmt
, ap
);
388 zfs_verror(hdl
, EZFS_BADVERSION
, fmt
, ap
);
391 zfs_error_aux(hdl
, dgettext(TEXT_DOMAIN
,
392 "pool I/O is currently suspended"));
393 zfs_verror(hdl
, EZFS_POOLUNAVAIL
, fmt
, ap
);
396 zfs_error_aux(hdl
, strerror(error
));
397 zfs_verror(hdl
, EZFS_UNKNOWN
, fmt
, ap
);
406 zpool_standard_error(libzfs_handle_t
*hdl
, int error
, const char *msg
)
408 return (zpool_standard_error_fmt(hdl
, error
, "%s", msg
));
413 zpool_standard_error_fmt(libzfs_handle_t
*hdl
, int error
, const char *fmt
, ...)
419 if (zfs_common_error(hdl
, error
, fmt
, ap
) != 0) {
426 zfs_verror(hdl
, EZFS_NODEVICE
, fmt
, ap
);
431 dgettext(TEXT_DOMAIN
, "no such pool or dataset"));
432 zfs_verror(hdl
, EZFS_NOENT
, fmt
, ap
);
436 zfs_error_aux(hdl
, dgettext(TEXT_DOMAIN
,
437 "pool already exists"));
438 zfs_verror(hdl
, EZFS_EXISTS
, fmt
, ap
);
442 zfs_error_aux(hdl
, dgettext(TEXT_DOMAIN
, "pool is busy"));
443 zfs_verror(hdl
, EZFS_BUSY
, fmt
, ap
);
447 zfs_error_aux(hdl
, dgettext(TEXT_DOMAIN
,
448 "one or more devices is currently unavailable"));
449 zfs_verror(hdl
, EZFS_BADDEV
, fmt
, ap
);
453 zfs_verror(hdl
, EZFS_DEVOVERFLOW
, fmt
, ap
);
457 zfs_verror(hdl
, EZFS_POOL_NOTSUP
, fmt
, ap
);
461 zfs_verror(hdl
, EZFS_POOL_INVALARG
, fmt
, ap
);
466 zfs_verror(hdl
, EZFS_NOSPC
, fmt
, ap
);
470 zfs_error_aux(hdl
, dgettext(TEXT_DOMAIN
,
471 "pool I/O is currently suspended"));
472 zfs_verror(hdl
, EZFS_POOLUNAVAIL
, fmt
, ap
);
476 zfs_verror(hdl
, EZFS_POOLREADONLY
, fmt
, ap
);
480 zfs_error_aux(hdl
, strerror(error
));
481 zfs_verror(hdl
, EZFS_UNKNOWN
, fmt
, ap
);
489 * Display an out of memory error message and abort the current program.
492 no_memory(libzfs_handle_t
*hdl
)
494 return (zfs_error(hdl
, EZFS_NOMEM
, "internal error"));
498 * A safe form of malloc() which will die if the allocation fails.
501 zfs_alloc(libzfs_handle_t
*hdl
, size_t size
)
505 if ((data
= calloc(1, size
)) == NULL
)
506 (void) no_memory(hdl
);
512 * A safe form of asprintf() which will die if the allocation fails.
516 zfs_asprintf(libzfs_handle_t
*hdl
, const char *fmt
, ...)
524 err
= vasprintf(&ret
, fmt
, ap
);
529 (void) no_memory(hdl
);
535 * A safe form of realloc(), which also zeroes newly allocated space.
538 zfs_realloc(libzfs_handle_t
*hdl
, void *ptr
, size_t oldsize
, size_t newsize
)
542 if ((ret
= realloc(ptr
, newsize
)) == NULL
) {
543 (void) no_memory(hdl
);
547 bzero((char *)ret
+ oldsize
, (newsize
- oldsize
));
552 * A safe form of strdup() which will die if the allocation fails.
555 zfs_strdup(libzfs_handle_t
*hdl
, const char *str
)
559 if ((ret
= strdup(str
)) == NULL
)
560 (void) no_memory(hdl
);
566 * Convert a number to an appropriately human-readable output.
569 zfs_nicenum(uint64_t num
, char *buf
, size_t buflen
)
575 while (n
>= 1024 && index
< 6) {
580 u
= " KMGTPE"[index
];
583 (void) snprintf(buf
, buflen
, "%llu", (u_longlong_t
) n
);
584 } else if ((num
& ((1ULL << 10 * index
) - 1)) == 0) {
586 * If this is an even multiple of the base, always display
587 * without any decimal precision.
589 (void) snprintf(buf
, buflen
, "%llu%c", (u_longlong_t
) n
, u
);
592 * We want to choose a precision that reflects the best choice
593 * for fitting in 5 characters. This can get rather tricky when
594 * we have numbers that are very close to an order of magnitude.
595 * For example, when displaying 10239 (which is really 9.999K),
596 * we want only a single place of precision for 10.0K. We could
597 * develop some complex heuristics for this, but it's much
598 * easier just to try each combination in turn.
601 for (i
= 2; i
>= 0; i
--) {
602 if (snprintf(buf
, buflen
, "%.*f%c", i
,
603 (double)num
/ (1ULL << 10 * index
), u
) <= 5)
610 libzfs_print_on_error(libzfs_handle_t
*hdl
, boolean_t printerr
)
612 hdl
->libzfs_printerr
= printerr
;
616 libzfs_module_loaded(const char *module
)
618 const char path_prefix
[] = "/sys/module/";
621 memcpy(path
, path_prefix
, sizeof (path_prefix
) - 1);
622 strcpy(path
+ sizeof (path_prefix
) - 1, module
);
624 return (access(path
, F_OK
) == 0);
628 libzfs_run_process(const char *path
, char *argv
[], int flags
)
635 devnull_fd
= open("/dev/null", O_WRONLY
);
640 if (!(flags
& STDOUT_VERBOSE
))
641 (void) dup2(devnull_fd
, STDOUT_FILENO
);
643 if (!(flags
& STDERR_VERBOSE
))
644 (void) dup2(devnull_fd
, STDERR_FILENO
);
648 (void) execvp(path
, argv
);
650 } else if (pid
> 0) {
653 while ((rc
= waitpid(pid
, &status
, 0)) == -1 &&
655 if (rc
< 0 || !WIFEXITED(status
))
658 return (WEXITSTATUS(status
));
665 libzfs_load_module(const char *module
)
667 char *argv
[4] = {"/sbin/modprobe", "-q", (char *)module
, (char *)0};
669 if (libzfs_module_loaded(module
))
672 return (libzfs_run_process("/sbin/modprobe", argv
, 0));
678 libzfs_handle_t
*hdl
;
680 if (libzfs_load_module("zfs") != 0) {
681 (void) fprintf(stderr
, gettext("Failed to load ZFS module "
682 "stack.\nLoad the module manually by running "
683 "'insmod <location>/zfs.ko' as root.\n"));
687 if ((hdl
= calloc(1, sizeof (libzfs_handle_t
))) == NULL
) {
691 if ((hdl
->libzfs_fd
= open(ZFS_DEV
, O_RDWR
)) < 0) {
692 (void) fprintf(stderr
, gettext("Unable to open %s: %s.\n"),
693 ZFS_DEV
, strerror(errno
));
695 (void) fprintf(stderr
,
696 gettext("Verify the ZFS module stack is "
697 "loaded by running '/sbin/modprobe zfs'.\n"));
703 #ifdef HAVE_SETMNTENT
704 if ((hdl
->libzfs_mnttab
= setmntent(MNTTAB
, "r")) == NULL
) {
706 if ((hdl
->libzfs_mnttab
= fopen(MNTTAB
, "r")) == NULL
) {
708 (void) close(hdl
->libzfs_fd
);
709 (void) fprintf(stderr
,
710 gettext("mtab is not present at %s.\n"), MNTTAB
);
715 hdl
->libzfs_sharetab
= fopen("/etc/dfs/sharetab", "r");
717 if (libzfs_core_init() != 0) {
718 (void) close(hdl
->libzfs_fd
);
719 (void) fclose(hdl
->libzfs_mnttab
);
720 (void) fclose(hdl
->libzfs_sharetab
);
727 zpool_feature_init();
728 libzfs_mnttab_init(hdl
);
734 libzfs_fini(libzfs_handle_t
*hdl
)
736 (void) close(hdl
->libzfs_fd
);
737 if (hdl
->libzfs_mnttab
)
738 #ifdef HAVE_SETMNTENT
739 (void) endmntent(hdl
->libzfs_mnttab
);
741 (void) fclose(hdl
->libzfs_mnttab
);
743 if (hdl
->libzfs_sharetab
)
744 (void) fclose(hdl
->libzfs_sharetab
);
745 zfs_uninit_libshare(hdl
);
746 zpool_free_handles(hdl
);
747 libzfs_fru_clear(hdl
, B_TRUE
);
748 namespace_clear(hdl
);
749 libzfs_mnttab_fini(hdl
);
755 zpool_get_handle(zpool_handle_t
*zhp
)
757 return (zhp
->zpool_hdl
);
761 zfs_get_handle(zfs_handle_t
*zhp
)
763 return (zhp
->zfs_hdl
);
767 zfs_get_pool_handle(const zfs_handle_t
*zhp
)
769 return (zhp
->zpool_hdl
);
773 * Given a name, determine whether or not it's a valid path
774 * (starts with '/' or "./"). If so, walk the mnttab trying
775 * to match the device number. If not, treat the path as an
779 zfs_path_to_zhandle(libzfs_handle_t
*hdl
, char *path
, zfs_type_t argtype
)
781 struct stat64 statbuf
;
782 struct extmnttab entry
;
785 if (path
[0] != '/' && strncmp(path
, "./", strlen("./")) != 0) {
787 * It's not a valid path, assume it's a name of type 'argtype'.
789 return (zfs_open(hdl
, path
, argtype
));
792 if (stat64(path
, &statbuf
) != 0) {
793 (void) fprintf(stderr
, "%s: %s\n", path
, strerror(errno
));
797 /* Reopen MNTTAB to prevent reading stale data from open file */
798 if (freopen(MNTTAB
, "r", hdl
->libzfs_mnttab
) == NULL
)
801 while ((ret
= getextmntent(hdl
->libzfs_mnttab
, &entry
, 0)) == 0) {
802 if (makedevice(entry
.mnt_major
, entry
.mnt_minor
) ==
811 if (strcmp(entry
.mnt_fstype
, MNTTYPE_ZFS
) != 0) {
812 (void) fprintf(stderr
, gettext("'%s': not a ZFS filesystem\n"),
817 return (zfs_open(hdl
, entry
.mnt_special
, ZFS_TYPE_FILESYSTEM
));
821 * Append partition suffix to an otherwise fully qualified device path.
822 * This is used to generate the name the full path as its stored in
823 * ZPOOL_CONFIG_PATH for whole disk devices. On success the new length
824 * of 'path' will be returned on error a negative value is returned.
827 zfs_append_partition(char *path
, size_t max_len
)
829 int len
= strlen(path
);
831 if (strncmp(path
, UDISK_ROOT
, strlen(UDISK_ROOT
)) == 0) {
832 if (len
+ 6 >= max_len
)
835 (void) strcat(path
, "-part1");
838 if (len
+ 2 >= max_len
)
841 if (isdigit(path
[len
-1])) {
842 (void) strcat(path
, "p1");
845 (void) strcat(path
, "1");
854 * Given a shorthand device name check if a file by that name exists in any
855 * of the 'zpool_default_import_path' or ZPOOL_IMPORT_PATH directories. If
856 * one is found, store its fully qualified path in the 'path' buffer passed
857 * by the caller and return 0, otherwise return an error.
860 zfs_resolve_shortname(const char *name
, char *path
, size_t len
)
863 char *dir
, *env
, *envdup
;
865 env
= getenv("ZPOOL_IMPORT_PATH");
869 envdup
= strdup(env
);
870 dir
= strtok(envdup
, ":");
871 while (dir
&& error
) {
872 (void) snprintf(path
, len
, "%s/%s", dir
, name
);
873 error
= access(path
, F_OK
);
874 dir
= strtok(NULL
, ":");
878 for (i
= 0; i
< DEFAULT_IMPORT_PATH_SIZE
&& error
< 0; i
++) {
879 (void) snprintf(path
, len
, "%s/%s",
880 zpool_default_import_path
[i
], name
);
881 error
= access(path
, F_OK
);
885 return (error
? ENOENT
: 0);
889 * Given a shorthand device name look for a match against 'cmp_name'. This
890 * is done by checking all prefix expansions using either the default
891 * 'zpool_default_import_paths' or the ZPOOL_IMPORT_PATH environment
892 * variable. Proper partition suffixes will be appended if this is a
893 * whole disk. When a match is found 0 is returned otherwise ENOENT.
896 zfs_strcmp_shortname(char *name
, char *cmp_name
, int wholedisk
)
898 int path_len
, cmp_len
, i
= 0, error
= ENOENT
;
899 char *dir
, *env
, *envdup
= NULL
;
900 char path_name
[MAXPATHLEN
];
902 cmp_len
= strlen(cmp_name
);
903 env
= getenv("ZPOOL_IMPORT_PATH");
906 envdup
= strdup(env
);
907 dir
= strtok(envdup
, ":");
909 dir
= zpool_default_import_path
[i
];
913 /* Trim trailing directory slashes from ZPOOL_IMPORT_PATH */
914 while (dir
[strlen(dir
)-1] == '/')
915 dir
[strlen(dir
)-1] = '\0';
917 path_len
= snprintf(path_name
, MAXPATHLEN
, "%s/%s", dir
, name
);
919 path_len
= zfs_append_partition(path_name
, MAXPATHLEN
);
921 if ((path_len
== cmp_len
) && strcmp(path_name
, cmp_name
) == 0) {
927 dir
= strtok(NULL
, ":");
928 } else if (++i
< DEFAULT_IMPORT_PATH_SIZE
) {
929 dir
= zpool_default_import_path
[i
];
942 * Given either a shorthand or fully qualified path name look for a match
943 * against 'cmp'. The passed name will be expanded as needed for comparison
944 * purposes and redundant slashes stripped to ensure an accurate match.
947 zfs_strcmp_pathname(char *name
, char *cmp
, int wholedisk
)
949 int path_len
, cmp_len
;
950 char path_name
[MAXPATHLEN
];
951 char cmp_name
[MAXPATHLEN
];
954 /* Strip redundant slashes if one exists due to ZPOOL_IMPORT_PATH */
955 memset(cmp_name
, 0, MAXPATHLEN
);
956 dir
= strtok(cmp
, "/");
958 strcat(cmp_name
, "/");
959 strcat(cmp_name
, dir
);
960 dir
= strtok(NULL
, "/");
964 return (zfs_strcmp_shortname(name
, cmp_name
, wholedisk
));
966 (void) strlcpy(path_name
, name
, MAXPATHLEN
);
967 path_len
= strlen(path_name
);
968 cmp_len
= strlen(cmp_name
);
971 path_len
= zfs_append_partition(path_name
, MAXPATHLEN
);
976 if ((path_len
!= cmp_len
) || strcmp(path_name
, cmp_name
))
983 * Initialize the zc_nvlist_dst member to prepare for receiving an nvlist from
987 zcmd_alloc_dst_nvlist(libzfs_handle_t
*hdl
, zfs_cmd_t
*zc
, size_t len
)
991 zc
->zc_nvlist_dst_size
= len
;
992 if ((zc
->zc_nvlist_dst
= (uint64_t)(uintptr_t)
993 zfs_alloc(hdl
, zc
->zc_nvlist_dst_size
)) == 0)
1000 * Called when an ioctl() which returns an nvlist fails with ENOMEM. This will
1001 * expand the nvlist to the size specified in 'zc_nvlist_dst_size', which was
1002 * filled in by the kernel to indicate the actual required size.
1005 zcmd_expand_dst_nvlist(libzfs_handle_t
*hdl
, zfs_cmd_t
*zc
)
1007 free((void *)(uintptr_t)zc
->zc_nvlist_dst
);
1008 if ((zc
->zc_nvlist_dst
= (uint64_t)(uintptr_t)
1009 zfs_alloc(hdl
, zc
->zc_nvlist_dst_size
)) == 0)
1016 * Called to free the src and dst nvlists stored in the command structure.
1019 zcmd_free_nvlists(zfs_cmd_t
*zc
)
1021 free((void *)(uintptr_t)zc
->zc_nvlist_conf
);
1022 free((void *)(uintptr_t)zc
->zc_nvlist_src
);
1023 free((void *)(uintptr_t)zc
->zc_nvlist_dst
);
1027 zcmd_write_nvlist_com(libzfs_handle_t
*hdl
, uint64_t *outnv
, uint64_t *outlen
,
1033 verify(nvlist_size(nvl
, &len
, NV_ENCODE_NATIVE
) == 0);
1035 if ((packed
= zfs_alloc(hdl
, len
)) == NULL
)
1038 verify(nvlist_pack(nvl
, &packed
, &len
, NV_ENCODE_NATIVE
, 0) == 0);
1040 *outnv
= (uint64_t)(uintptr_t)packed
;
1047 zcmd_write_conf_nvlist(libzfs_handle_t
*hdl
, zfs_cmd_t
*zc
, nvlist_t
*nvl
)
1049 return (zcmd_write_nvlist_com(hdl
, &zc
->zc_nvlist_conf
,
1050 &zc
->zc_nvlist_conf_size
, nvl
));
1054 zcmd_write_src_nvlist(libzfs_handle_t
*hdl
, zfs_cmd_t
*zc
, nvlist_t
*nvl
)
1056 return (zcmd_write_nvlist_com(hdl
, &zc
->zc_nvlist_src
,
1057 &zc
->zc_nvlist_src_size
, nvl
));
1061 * Unpacks an nvlist from the ZFS ioctl command structure.
1064 zcmd_read_dst_nvlist(libzfs_handle_t
*hdl
, zfs_cmd_t
*zc
, nvlist_t
**nvlp
)
1066 if (nvlist_unpack((void *)(uintptr_t)zc
->zc_nvlist_dst
,
1067 zc
->zc_nvlist_dst_size
, nvlp
, 0) != 0)
1068 return (no_memory(hdl
));
1074 zfs_ioctl(libzfs_handle_t
*hdl
, int request
, zfs_cmd_t
*zc
)
1076 return (ioctl(hdl
->libzfs_fd
, request
, zc
));
1080 * ================================================================
1081 * API shared by zfs and zpool property management
1082 * ================================================================
1086 zprop_print_headers(zprop_get_cbdata_t
*cbp
, zfs_type_t type
)
1088 zprop_list_t
*pl
= cbp
->cb_proplist
;
1093 cbp
->cb_first
= B_FALSE
;
1094 if (cbp
->cb_scripted
)
1098 * Start with the length of the column headers.
1100 cbp
->cb_colwidths
[GET_COL_NAME
] = strlen(dgettext(TEXT_DOMAIN
, "NAME"));
1101 cbp
->cb_colwidths
[GET_COL_PROPERTY
] = strlen(dgettext(TEXT_DOMAIN
,
1103 cbp
->cb_colwidths
[GET_COL_VALUE
] = strlen(dgettext(TEXT_DOMAIN
,
1105 cbp
->cb_colwidths
[GET_COL_RECVD
] = strlen(dgettext(TEXT_DOMAIN
,
1107 cbp
->cb_colwidths
[GET_COL_SOURCE
] = strlen(dgettext(TEXT_DOMAIN
,
1110 /* first property is always NAME */
1111 assert(cbp
->cb_proplist
->pl_prop
==
1112 ((type
== ZFS_TYPE_POOL
) ? ZPOOL_PROP_NAME
: ZFS_PROP_NAME
));
1115 * Go through and calculate the widths for each column. For the
1116 * 'source' column, we kludge it up by taking the worst-case scenario of
1117 * inheriting from the longest name. This is acceptable because in the
1118 * majority of cases 'SOURCE' is the last column displayed, and we don't
1119 * use the width anyway. Note that the 'VALUE' column can be oversized,
1120 * if the name of the property is much longer than any values we find.
1122 for (pl
= cbp
->cb_proplist
; pl
!= NULL
; pl
= pl
->pl_next
) {
1126 if (pl
->pl_prop
!= ZPROP_INVAL
) {
1127 const char *propname
= (type
== ZFS_TYPE_POOL
) ?
1128 zpool_prop_to_name(pl
->pl_prop
) :
1129 zfs_prop_to_name(pl
->pl_prop
);
1131 len
= strlen(propname
);
1132 if (len
> cbp
->cb_colwidths
[GET_COL_PROPERTY
])
1133 cbp
->cb_colwidths
[GET_COL_PROPERTY
] = len
;
1135 len
= strlen(pl
->pl_user_prop
);
1136 if (len
> cbp
->cb_colwidths
[GET_COL_PROPERTY
])
1137 cbp
->cb_colwidths
[GET_COL_PROPERTY
] = len
;
1141 * 'VALUE' column. The first property is always the 'name'
1142 * property that was tacked on either by /sbin/zfs's
1143 * zfs_do_get() or when calling zprop_expand_list(), so we
1144 * ignore its width. If the user specified the name property
1145 * to display, then it will be later in the list in any case.
1147 if (pl
!= cbp
->cb_proplist
&&
1148 pl
->pl_width
> cbp
->cb_colwidths
[GET_COL_VALUE
])
1149 cbp
->cb_colwidths
[GET_COL_VALUE
] = pl
->pl_width
;
1151 /* 'RECEIVED' column. */
1152 if (pl
!= cbp
->cb_proplist
&&
1153 pl
->pl_recvd_width
> cbp
->cb_colwidths
[GET_COL_RECVD
])
1154 cbp
->cb_colwidths
[GET_COL_RECVD
] = pl
->pl_recvd_width
;
1157 * 'NAME' and 'SOURCE' columns
1159 if (pl
->pl_prop
== (type
== ZFS_TYPE_POOL
? ZPOOL_PROP_NAME
:
1161 pl
->pl_width
> cbp
->cb_colwidths
[GET_COL_NAME
]) {
1162 cbp
->cb_colwidths
[GET_COL_NAME
] = pl
->pl_width
;
1163 cbp
->cb_colwidths
[GET_COL_SOURCE
] = pl
->pl_width
+
1164 strlen(dgettext(TEXT_DOMAIN
, "inherited from"));
1169 * Now go through and print the headers.
1171 for (i
= 0; i
< ZFS_GET_NCOLS
; i
++) {
1172 switch (cbp
->cb_columns
[i
]) {
1174 title
= dgettext(TEXT_DOMAIN
, "NAME");
1176 case GET_COL_PROPERTY
:
1177 title
= dgettext(TEXT_DOMAIN
, "PROPERTY");
1180 title
= dgettext(TEXT_DOMAIN
, "VALUE");
1183 title
= dgettext(TEXT_DOMAIN
, "RECEIVED");
1185 case GET_COL_SOURCE
:
1186 title
= dgettext(TEXT_DOMAIN
, "SOURCE");
1192 if (title
!= NULL
) {
1193 if (i
== (ZFS_GET_NCOLS
- 1) ||
1194 cbp
->cb_columns
[i
+ 1] == GET_COL_NONE
)
1195 (void) printf("%s", title
);
1197 (void) printf("%-*s ",
1198 cbp
->cb_colwidths
[cbp
->cb_columns
[i
]],
1202 (void) printf("\n");
1206 * Display a single line of output, according to the settings in the callback
1210 zprop_print_one_property(const char *name
, zprop_get_cbdata_t
*cbp
,
1211 const char *propname
, const char *value
, zprop_source_t sourcetype
,
1212 const char *source
, const char *recvd_value
)
1215 const char *str
= NULL
;
1219 * Ignore those source types that the user has chosen to ignore.
1221 if ((sourcetype
& cbp
->cb_sources
) == 0)
1225 zprop_print_headers(cbp
, cbp
->cb_type
);
1227 for (i
= 0; i
< ZFS_GET_NCOLS
; i
++) {
1228 switch (cbp
->cb_columns
[i
]) {
1233 case GET_COL_PROPERTY
:
1241 case GET_COL_SOURCE
:
1242 switch (sourcetype
) {
1243 case ZPROP_SRC_NONE
:
1247 case ZPROP_SRC_DEFAULT
:
1251 case ZPROP_SRC_LOCAL
:
1255 case ZPROP_SRC_TEMPORARY
:
1259 case ZPROP_SRC_INHERITED
:
1260 (void) snprintf(buf
, sizeof (buf
),
1261 "inherited from %s", source
);
1264 case ZPROP_SRC_RECEIVED
:
1271 str
= (recvd_value
== NULL
? "-" : recvd_value
);
1278 if (cbp
->cb_columns
[i
+ 1] == GET_COL_NONE
)
1279 (void) printf("%s", str
);
1280 else if (cbp
->cb_scripted
)
1281 (void) printf("%s\t", str
);
1283 (void) printf("%-*s ",
1284 cbp
->cb_colwidths
[cbp
->cb_columns
[i
]],
1288 (void) printf("\n");
1292 * Given a numeric suffix, convert the value into a number of bits that the
1293 * resulting value must be shifted.
1296 str2shift(libzfs_handle_t
*hdl
, const char *buf
)
1298 const char *ends
= "BKMGTPEZ";
1303 for (i
= 0; i
< strlen(ends
); i
++) {
1304 if (toupper(buf
[0]) == ends
[i
])
1307 if (i
== strlen(ends
)) {
1309 zfs_error_aux(hdl
, dgettext(TEXT_DOMAIN
,
1310 "invalid numeric suffix '%s'"), buf
);
1315 * Allow 'G' = 'GB' = 'GiB', case-insensitively.
1316 * However, 'BB' and 'BiB' are disallowed.
1318 if (buf
[1] == '\0' ||
1319 (toupper(buf
[0]) != 'B' &&
1320 ((toupper(buf
[1]) == 'B' && buf
[2] == '\0') ||
1321 (toupper(buf
[1]) == 'I' && toupper(buf
[2]) == 'B' &&
1326 zfs_error_aux(hdl
, dgettext(TEXT_DOMAIN
,
1327 "invalid numeric suffix '%s'"), buf
);
1332 * Convert a string of the form '100G' into a real number. Used when setting
1333 * properties or creating a volume. 'buf' is used to place an extended error
1334 * message for the caller to use.
1337 zfs_nicestrtonum(libzfs_handle_t
*hdl
, const char *value
, uint64_t *num
)
1344 /* Check to see if this looks like a number. */
1345 if ((value
[0] < '0' || value
[0] > '9') && value
[0] != '.') {
1347 zfs_error_aux(hdl
, dgettext(TEXT_DOMAIN
,
1348 "bad numeric value '%s'"), value
);
1352 /* Rely on strtoull() to process the numeric portion. */
1354 *num
= strtoull(value
, &end
, 10);
1357 * Check for ERANGE, which indicates that the value is too large to fit
1358 * in a 64-bit value.
1360 if (errno
== ERANGE
) {
1362 zfs_error_aux(hdl
, dgettext(TEXT_DOMAIN
,
1363 "numeric value is too large"));
1368 * If we have a decimal value, then do the computation with floating
1369 * point arithmetic. Otherwise, use standard arithmetic.
1372 double fval
= strtod(value
, &end
);
1374 if ((shift
= str2shift(hdl
, end
)) == -1)
1377 fval
*= pow(2, shift
);
1379 if (fval
> UINT64_MAX
) {
1381 zfs_error_aux(hdl
, dgettext(TEXT_DOMAIN
,
1382 "numeric value is too large"));
1386 *num
= (uint64_t)fval
;
1388 if ((shift
= str2shift(hdl
, end
)) == -1)
1391 /* Check for overflow */
1392 if (shift
>= 64 || (*num
<< shift
) >> shift
!= *num
) {
1394 zfs_error_aux(hdl
, dgettext(TEXT_DOMAIN
,
1395 "numeric value is too large"));
1406 * Given a propname=value nvpair to set, parse any numeric properties
1407 * (index, boolean, etc) if they are specified as strings and add the
1408 * resulting nvpair to the returned nvlist.
1410 * At the DSL layer, all properties are either 64-bit numbers or strings.
1411 * We want the user to be able to ignore this fact and specify properties
1412 * as native values (numbers, for example) or as strings (to simplify
1413 * command line utilities). This also handles converting index types
1414 * (compression, checksum, etc) from strings to their on-disk index.
1417 zprop_parse_value(libzfs_handle_t
*hdl
, nvpair_t
*elem
, int prop
,
1418 zfs_type_t type
, nvlist_t
*ret
, char **svalp
, uint64_t *ivalp
,
1421 data_type_t datatype
= nvpair_type(elem
);
1422 zprop_type_t proptype
;
1423 const char *propname
;
1425 boolean_t isnone
= B_FALSE
;
1427 if (type
== ZFS_TYPE_POOL
) {
1428 proptype
= zpool_prop_get_type(prop
);
1429 propname
= zpool_prop_to_name(prop
);
1431 proptype
= zfs_prop_get_type(prop
);
1432 propname
= zfs_prop_to_name(prop
);
1436 * Convert any properties to the internal DSL value types.
1442 case PROP_TYPE_STRING
:
1443 if (datatype
!= DATA_TYPE_STRING
) {
1444 zfs_error_aux(hdl
, dgettext(TEXT_DOMAIN
,
1445 "'%s' must be a string"), nvpair_name(elem
));
1448 (void) nvpair_value_string(elem
, svalp
);
1449 if (strlen(*svalp
) >= ZFS_MAXPROPLEN
) {
1450 zfs_error_aux(hdl
, dgettext(TEXT_DOMAIN
,
1451 "'%s' is too long"), nvpair_name(elem
));
1456 case PROP_TYPE_NUMBER
:
1457 if (datatype
== DATA_TYPE_STRING
) {
1458 (void) nvpair_value_string(elem
, &value
);
1459 if (strcmp(value
, "none") == 0) {
1461 } else if (zfs_nicestrtonum(hdl
, value
, ivalp
)
1465 } else if (datatype
== DATA_TYPE_UINT64
) {
1466 (void) nvpair_value_uint64(elem
, ivalp
);
1468 zfs_error_aux(hdl
, dgettext(TEXT_DOMAIN
,
1469 "'%s' must be a number"), nvpair_name(elem
));
1474 * Quota special: force 'none' and don't allow 0.
1476 if ((type
& ZFS_TYPE_DATASET
) && *ivalp
== 0 && !isnone
&&
1477 (prop
== ZFS_PROP_QUOTA
|| prop
== ZFS_PROP_REFQUOTA
)) {
1478 zfs_error_aux(hdl
, dgettext(TEXT_DOMAIN
,
1479 "use 'none' to disable quota/refquota"));
1484 * Special handling for "*_limit=none". In this case it's not
1487 if ((type
& ZFS_TYPE_DATASET
) && isnone
&&
1488 (prop
== ZFS_PROP_FILESYSTEM_LIMIT
||
1489 prop
== ZFS_PROP_SNAPSHOT_LIMIT
)) {
1490 *ivalp
= UINT64_MAX
;
1494 case PROP_TYPE_INDEX
:
1495 if (datatype
!= DATA_TYPE_STRING
) {
1496 zfs_error_aux(hdl
, dgettext(TEXT_DOMAIN
,
1497 "'%s' must be a string"), nvpair_name(elem
));
1501 (void) nvpair_value_string(elem
, &value
);
1503 if (zprop_string_to_index(prop
, value
, ivalp
, type
) != 0) {
1504 zfs_error_aux(hdl
, dgettext(TEXT_DOMAIN
,
1505 "'%s' must be one of '%s'"), propname
,
1506 zprop_values(prop
, type
));
1516 * Add the result to our return set of properties.
1518 if (*svalp
!= NULL
) {
1519 if (nvlist_add_string(ret
, propname
, *svalp
) != 0) {
1520 (void) no_memory(hdl
);
1524 if (nvlist_add_uint64(ret
, propname
, *ivalp
) != 0) {
1525 (void) no_memory(hdl
);
1532 (void) zfs_error(hdl
, EZFS_BADPROP
, errbuf
);
1537 addlist(libzfs_handle_t
*hdl
, char *propname
, zprop_list_t
**listp
,
1541 zprop_list_t
*entry
;
1543 prop
= zprop_name_to_prop(propname
, type
);
1545 if (prop
!= ZPROP_INVAL
&& !zprop_valid_for_type(prop
, type
, B_FALSE
))
1549 * When no property table entry can be found, return failure if
1550 * this is a pool property or if this isn't a user-defined
1553 if (prop
== ZPROP_INVAL
&& ((type
== ZFS_TYPE_POOL
&&
1554 !zpool_prop_feature(propname
) &&
1555 !zpool_prop_unsupported(propname
)) ||
1556 (type
== ZFS_TYPE_DATASET
&& !zfs_prop_user(propname
) &&
1557 !zfs_prop_userquota(propname
) && !zfs_prop_written(propname
)))) {
1558 zfs_error_aux(hdl
, dgettext(TEXT_DOMAIN
,
1559 "invalid property '%s'"), propname
);
1560 return (zfs_error(hdl
, EZFS_BADPROP
,
1561 dgettext(TEXT_DOMAIN
, "bad property list")));
1564 if ((entry
= zfs_alloc(hdl
, sizeof (zprop_list_t
))) == NULL
)
1567 entry
->pl_prop
= prop
;
1568 if (prop
== ZPROP_INVAL
) {
1569 if ((entry
->pl_user_prop
= zfs_strdup(hdl
, propname
)) ==
1574 entry
->pl_width
= strlen(propname
);
1576 entry
->pl_width
= zprop_width(prop
, &entry
->pl_fixed
,
1586 * Given a comma-separated list of properties, construct a property list
1587 * containing both user-defined and native properties. This function will
1588 * return a NULL list if 'all' is specified, which can later be expanded
1589 * by zprop_expand_list().
1592 zprop_get_list(libzfs_handle_t
*hdl
, char *props
, zprop_list_t
**listp
,
1598 * If 'all' is specified, return a NULL list.
1600 if (strcmp(props
, "all") == 0)
1604 * If no props were specified, return an error.
1606 if (props
[0] == '\0') {
1607 zfs_error_aux(hdl
, dgettext(TEXT_DOMAIN
,
1608 "no properties specified"));
1609 return (zfs_error(hdl
, EZFS_BADPROP
, dgettext(TEXT_DOMAIN
,
1610 "bad property list")));
1614 * It would be nice to use getsubopt() here, but the inclusion of column
1615 * aliases makes this more effort than it's worth.
1617 while (*props
!= '\0') {
1622 if ((p
= strchr(props
, ',')) == NULL
) {
1623 len
= strlen(props
);
1630 * Check for empty options.
1633 zfs_error_aux(hdl
, dgettext(TEXT_DOMAIN
,
1634 "empty property name"));
1635 return (zfs_error(hdl
, EZFS_BADPROP
,
1636 dgettext(TEXT_DOMAIN
, "bad property list")));
1640 * Check all regular property names.
1645 if (strcmp(props
, "space") == 0) {
1646 static char *spaceprops
[] = {
1647 "name", "avail", "used", "usedbysnapshots",
1648 "usedbydataset", "usedbyrefreservation",
1649 "usedbychildren", NULL
1653 for (i
= 0; spaceprops
[i
]; i
++) {
1654 if (addlist(hdl
, spaceprops
[i
], listp
, type
))
1656 listp
= &(*listp
)->pl_next
;
1659 if (addlist(hdl
, props
, listp
, type
))
1661 listp
= &(*listp
)->pl_next
;
1673 zprop_free_list(zprop_list_t
*pl
)
1677 while (pl
!= NULL
) {
1679 free(pl
->pl_user_prop
);
1685 typedef struct expand_data
{
1686 zprop_list_t
**last
;
1687 libzfs_handle_t
*hdl
;
1692 zprop_expand_list_cb(int prop
, void *cb
)
1694 zprop_list_t
*entry
;
1695 expand_data_t
*edp
= cb
;
1697 if ((entry
= zfs_alloc(edp
->hdl
, sizeof (zprop_list_t
))) == NULL
)
1698 return (ZPROP_INVAL
);
1700 entry
->pl_prop
= prop
;
1701 entry
->pl_width
= zprop_width(prop
, &entry
->pl_fixed
, edp
->type
);
1702 entry
->pl_all
= B_TRUE
;
1704 *(edp
->last
) = entry
;
1705 edp
->last
= &entry
->pl_next
;
1707 return (ZPROP_CONT
);
1711 zprop_expand_list(libzfs_handle_t
*hdl
, zprop_list_t
**plp
, zfs_type_t type
)
1713 zprop_list_t
*entry
;
1714 zprop_list_t
**last
;
1719 * If this is the very first time we've been called for an 'all'
1720 * specification, expand the list to include all native
1729 if (zprop_iter_common(zprop_expand_list_cb
, &exp
, B_FALSE
,
1730 B_FALSE
, type
) == ZPROP_INVAL
)
1734 * Add 'name' to the beginning of the list, which is handled
1737 if ((entry
= zfs_alloc(hdl
, sizeof (zprop_list_t
))) == NULL
)
1740 entry
->pl_prop
= (type
== ZFS_TYPE_POOL
) ? ZPOOL_PROP_NAME
:
1742 entry
->pl_width
= zprop_width(entry
->pl_prop
,
1743 &entry
->pl_fixed
, type
);
1744 entry
->pl_all
= B_TRUE
;
1745 entry
->pl_next
= *plp
;
1752 zprop_iter(zprop_func func
, void *cb
, boolean_t show_all
, boolean_t ordered
,
1755 return (zprop_iter_common(func
, cb
, show_all
, ordered
, type
));