Deleted Added
full compact
libzfs_util.c (229578) libzfs_util.c (243674)
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

--- 4 unchanged lines hidden (view full) ---

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 */
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

--- 4 unchanged lines hidden (view full) ---

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
21/*
22 * Copyright (c) 2005, 2010, Oracle and/or its affiliates. All rights reserved.
22/*
23 * Copyright (c) 2005, 2010, Oracle and/or its affiliates. All rights reserved.
23 * Copyright (c) 2011 by Delphix. All rights reserved.
24 * Copyright (c) 2012 by Delphix. All rights reserved.
24 */
25
26/*
27 * Internal utility routines for the ZFS library.
28 */
29
30#include <sys/param.h>
31#include <sys/linker.h>

--- 13 unchanged lines hidden (view full) ---

45#include <sys/mnttab.h>
46#include <sys/mntent.h>
47#include <sys/types.h>
48
49#include <libzfs.h>
50
51#include "libzfs_impl.h"
52#include "zfs_prop.h"
25 */
26
27/*
28 * Internal utility routines for the ZFS library.
29 */
30
31#include <sys/param.h>
32#include <sys/linker.h>

--- 13 unchanged lines hidden (view full) ---

46#include <sys/mnttab.h>
47#include <sys/mntent.h>
48#include <sys/types.h>
49
50#include <libzfs.h>
51
52#include "libzfs_impl.h"
53#include "zfs_prop.h"
54#include "zfeature_common.h"
53
54int aok;
55
56int
57libzfs_errno(libzfs_handle_t *hdl)
58{
59 return (hdl->libzfs_error);
60}

--- 53 unchanged lines hidden (view full) ---

114 return (dgettext(TEXT_DOMAIN, "no such device in pool"));
115 case EZFS_BADDEV:
116 return (dgettext(TEXT_DOMAIN, "invalid device"));
117 case EZFS_NOREPLICAS:
118 return (dgettext(TEXT_DOMAIN, "no valid replicas"));
119 case EZFS_RESILVERING:
120 return (dgettext(TEXT_DOMAIN, "currently resilvering"));
121 case EZFS_BADVERSION:
55
56int aok;
57
58int
59libzfs_errno(libzfs_handle_t *hdl)
60{
61 return (hdl->libzfs_error);
62}

--- 53 unchanged lines hidden (view full) ---

116 return (dgettext(TEXT_DOMAIN, "no such device in pool"));
117 case EZFS_BADDEV:
118 return (dgettext(TEXT_DOMAIN, "invalid device"));
119 case EZFS_NOREPLICAS:
120 return (dgettext(TEXT_DOMAIN, "no valid replicas"));
121 case EZFS_RESILVERING:
122 return (dgettext(TEXT_DOMAIN, "currently resilvering"));
123 case EZFS_BADVERSION:
122 return (dgettext(TEXT_DOMAIN, "unsupported version"));
124 return (dgettext(TEXT_DOMAIN, "unsupported version or "
125 "feature"));
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"));
127 case EZFS_BADPATH:
128 return (dgettext(TEXT_DOMAIN, "must be an absolute path"));
129 case EZFS_CROSSTARGET:
130 return (dgettext(TEXT_DOMAIN, "operation crosses datasets or "

--- 520 unchanged lines hidden (view full) ---

651 free(hdl);
652 return (NULL);
653 }
654
655 hdl->libzfs_sharetab = fopen(ZFS_EXPORTS_PATH, "r");
656
657 zfs_prop_init();
658 zpool_prop_init();
126 case EZFS_POOLUNAVAIL:
127 return (dgettext(TEXT_DOMAIN, "pool is unavailable"));
128 case EZFS_DEVOVERFLOW:
129 return (dgettext(TEXT_DOMAIN, "too many devices in one vdev"));
130 case EZFS_BADPATH:
131 return (dgettext(TEXT_DOMAIN, "must be an absolute path"));
132 case EZFS_CROSSTARGET:
133 return (dgettext(TEXT_DOMAIN, "operation crosses datasets or "

--- 520 unchanged lines hidden (view full) ---

654 free(hdl);
655 return (NULL);
656 }
657
658 hdl->libzfs_sharetab = fopen(ZFS_EXPORTS_PATH, "r");
659
660 zfs_prop_init();
661 zpool_prop_init();
662 zpool_feature_init();
659 libzfs_mnttab_init(hdl);
660
661 return (hdl);
662}
663
664void
665libzfs_fini(libzfs_handle_t *hdl)
666{

--- 653 unchanged lines hidden (view full) ---

1320 if (prop != ZPROP_INVAL && !zprop_valid_for_type(prop, type))
1321 prop = ZPROP_INVAL;
1322
1323 /*
1324 * When no property table entry can be found, return failure if
1325 * this is a pool property or if this isn't a user-defined
1326 * dataset property,
1327 */
663 libzfs_mnttab_init(hdl);
664
665 return (hdl);
666}
667
668void
669libzfs_fini(libzfs_handle_t *hdl)
670{

--- 653 unchanged lines hidden (view full) ---

1324 if (prop != ZPROP_INVAL && !zprop_valid_for_type(prop, type))
1325 prop = ZPROP_INVAL;
1326
1327 /*
1328 * When no property table entry can be found, return failure if
1329 * this is a pool property or if this isn't a user-defined
1330 * dataset property,
1331 */
1328 if (prop == ZPROP_INVAL && (type == ZFS_TYPE_POOL ||
1329 (!zfs_prop_user(propname) && !zfs_prop_userquota(propname) &&
1330 !zfs_prop_written(propname)))) {
1332 if (prop == ZPROP_INVAL && ((type == ZFS_TYPE_POOL &&
1333 !zpool_prop_feature(propname) &&
1334 !zpool_prop_unsupported(propname)) ||
1335 (type == ZFS_TYPE_DATASET && !zfs_prop_user(propname) &&
1336 !zfs_prop_userquota(propname) && !zfs_prop_written(propname)))) {
1331 zfs_error_aux(hdl, dgettext(TEXT_DOMAIN,
1332 "invalid property '%s'"), propname);
1333 return (zfs_error(hdl, EZFS_BADPROP,
1334 dgettext(TEXT_DOMAIN, "bad property list")));
1335 }
1336
1337 if ((entry = zfs_alloc(hdl, sizeof (zprop_list_t))) == NULL)
1338 return (-1);
1339
1340 entry->pl_prop = prop;
1341 if (prop == ZPROP_INVAL) {
1337 zfs_error_aux(hdl, dgettext(TEXT_DOMAIN,
1338 "invalid property '%s'"), propname);
1339 return (zfs_error(hdl, EZFS_BADPROP,
1340 dgettext(TEXT_DOMAIN, "bad property list")));
1341 }
1342
1343 if ((entry = zfs_alloc(hdl, sizeof (zprop_list_t))) == NULL)
1344 return (-1);
1345
1346 entry->pl_prop = prop;
1347 if (prop == ZPROP_INVAL) {
1342 if ((entry->pl_user_prop = zfs_strdup(hdl, propname)) == NULL) {
1348 if ((entry->pl_user_prop = zfs_strdup(hdl, propname)) ==
1349 NULL) {
1343 free(entry);
1344 return (-1);
1345 }
1346 entry->pl_width = strlen(propname);
1347 } else {
1348 entry->pl_width = zprop_width(prop, &entry->pl_fixed,
1349 type);
1350 }

--- 178 unchanged lines hidden ---
1350 free(entry);
1351 return (-1);
1352 }
1353 entry->pl_width = strlen(propname);
1354 } else {
1355 entry->pl_width = zprop_width(prop, &entry->pl_fixed,
1356 type);
1357 }

--- 178 unchanged lines hidden ---