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.
8 * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
9 * or http://www.opensolaris.org/os/licensing.
10 * See the License for the specific language governing permissions
11 * and limitations under the License.
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]
22 * Copyright (c) 2005, 2010, Oracle and/or its affiliates. All rights reserved.
25 #ifndef _SYS_DSL_PROP_H
26 #define _SYS_DSL_PROP_H
29 #include <sys/dsl_pool.h>
30 #include <sys/zfs_context.h>
31 #include <sys/dsl_synctask.h>
40 /* The callback func may not call into the DMU or DSL! */
41 typedef void (dsl_prop_changed_cb_t
)(void *arg
, uint64_t newval
);
43 typedef struct dsl_prop_cb_record
{
44 list_node_t cbr_node
; /* link on dd_prop_cbs */
45 struct dsl_dataset
*cbr_ds
;
46 const char *cbr_propname
;
47 dsl_prop_changed_cb_t
*cbr_func
;
49 } dsl_prop_cb_record_t
;
51 typedef struct dsl_props_arg
{
53 zprop_source_t pa_source
;
56 typedef struct dsl_prop_set_arg
{
58 zprop_source_t psa_source
;
61 const void *psa_value
;
64 * Used to handle the special requirements of the quota and reservation
67 uint64_t psa_effective_value
;
70 int dsl_prop_register(struct dsl_dataset
*ds
, const char *propname
,
71 dsl_prop_changed_cb_t
*callback
, void *cbarg
);
72 int dsl_prop_unregister(struct dsl_dataset
*ds
, const char *propname
,
73 dsl_prop_changed_cb_t
*callback
, void *cbarg
);
74 int dsl_prop_numcb(struct dsl_dataset
*ds
);
76 int dsl_prop_get(const char *ddname
, const char *propname
,
77 int intsz
, int numints
, void *buf
, char *setpoint
);
78 int dsl_prop_get_integer(const char *ddname
, const char *propname
,
79 uint64_t *valuep
, char *setpoint
);
80 int dsl_prop_get_all(objset_t
*os
, nvlist_t
**nvp
);
81 int dsl_prop_get_received(objset_t
*os
, nvlist_t
**nvp
);
82 int dsl_prop_get_ds(struct dsl_dataset
*ds
, const char *propname
,
83 int intsz
, int numints
, void *buf
, char *setpoint
);
84 int dsl_prop_get_dd(struct dsl_dir
*dd
, const char *propname
,
85 int intsz
, int numints
, void *buf
, char *setpoint
,
88 dsl_syncfunc_t dsl_props_set_sync
;
89 int dsl_prop_set(const char *ddname
, const char *propname
,
90 zprop_source_t source
, int intsz
, int numints
, const void *buf
);
91 int dsl_props_set(const char *dsname
, zprop_source_t source
, nvlist_t
*nvl
);
92 void dsl_dir_prop_set_uint64_sync(dsl_dir_t
*dd
, const char *name
, uint64_t val
,
95 void dsl_prop_setarg_init_uint64(dsl_prop_setarg_t
*psa
, const char *propname
,
96 zprop_source_t source
, uint64_t *value
);
97 int dsl_prop_predict_sync(dsl_dir_t
*dd
, dsl_prop_setarg_t
*psa
);
99 void dsl_prop_check_prediction(dsl_dir_t
*dd
, dsl_prop_setarg_t
*psa
);
100 #define DSL_PROP_CHECK_PREDICTION(dd, psa) \
101 dsl_prop_check_prediction((dd), (psa))
103 #define DSL_PROP_CHECK_PREDICTION(dd, psa) /* nothing */
106 /* flag first receive on or after SPA_VERSION_RECVD_PROPS */
107 boolean_t
dsl_prop_get_hasrecvd(objset_t
*os
);
108 void dsl_prop_set_hasrecvd(objset_t
*os
);
109 void dsl_prop_unset_hasrecvd(objset_t
*os
);
111 void dsl_prop_nvlist_add_uint64(nvlist_t
*nv
, zfs_prop_t prop
, uint64_t value
);
112 void dsl_prop_nvlist_add_string(nvlist_t
*nv
,
113 zfs_prop_t prop
, const char *value
);
119 #endif /* _SYS_DSL_PROP_H */