dsl_prop.c revision d8d7720025734ca1adbaa020f5015dc3d586478d
/*
* CDDL HEADER START
*
* The contents of this file are subject to the terms of the
* Common Development and Distribution License (the "License").
* You may not use this file except in compliance with the License.
*
* You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
* See the License for the specific language governing permissions
* and limitations under the License.
*
* When distributing Covered Code, include this CDDL HEADER in each
* file and include the License file at usr/src/OPENSOLARIS.LICENSE.
* If applicable, add the following below this CDDL HEADER, with the
* fields enclosed by brackets "[]" replaced with your own identifying
* information: Portions Copyright [yyyy] [name of copyright owner]
*
* CDDL HEADER END
*/
/*
* Copyright 2008 Sun Microsystems, Inc. All rights reserved.
* Use is subject to license terms.
*/
#pragma ident "%Z%%M% %I% %E% SMI"
#include <sys/dmu_objset.h>
#include <sys/dsl_dataset.h>
#include <sys/dsl_prop.h>
#include <sys/dsl_synctask.h>
#include "zfs_prop.h"
static int
{
/*
* The setonce properties are read-only, BUT they still
* have a default value that can be used as the initial
* value.
*/
return (ENOENT);
if (intsz != 1)
return (EOVERFLOW);
numint);
} else {
return (EOVERFLOW);
}
return (0);
}
static int
{
if (setpoint)
setpoint[0] = '\0';
/*
* Note: dd may be NULL, therefore we shouldn't dereference it
* ouside this loop.
*/
if (setpoint)
break;
}
/*
* Break out of this loop for non-inheritable properties.
*/
break;
}
return (err);
}
/*
* Register interest in the named property. We'll call the callback
* once to notify it of the current property value, and again each time
* the property changes, until this callback is unregistered.
*
* Return 0 on success, errno if the prop is not an integer value.
*/
int
{
int err;
int need_rwlock;
if (need_rwlock)
if (err != 0) {
if (need_rwlock)
return (err);
}
if (need_rwlock)
/* Leave dataset open until this callback is unregistered */
return (0);
}
int
{
int err;
return (err);
}
/*
* Get property when config lock is already held.
*/
{
}
int
{
const char *tail;
int err;
if (err)
return (err);
return (ENOENT);
}
return (err);
}
/*
* Get the current property value. It may have changed by the time this
* function returns, so it is NOT safe to follow up with
* dsl_prop_register() and assume that the value has not changed in
* between.
*
* Return 0 on success, ENOENT if ddname is invalid.
*/
int
{
}
/*
* Unregister this callback. Return 0 on success, ENOENT if ddname is
* invalid, ENOMSG if no matching callback registered.
*/
int
{
break;
}
return (ENOMSG);
}
/* Clean up from dsl_prop_register */
return (0);
}
/*
* Return the number of callbacks that are registered for this dataset.
*/
int
{
int num = 0;
num++;
}
return (num);
}
static void
{
int err;
if (err)
return;
if (!first) {
/*
* If the prop is set here, then this change is not
* being inherited here or below; stop the recursion.
*/
if (err == 0) {
return;
}
}
}
}
zap_cursor_advance(&zc)) {
}
}
struct prop_set_arg {
const char *name;
int intsz;
int numints;
const void *buf;
};
static void
{
int isint;
char valbuf[32];
char *valstr;
if (isint) {
}
} else {
if (isint)
}
if (isint) {
}
if (isint) {
} else {
}
}
void
{
}
int
{
struct prop_set_arg psa;
}
int
{
int err;
/*
* We must do these checks before we get to the syncfunc, since
* it can't fail.
*/
return (ENAMETOOLONG);
return (E2BIG);
if (err)
return (err);
return (err);
}
/*
* Iterate over all properties for this dataset and return them in an nvlist.
*/
int
{
int err = 0;
dsl_pool_t *dp;
char setpoint[MAXNAMELEN];
zap_cursor_advance(&zc)) {
/*
* Skip non-inheritable properties.
*/
continue;
if (snapshot &&
continue;
&propval) == 0)
continue;
KM_SLEEP) == 0);
/*
* String property
*/
KM_SLEEP);
tmp);
if (err != 0) {
break;
}
tmp) == 0);
} else {
/*
* Integer property
*/
}
setpoint) == 0);
propval) == 0);
}
break;
err = 0;
}
return (err);
}
void
{
}
void
{
}