dsl_prop.h revision ea2f5b9e5bf4966630882d6d681a94768aea1d75
fa9e4066f08beec538e775443c5be79dd423fcabahrens/*
fa9e4066f08beec538e775443c5be79dd423fcabahrens * CDDL HEADER START
fa9e4066f08beec538e775443c5be79dd423fcabahrens *
fa9e4066f08beec538e775443c5be79dd423fcabahrens * The contents of this file are subject to the terms of the
99653d4ee642c6528e88224f12409a5f23060994eschrock * Common Development and Distribution License (the "License").
99653d4ee642c6528e88224f12409a5f23060994eschrock * You may not use this file except in compliance with the License.
fa9e4066f08beec538e775443c5be79dd423fcabahrens *
fa9e4066f08beec538e775443c5be79dd423fcabahrens * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
fa9e4066f08beec538e775443c5be79dd423fcabahrens * or http://www.opensolaris.org/os/licensing.
fa9e4066f08beec538e775443c5be79dd423fcabahrens * See the License for the specific language governing permissions
fa9e4066f08beec538e775443c5be79dd423fcabahrens * and limitations under the License.
fa9e4066f08beec538e775443c5be79dd423fcabahrens *
fa9e4066f08beec538e775443c5be79dd423fcabahrens * When distributing Covered Code, include this CDDL HEADER in each
fa9e4066f08beec538e775443c5be79dd423fcabahrens * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
fa9e4066f08beec538e775443c5be79dd423fcabahrens * If applicable, add the following below this CDDL HEADER, with the
fa9e4066f08beec538e775443c5be79dd423fcabahrens * fields enclosed by brackets "[]" replaced with your own identifying
fa9e4066f08beec538e775443c5be79dd423fcabahrens * information: Portions Copyright [yyyy] [name of copyright owner]
fa9e4066f08beec538e775443c5be79dd423fcabahrens *
fa9e4066f08beec538e775443c5be79dd423fcabahrens * CDDL HEADER END
fa9e4066f08beec538e775443c5be79dd423fcabahrens */
fa9e4066f08beec538e775443c5be79dd423fcabahrens/*
5c0b6a79c494b543020a5d970d3f10597234672cRich Morris * Copyright 2009 Sun Microsystems, Inc. All rights reserved.
fa9e4066f08beec538e775443c5be79dd423fcabahrens * Use is subject to license terms.
fa9e4066f08beec538e775443c5be79dd423fcabahrens */
fa9e4066f08beec538e775443c5be79dd423fcabahrens
fa9e4066f08beec538e775443c5be79dd423fcabahrens#ifndef _SYS_DSL_PROP_H
fa9e4066f08beec538e775443c5be79dd423fcabahrens#define _SYS_DSL_PROP_H
fa9e4066f08beec538e775443c5be79dd423fcabahrens
fa9e4066f08beec538e775443c5be79dd423fcabahrens#include <sys/dmu.h>
fa9e4066f08beec538e775443c5be79dd423fcabahrens#include <sys/dsl_pool.h>
fa9e4066f08beec538e775443c5be79dd423fcabahrens#include <sys/zfs_context.h>
ea2f5b9e5bf4966630882d6d681a94768aea1d75Matthew Ahrens#include <sys/dsl_synctask.h>
fa9e4066f08beec538e775443c5be79dd423fcabahrens
fa9e4066f08beec538e775443c5be79dd423fcabahrens#ifdef __cplusplus
fa9e4066f08beec538e775443c5be79dd423fcabahrensextern "C" {
fa9e4066f08beec538e775443c5be79dd423fcabahrens#endif
fa9e4066f08beec538e775443c5be79dd423fcabahrens
fa9e4066f08beec538e775443c5be79dd423fcabahrensstruct dsl_dataset;
bb0ade0978a02d3fe0b0165cd4725fdcb593fbfbahrensstruct dsl_dir;
fa9e4066f08beec538e775443c5be79dd423fcabahrens
fa9e4066f08beec538e775443c5be79dd423fcabahrens/* The callback func may not call into the DMU or DSL! */
fa9e4066f08beec538e775443c5be79dd423fcabahrenstypedef void (dsl_prop_changed_cb_t)(void *arg, uint64_t newval);
fa9e4066f08beec538e775443c5be79dd423fcabahrens
fa9e4066f08beec538e775443c5be79dd423fcabahrenstypedef struct dsl_prop_cb_record {
fa9e4066f08beec538e775443c5be79dd423fcabahrens list_node_t cbr_node; /* link on dd_prop_cbs */
99653d4ee642c6528e88224f12409a5f23060994eschrock struct dsl_dataset *cbr_ds;
fa9e4066f08beec538e775443c5be79dd423fcabahrens const char *cbr_propname;
fa9e4066f08beec538e775443c5be79dd423fcabahrens dsl_prop_changed_cb_t *cbr_func;
fa9e4066f08beec538e775443c5be79dd423fcabahrens void *cbr_arg;
fa9e4066f08beec538e775443c5be79dd423fcabahrens} dsl_prop_cb_record_t;
fa9e4066f08beec538e775443c5be79dd423fcabahrens
fa9e4066f08beec538e775443c5be79dd423fcabahrensint dsl_prop_register(struct dsl_dataset *ds, const char *propname,
fa9e4066f08beec538e775443c5be79dd423fcabahrens dsl_prop_changed_cb_t *callback, void *cbarg);
fa9e4066f08beec538e775443c5be79dd423fcabahrensint dsl_prop_unregister(struct dsl_dataset *ds, const char *propname,
fa9e4066f08beec538e775443c5be79dd423fcabahrens dsl_prop_changed_cb_t *callback, void *cbarg);
99653d4ee642c6528e88224f12409a5f23060994eschrockint dsl_prop_numcb(struct dsl_dataset *ds);
fa9e4066f08beec538e775443c5be79dd423fcabahrens
fa9e4066f08beec538e775443c5be79dd423fcabahrensint dsl_prop_get(const char *ddname, const char *propname,
fa9e4066f08beec538e775443c5be79dd423fcabahrens int intsz, int numints, void *buf, char *setpoint);
fa9e4066f08beec538e775443c5be79dd423fcabahrensint dsl_prop_get_integer(const char *ddname, const char *propname,
fa9e4066f08beec538e775443c5be79dd423fcabahrens uint64_t *valuep, char *setpoint);
745cd3c5371d020efae7a911c58c526aa1fd0dbamaybeeint dsl_prop_get_all(objset_t *os, nvlist_t **nvp, boolean_t local);
bb0ade0978a02d3fe0b0165cd4725fdcb593fbfbahrensint dsl_prop_get_ds(struct dsl_dataset *ds, const char *propname,
bb0ade0978a02d3fe0b0165cd4725fdcb593fbfbahrens int intsz, int numints, void *buf, char *setpoint);
bb0ade0978a02d3fe0b0165cd4725fdcb593fbfbahrensint dsl_prop_get_dd(struct dsl_dir *dd, const char *propname,
ecd6cf800b63704be73fb264c3f5b6e0dafc068dmarks int intsz, int numints, void *buf, char *setpoint);
fa9e4066f08beec538e775443c5be79dd423fcabahrens
ea2f5b9e5bf4966630882d6d681a94768aea1d75Matthew Ahrensdsl_syncfunc_t dsl_props_set_sync;
fa9e4066f08beec538e775443c5be79dd423fcabahrensint dsl_prop_set(const char *ddname, const char *propname,
fa9e4066f08beec538e775443c5be79dd423fcabahrens int intsz, int numints, const void *buf);
5c0b6a79c494b543020a5d970d3f10597234672cRich Morrisint dsl_props_set(const char *dsname, nvlist_t *nvl);
a9799022bd90b13722204e80112efaa5bf573099ckvoid dsl_prop_set_uint64_sync(dsl_dir_t *dd, const char *name, uint64_t val,
a9799022bd90b13722204e80112efaa5bf573099ck cred_t *cr, dmu_tx_t *tx);
a2eea2e101e6a163a537dcc6d4e3c4da2a0ea5b2ahrens
a2eea2e101e6a163a537dcc6d4e3c4da2a0ea5b2ahrensvoid dsl_prop_nvlist_add_uint64(nvlist_t *nv, zfs_prop_t prop, uint64_t value);
a2eea2e101e6a163a537dcc6d4e3c4da2a0ea5b2ahrensvoid dsl_prop_nvlist_add_string(nvlist_t *nv,
a2eea2e101e6a163a537dcc6d4e3c4da2a0ea5b2ahrens zfs_prop_t prop, const char *value);
fa9e4066f08beec538e775443c5be79dd423fcabahrens
fa9e4066f08beec538e775443c5be79dd423fcabahrens#ifdef __cplusplus
fa9e4066f08beec538e775443c5be79dd423fcabahrens}
fa9e4066f08beec538e775443c5be79dd423fcabahrens#endif
fa9e4066f08beec538e775443c5be79dd423fcabahrens
fa9e4066f08beec538e775443c5be79dd423fcabahrens#endif /* _SYS_DSL_PROP_H */