]> git.proxmox.com Git - mirror_zfs-debian.git/blob - include/sys/dsl_prop.h
Imported Upstream version 0.6.5.3
[mirror_zfs-debian.git] / include / sys / dsl_prop.h
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 (the "License").
6 * You may not use this file except in compliance with the License.
7 *
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.
12 *
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]
18 *
19 * CDDL HEADER END
20 */
21 /*
22 * Copyright (c) 2005, 2010, Oracle and/or its affiliates. All rights reserved.
23 * Copyright (c) 2012 by Delphix. All rights reserved.
24 */
25
26 #ifndef _SYS_DSL_PROP_H
27 #define _SYS_DSL_PROP_H
28
29 #include <sys/dmu.h>
30 #include <sys/dsl_pool.h>
31 #include <sys/zfs_context.h>
32 #include <sys/dsl_synctask.h>
33
34 #ifdef __cplusplus
35 extern "C" {
36 #endif
37
38 struct dsl_dataset;
39 struct dsl_dir;
40
41 /* The callback func may not call into the DMU or DSL! */
42 typedef void (dsl_prop_changed_cb_t)(void *arg, uint64_t newval);
43
44 typedef struct dsl_prop_cb_record {
45 list_node_t cbr_node; /* link on dd_prop_cbs */
46 struct dsl_dataset *cbr_ds;
47 const char *cbr_propname;
48 dsl_prop_changed_cb_t *cbr_func;
49 void *cbr_arg;
50 } dsl_prop_cb_record_t;
51
52 typedef struct dsl_props_arg {
53 nvlist_t *pa_props;
54 zprop_source_t pa_source;
55 } dsl_props_arg_t;
56
57 int dsl_prop_register(struct dsl_dataset *ds, const char *propname,
58 dsl_prop_changed_cb_t *callback, void *cbarg);
59 int dsl_prop_unregister(struct dsl_dataset *ds, const char *propname,
60 dsl_prop_changed_cb_t *callback, void *cbarg);
61 void dsl_prop_notify_all(struct dsl_dir *dd);
62 boolean_t dsl_prop_hascb(struct dsl_dataset *ds);
63
64 int dsl_prop_get(const char *ddname, const char *propname,
65 int intsz, int numints, void *buf, char *setpoint);
66 int dsl_prop_get_integer(const char *ddname, const char *propname,
67 uint64_t *valuep, char *setpoint);
68 int dsl_prop_get_all(objset_t *os, nvlist_t **nvp);
69 int dsl_prop_get_received(const char *dsname, nvlist_t **nvp);
70 int dsl_prop_get_ds(struct dsl_dataset *ds, const char *propname,
71 int intsz, int numints, void *buf, char *setpoint);
72 int dsl_prop_get_int_ds(struct dsl_dataset *ds, const char *propname,
73 uint64_t *valuep);
74 int dsl_prop_get_dd(struct dsl_dir *dd, const char *propname,
75 int intsz, int numints, void *buf, char *setpoint,
76 boolean_t snapshot);
77
78 void dsl_props_set_sync_impl(struct dsl_dataset *ds, zprop_source_t source,
79 nvlist_t *props, dmu_tx_t *tx);
80 void dsl_prop_set_sync_impl(struct dsl_dataset *ds, const char *propname,
81 zprop_source_t source, int intsz, int numints, const void *value,
82 dmu_tx_t *tx);
83 int dsl_props_set(const char *dsname, zprop_source_t source, nvlist_t *nvl);
84 int dsl_prop_set_int(const char *dsname, const char *propname,
85 zprop_source_t source, uint64_t value);
86 int dsl_prop_set_string(const char *dsname, const char *propname,
87 zprop_source_t source, const char *value);
88 int dsl_prop_inherit(const char *dsname, const char *propname,
89 zprop_source_t source);
90
91 int dsl_prop_predict(dsl_dir_t *dd, const char *propname,
92 zprop_source_t source, uint64_t value, uint64_t *newvalp);
93
94 /* flag first receive on or after SPA_VERSION_RECVD_PROPS */
95 boolean_t dsl_prop_get_hasrecvd(const char *dsname);
96 int dsl_prop_set_hasrecvd(const char *dsname);
97 void dsl_prop_unset_hasrecvd(const char *dsname);
98
99 void dsl_prop_nvlist_add_uint64(nvlist_t *nv, zfs_prop_t prop, uint64_t value);
100 void dsl_prop_nvlist_add_string(nvlist_t *nv,
101 zfs_prop_t prop, const char *value);
102
103 #ifdef __cplusplus
104 }
105 #endif
106
107 #endif /* _SYS_DSL_PROP_H */