xref: /illumos-gate/usr/src/uts/common/fs/zfs/sys/dsl_prop.h (revision 4bc0a2ef)
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, Version 1.0 only
6  * (the "License").  You may not use this file except in compliance
7  * with the License.
8  *
9  * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
10  * or http://www.opensolaris.org/os/licensing.
11  * See the License for the specific language governing permissions
12  * and limitations under the License.
13  *
14  * When distributing Covered Code, include this CDDL HEADER in each
15  * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
16  * If applicable, add the following below this CDDL HEADER, with the
17  * fields enclosed by brackets "[]" replaced with your own identifying
18  * information: Portions Copyright [yyyy] [name of copyright owner]
19  *
20  * CDDL HEADER END
21  */
22 /*
23  * Copyright 2005 Sun Microsystems, Inc.  All rights reserved.
24  * Use is subject to license terms.
25  */
26 
27 #ifndef	_SYS_DSL_PROP_H
28 #define	_SYS_DSL_PROP_H
29 
30 #pragma ident	"%Z%%M%	%I%	%E% SMI"
31 
32 #include <sys/dmu.h>
33 #include <sys/dsl_pool.h>
34 #include <sys/zfs_context.h>
35 
36 #ifdef	__cplusplus
37 extern "C" {
38 #endif
39 
40 struct dsl_dataset;
41 
42 /* The callback func may not call into the DMU or DSL! */
43 typedef void (dsl_prop_changed_cb_t)(void *arg, uint64_t newval);
44 
45 #define	DSL_PROP_VALUE_UNDEFINED (-1ULL)
46 
47 typedef struct dsl_prop_cb_record {
48 	list_node_t cbr_node; /* link on dd_prop_cbs */
49 	const char *cbr_propname;
50 	dsl_prop_changed_cb_t *cbr_func;
51 	void *cbr_arg;
52 } dsl_prop_cb_record_t;
53 
54 int dsl_prop_register(struct dsl_dataset *ds, const char *propname,
55     dsl_prop_changed_cb_t *callback, void *cbarg);
56 int dsl_prop_unregister(struct dsl_dataset *ds, const char *propname,
57     dsl_prop_changed_cb_t *callback, void *cbarg);
58 
59 int dsl_prop_get(const char *ddname, const char *propname,
60     int intsz, int numints, void *buf, char *setpoint);
61 int dsl_prop_get_string(const char *ddname, const char *propname,
62     char *value, int valuelen, char *setpoint);
63 int dsl_prop_get_integer(const char *ddname, const char *propname,
64     uint64_t *valuep, char *setpoint);
65 int dsl_prop_get_ds_integer(dsl_dir_t *dd, const char *propname,
66     uint64_t *valuep, char *setpoint);
67 
68 int dsl_prop_set(const char *ddname, const char *propname,
69     int intsz, int numints, const void *buf);
70 
71 #ifdef	__cplusplus
72 }
73 #endif
74 
75 #endif	/* _SYS_DSL_PROP_H */
76