dsl_prop.c revision ea2f5b9e5bf4966630882d6d681a94768aea1d75
/*
* 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 2009 Sun Microsystems, Inc. All rights reserved.
* Use is subject to license terms.
*/
#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);
}
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);
}
int
{
if (setpoint)
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 dir open until this callback is unregistered */
return (0);
}
int
{
int err;
if (err)
return (err);
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;
}
}
continue;
/*
* If the property is set on this ds, then it is not
* inherited here; don't call the callback.
*/
continue;
}
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 (dsl_dataset_is_snapshot(ds)) {
}
} else {
}
if (isint) {
}
} else {
if (isint)
}
if (isint) {
if (dsl_dataset_is_snapshot(ds)) {
/*
* It's a snapshot; nothing can inherit this
* property, so just look for callbacks on this
* ds here.
*/
}
} else {
}
}
if (isint) {
} else {
}
}
void
{
struct prop_set_arg psa;
} else {
}
}
}
void
{
}
int
{
int err;
struct prop_set_arg psa;
/*
* We must do these checks before we get to the syncfunc, since
* it can't fail.
*/
return (ENAMETOOLONG);
return (E2BIG);
if (err)
return (err);
if (dsl_dataset_is_snapshot(ds) &&
return (ENOTSUP);
}
return (err);
}
int
{
int err;
/*
* Do these checks before the syncfunc, since it can't fail.
*/
return (ENAMETOOLONG);
char *valstr;
return (E2BIG);
}
}
return (err);
if (dsl_dataset_is_snapshot(ds) &&
return (ENOTSUP);
}
return (err);
}
/*
* Iterate over all properties for this dataset and return them in an nvlist.
*/
int
{
int err = 0;
return (0);
char setpoint[MAXNAMELEN];
if (propobj) {
} else {
}
zap_cursor_advance(&zc)) {
/* Skip non-inheritable properties. */
if (prop != ZPROP_INVAL &&
!zfs_prop_inheritable(prop) &&
continue;
/* Skip properties not valid for this type. */
continue;
/* Skip properties already defined */
&propval) == 0)
continue;
KM_SLEEP) == 0);
/*
* String property
*/
KM_SLEEP);
if (err != 0) {
break;
}
tmp) == 0);
} else {
/*
* Integer property
*/
}
setpoint) == 0);
propval) == 0);
}
break;
err = 0;
/*
* If we are just after the props that have been set
* locally, then we are done after the first iteration.
*/
if (local)
break;
propobj = 0;
}
return (err);
}
void
{
}
void
{
}