]>
Commit | Line | Data |
---|---|---|
34dc7c2f BB |
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 | /* | |
428870ff | 22 | * Copyright (c) 2005, 2010, Oracle and/or its affiliates. All rights reserved. |
6f1ffb06 | 23 | * Copyright (c) 2012 by Delphix. All rights reserved. |
34dc7c2f BB |
24 | */ |
25 | ||
26 | #ifndef _SYS_DSL_PROP_H | |
27 | #define _SYS_DSL_PROP_H | |
28 | ||
34dc7c2f BB |
29 | #include <sys/dmu.h> |
30 | #include <sys/dsl_pool.h> | |
31 | #include <sys/zfs_context.h> | |
9babb374 | 32 | #include <sys/dsl_synctask.h> |
34dc7c2f BB |
33 | |
34 | #ifdef __cplusplus | |
35 | extern "C" { | |
36 | #endif | |
37 | ||
38 | struct dsl_dataset; | |
b128c09f | 39 | struct dsl_dir; |
34dc7c2f BB |
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 | ||
0eb21616 JG |
44 | typedef struct dsl_prop_record { |
45 | list_node_t pr_node; /* link on dd_props */ | |
46 | const char *pr_propname; | |
47 | list_t pr_cbs; | |
48 | } dsl_prop_record_t; | |
49 | ||
34dc7c2f | 50 | typedef struct dsl_prop_cb_record { |
0eb21616 JG |
51 | list_node_t cbr_pr_node; /* link on pr_cbs */ |
52 | list_node_t cbr_ds_node; /* link on ds_prop_cbs */ | |
53 | dsl_prop_record_t *cbr_pr; | |
34dc7c2f | 54 | struct dsl_dataset *cbr_ds; |
34dc7c2f BB |
55 | dsl_prop_changed_cb_t *cbr_func; |
56 | void *cbr_arg; | |
57 | } dsl_prop_cb_record_t; | |
58 | ||
428870ff BB |
59 | typedef struct dsl_props_arg { |
60 | nvlist_t *pa_props; | |
61 | zprop_source_t pa_source; | |
62 | } dsl_props_arg_t; | |
63 | ||
0eb21616 JG |
64 | void dsl_prop_init(dsl_dir_t *dd); |
65 | void dsl_prop_fini(dsl_dir_t *dd); | |
34dc7c2f BB |
66 | int dsl_prop_register(struct dsl_dataset *ds, const char *propname, |
67 | dsl_prop_changed_cb_t *callback, void *cbarg); | |
68 | int dsl_prop_unregister(struct dsl_dataset *ds, const char *propname, | |
69 | dsl_prop_changed_cb_t *callback, void *cbarg); | |
0eb21616 | 70 | void dsl_prop_unregister_all(struct dsl_dataset *ds, void *cbarg); |
13fe0198 MA |
71 | void dsl_prop_notify_all(struct dsl_dir *dd); |
72 | boolean_t dsl_prop_hascb(struct dsl_dataset *ds); | |
34dc7c2f BB |
73 | |
74 | int dsl_prop_get(const char *ddname, const char *propname, | |
75 | int intsz, int numints, void *buf, char *setpoint); | |
76 | int dsl_prop_get_integer(const char *ddname, const char *propname, | |
77 | uint64_t *valuep, char *setpoint); | |
428870ff | 78 | int dsl_prop_get_all(objset_t *os, nvlist_t **nvp); |
13fe0198 | 79 | int dsl_prop_get_received(const char *dsname, nvlist_t **nvp); |
b128c09f BB |
80 | int dsl_prop_get_ds(struct dsl_dataset *ds, const char *propname, |
81 | int intsz, int numints, void *buf, char *setpoint); | |
13fe0198 MA |
82 | int dsl_prop_get_int_ds(struct dsl_dataset *ds, const char *propname, |
83 | uint64_t *valuep); | |
b128c09f | 84 | int dsl_prop_get_dd(struct dsl_dir *dd, const char *propname, |
428870ff BB |
85 | int intsz, int numints, void *buf, char *setpoint, |
86 | boolean_t snapshot); | |
34dc7c2f | 87 | |
13fe0198 MA |
88 | void dsl_props_set_sync_impl(struct dsl_dataset *ds, zprop_source_t source, |
89 | nvlist_t *props, dmu_tx_t *tx); | |
90 | void dsl_prop_set_sync_impl(struct dsl_dataset *ds, const char *propname, | |
91 | zprop_source_t source, int intsz, int numints, const void *value, | |
92 | dmu_tx_t *tx); | |
428870ff | 93 | int dsl_props_set(const char *dsname, zprop_source_t source, nvlist_t *nvl); |
13fe0198 MA |
94 | int dsl_prop_set_int(const char *dsname, const char *propname, |
95 | zprop_source_t source, uint64_t value); | |
96 | int dsl_prop_set_string(const char *dsname, const char *propname, | |
97 | zprop_source_t source, const char *value); | |
98 | int dsl_prop_inherit(const char *dsname, const char *propname, | |
99 | zprop_source_t source); | |
428870ff | 100 | |
13fe0198 MA |
101 | int dsl_prop_predict(dsl_dir_t *dd, const char *propname, |
102 | zprop_source_t source, uint64_t value, uint64_t *newvalp); | |
428870ff BB |
103 | |
104 | /* flag first receive on or after SPA_VERSION_RECVD_PROPS */ | |
13fe0198 MA |
105 | boolean_t dsl_prop_get_hasrecvd(const char *dsname); |
106 | int dsl_prop_set_hasrecvd(const char *dsname); | |
107 | void dsl_prop_unset_hasrecvd(const char *dsname); | |
34dc7c2f BB |
108 | |
109 | void dsl_prop_nvlist_add_uint64(nvlist_t *nv, zfs_prop_t prop, uint64_t value); | |
110 | void dsl_prop_nvlist_add_string(nvlist_t *nv, | |
111 | zfs_prop_t prop, const char *value); | |
112 | ||
113 | #ifdef __cplusplus | |
114 | } | |
115 | #endif | |
116 | ||
117 | #endif /* _SYS_DSL_PROP_H */ |