libzfs_util.c revision 19b94df933188a15d4f0d6c568f0bab3f127892e
d583b39bfb4e2571d3e41097c5c357ffe353ad45John Wren Kennedy * CDDL HEADER START
d583b39bfb4e2571d3e41097c5c357ffe353ad45John Wren Kennedy * The contents of this file are subject to the terms of the
d583b39bfb4e2571d3e41097c5c357ffe353ad45John Wren Kennedy * Common Development and Distribution License (the "License").
d583b39bfb4e2571d3e41097c5c357ffe353ad45John Wren Kennedy * You may not use this file except in compliance with the License.
d583b39bfb4e2571d3e41097c5c357ffe353ad45John Wren Kennedy * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
d583b39bfb4e2571d3e41097c5c357ffe353ad45John Wren Kennedy * or http://www.opensolaris.org/os/licensing.
d583b39bfb4e2571d3e41097c5c357ffe353ad45John Wren Kennedy * See the License for the specific language governing permissions
d583b39bfb4e2571d3e41097c5c357ffe353ad45John Wren Kennedy * and limitations under the License.
d583b39bfb4e2571d3e41097c5c357ffe353ad45John Wren Kennedy * When distributing Covered Code, include this CDDL HEADER in each
d583b39bfb4e2571d3e41097c5c357ffe353ad45John Wren Kennedy * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
d583b39bfb4e2571d3e41097c5c357ffe353ad45John Wren Kennedy * If applicable, add the following below this CDDL HEADER, with the
d583b39bfb4e2571d3e41097c5c357ffe353ad45John Wren Kennedy * fields enclosed by brackets "[]" replaced with your own identifying
d583b39bfb4e2571d3e41097c5c357ffe353ad45John Wren Kennedy * information: Portions Copyright [yyyy] [name of copyright owner]
d583b39bfb4e2571d3e41097c5c357ffe353ad45John Wren Kennedy * CDDL HEADER END
d583b39bfb4e2571d3e41097c5c357ffe353ad45John Wren Kennedy * Copyright (c) 2005, 2010, Oracle and/or its affiliates. All rights reserved.
d583b39bfb4e2571d3e41097c5c357ffe353ad45John Wren Kennedy * Copyright (c) 2011 by Delphix. All rights reserved.
d583b39bfb4e2571d3e41097c5c357ffe353ad45John Wren Kennedy * Internal utility routines for the ZFS library.
case EZFS_NOMEM:
case EZFS_BADPROP:
case EZFS_PROPREADONLY:
case EZFS_PROPTYPE:
case EZFS_PROPNONINHERIT:
case EZFS_PROPSPACE:
case EZFS_BADTYPE:
case EZFS_BUSY:
case EZFS_EXISTS:
case EZFS_NOENT:
case EZFS_BADSTREAM:
case EZFS_DSREADONLY:
case EZFS_VOLTOOBIG:
case EZFS_INVALIDNAME:
case EZFS_BADRESTORE:
case EZFS_BADBACKUP:
case EZFS_BADTARGET:
case EZFS_NODEVICE:
case EZFS_BADDEV:
case EZFS_NOREPLICAS:
case EZFS_RESILVERING:
case EZFS_BADVERSION:
case EZFS_POOLUNAVAIL:
case EZFS_DEVOVERFLOW:
case EZFS_BADPATH:
case EZFS_CROSSTARGET:
case EZFS_ZONED:
case EZFS_MOUNTFAILED:
case EZFS_UMOUNTFAILED:
case EZFS_UNSHARENFSFAILED:
case EZFS_SHARENFSFAILED:
case EZFS_UNSHARESMBFAILED:
case EZFS_SHARESMBFAILED:
case EZFS_PERM:
case EZFS_NOSPC:
case EZFS_FAULT:
case EZFS_IO:
case EZFS_INTR:
case EZFS_ISSPARE:
case EZFS_INVALCONFIG:
case EZFS_RECURSIVE:
case EZFS_NOHISTORY:
case EZFS_POOLPROPS:
case EZFS_POOL_NOTSUP:
case EZFS_POOL_INVALARG:
case EZFS_NAMETOOLONG:
case EZFS_OPENFAILED:
case EZFS_NOCAP:
case EZFS_LABELFAILED:
case EZFS_BADWHO:
case EZFS_BADPERM:
case EZFS_BADPERMSET:
case EZFS_NODELEGATION:
case EZFS_BADCACHE:
case EZFS_ISL2CACHE:
case EZFS_VDEVNOTSUP:
case EZFS_NOTSUP:
case EZFS_ACTIVE_SPARE:
case EZFS_UNPLAYED_LOGS:
case EZFS_REFTAG_RELE:
case EZFS_REFTAG_HOLD:
case EZFS_TAGTOOLONG:
case EZFS_PIPEFAILED:
case EZFS_THREADCREATEFAILED:
case EZFS_POSTSPLIT_ONLINE:
case EZFS_SCRUBBING:
case EZFS_NO_SCRUB:
case EZFS_DIFF:
case EZFS_DIFFDATA:
case EZFS_POOLREADONLY:
case EZFS_UNKNOWN:
abort();
switch (error) {
case EPERM:
case EACCES:
case ECANCELED:
case EIO:
case EFAULT:
case EINTR:
switch (error) {
case ENXIO:
case ENODEV:
case EPIPE:
case ENOENT:
case ENOSPC:
case EDQUOT:
case EEXIST:
case EBUSY:
case EROFS:
case ENAMETOOLONG:
case ENOTSUP:
case EAGAIN:
switch (error) {
case ENODEV:
case ENOENT:
case EEXIST:
case EBUSY:
case ENXIO:
case ENAMETOOLONG:
case ENOTSUP:
case EINVAL:
case ENOSPC:
case EDQUOT:
case EAGAIN:
case EROFS:
void *data;
return (data);
char *ret;
int err;
if (err < 0)
return (ret);
void *ret;
return (NULL);
return (ret);
char *ret;
return (ret);
int index = 0;
index++;
if (index == 0) {
libzfs_init(void)
return (NULL);
return (NULL);
return (NULL);
return (hdl);
int ret;
return (NULL);
if (ret != 0) {
return (NULL);
path);
return (NULL);
if (len == 0)
== NULL)
char *packed;
int error;
return (error);
char *title;
ZFS_PROP_NAME) &&
for (i = 0; i < ZFS_GET_NCOLS; i++) {
case GET_COL_NAME:
case GET_COL_PROPERTY:
case GET_COL_VALUE:
case GET_COL_RECVD:
case GET_COL_SOURCE:
title);
const char *str;
for (i = 0; i < ZFS_GET_NCOLS; i++) {
case GET_COL_NAME:
case GET_COL_PROPERTY:
case GET_COL_VALUE:
case GET_COL_SOURCE:
switch (sourcetype) {
case ZPROP_SRC_NONE:
case ZPROP_SRC_DEFAULT:
case ZPROP_SRC_LOCAL:
case ZPROP_SRC_TEMPORARY:
case ZPROP_SRC_INHERITED:
case ZPROP_SRC_RECEIVED:
case GET_COL_RECVD:
str);
char *end;
int shift;
*num = 0;
if (hdl)
errno = 0;
if (hdl)
if (hdl)
if (hdl)
const char *errbuf)
const char *propname;
char *value;
*ivalp = 0;
switch (proptype) {
case PROP_TYPE_STRING:
goto error;
goto error;
case PROP_TYPE_NUMBER:
goto error;
goto error;
goto error;
case PROP_TYPE_INDEX:
goto error;
goto error;
abort();
int prop;
type);
if (len == 0) {
static char *spaceprops[] = {
for (i = 0; spaceprops[i]; i++) {
props = p;
props++;
typedef struct expand_data {
return (ZPROP_INVAL);
return (ZPROP_CONT);