libzfs_dataset.c (197867) | libzfs_dataset.c (205198) |
---|---|
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 --- 6 unchanged lines hidden (view full) --- 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/* | 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 --- 6 unchanged lines hidden (view full) --- 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/* |
23 * Copyright 2008 Sun Microsystems, Inc. All rights reserved. | 23 * Copyright 2009 Sun Microsystems, Inc. All rights reserved. |
24 * Use is subject to license terms. 25 */ 26 27#include <assert.h> 28#include <ctype.h> 29#include <errno.h> 30#include <libintl.h> 31#include <math.h> --- 2008 unchanged lines hidden (view full) --- 2040 uint64_t value; 2041 2042 *source = NULL; 2043 if (nvlist_lookup_nvlist(zhp->zfs_props, 2044 zfs_prop_to_name(prop), &nv) == 0) { 2045 verify(nvlist_lookup_uint64(nv, ZPROP_VALUE, &value) == 0); 2046 (void) nvlist_lookup_string(nv, ZPROP_SOURCE, source); 2047 } else { | 24 * Use is subject to license terms. 25 */ 26 27#include <assert.h> 28#include <ctype.h> 29#include <errno.h> 30#include <libintl.h> 31#include <math.h> --- 2008 unchanged lines hidden (view full) --- 2040 uint64_t value; 2041 2042 *source = NULL; 2043 if (nvlist_lookup_nvlist(zhp->zfs_props, 2044 zfs_prop_to_name(prop), &nv) == 0) { 2045 verify(nvlist_lookup_uint64(nv, ZPROP_VALUE, &value) == 0); 2046 (void) nvlist_lookup_string(nv, ZPROP_SOURCE, source); 2047 } else { |
2048 verify(!zhp->zfs_props_table || 2049 zhp->zfs_props_table[prop] == B_TRUE); |
|
2048 value = zfs_prop_default_numeric(prop); 2049 *source = ""; 2050 } 2051 2052 return (value); 2053} 2054 2055static char * 2056getprop_string(zfs_handle_t *zhp, zfs_prop_t prop, char **source) 2057{ 2058 nvlist_t *nv; 2059 char *value; 2060 2061 *source = NULL; 2062 if (nvlist_lookup_nvlist(zhp->zfs_props, 2063 zfs_prop_to_name(prop), &nv) == 0) { 2064 verify(nvlist_lookup_string(nv, ZPROP_VALUE, &value) == 0); 2065 (void) nvlist_lookup_string(nv, ZPROP_SOURCE, source); 2066 } else { | 2050 value = zfs_prop_default_numeric(prop); 2051 *source = ""; 2052 } 2053 2054 return (value); 2055} 2056 2057static char * 2058getprop_string(zfs_handle_t *zhp, zfs_prop_t prop, char **source) 2059{ 2060 nvlist_t *nv; 2061 char *value; 2062 2063 *source = NULL; 2064 if (nvlist_lookup_nvlist(zhp->zfs_props, 2065 zfs_prop_to_name(prop), &nv) == 0) { 2066 verify(nvlist_lookup_string(nv, ZPROP_VALUE, &value) == 0); 2067 (void) nvlist_lookup_string(nv, ZPROP_SOURCE, source); 2068 } else { |
2069 verify(!zhp->zfs_props_table || 2070 zhp->zfs_props_table[prop] == B_TRUE); |
|
2067 if ((value = (char *)zfs_prop_default_string(prop)) == NULL) 2068 value = ""; 2069 *source = ""; 2070 } 2071 2072 return (value); 2073} 2074 --- 2187 unchanged lines hidden (view full) --- 4262 zc.zc_share.z_exportdata = (uint64_t)(uintptr_t)export; 4263 zc.zc_share.z_sharetype = operation; 4264 zc.zc_share.z_sharemax = sharemax; 4265 4266 error = ioctl(hdl->libzfs_fd, ZFS_IOC_SHARE, &zc); 4267 return (error); 4268} 4269 | 2071 if ((value = (char *)zfs_prop_default_string(prop)) == NULL) 2072 value = ""; 2073 *source = ""; 2074 } 2075 2076 return (value); 2077} 2078 --- 2187 unchanged lines hidden (view full) --- 4266 zc.zc_share.z_exportdata = (uint64_t)(uintptr_t)export; 4267 zc.zc_share.z_sharetype = operation; 4268 zc.zc_share.z_sharemax = sharemax; 4269 4270 error = ioctl(hdl->libzfs_fd, ZFS_IOC_SHARE, &zc); 4271 return (error); 4272} 4273 |
4274void 4275zfs_prune_proplist(zfs_handle_t *zhp, uint8_t *props) 4276{ 4277 nvpair_t *curr; 4278 4279 /* 4280 * Keep a reference to the props-table against which we prune the 4281 * properties. 4282 */ 4283 zhp->zfs_props_table = props; 4284 4285 curr = nvlist_next_nvpair(zhp->zfs_props, NULL); 4286 4287 while (curr) { 4288 zfs_prop_t zfs_prop = zfs_name_to_prop(nvpair_name(curr)); 4289 nvpair_t *next = nvlist_next_nvpair(zhp->zfs_props, curr); 4290 4291 if (props[zfs_prop] == B_FALSE) 4292 (void) nvlist_remove(zhp->zfs_props, 4293 nvpair_name(curr), nvpair_type(curr)); 4294 curr = next; 4295 } 4296} 4297 |
|
4270/* 4271 * Attach/detach the given filesystem to/from the given jail. 4272 */ 4273int 4274zfs_jail(zfs_handle_t *zhp, int jailid, int attach) 4275{ 4276 libzfs_handle_t *hdl = zhp->zfs_hdl; 4277 zfs_cmd_t zc = { 0 }; --- 33 unchanged lines hidden --- | 4298/* 4299 * Attach/detach the given filesystem to/from the given jail. 4300 */ 4301int 4302zfs_jail(zfs_handle_t *zhp, int jailid, int attach) 4303{ 4304 libzfs_handle_t *hdl = zhp->zfs_hdl; 4305 zfs_cmd_t zc = { 0 }; --- 33 unchanged lines hidden --- |