]> git.proxmox.com Git - mirror_zfs.git/blame - include/sys/dsl_prop.h
FreeBSD: Add zfs_link_create() error handling
[mirror_zfs.git] / include / sys / dsl_prop.h
CommitLineData
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
1d3ba0bf 9 * or https://opensource.org/licenses/CDDL-1.0.
34dc7c2f
BB
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.
e2ef1cbf 24 * Copyright 2019 Joyent, Inc.
34dc7c2f
BB
25 */
26
27#ifndef _SYS_DSL_PROP_H
28#define _SYS_DSL_PROP_H
29
34dc7c2f
BB
30#include <sys/dmu.h>
31#include <sys/dsl_pool.h>
32#include <sys/zfs_context.h>
9babb374 33#include <sys/dsl_synctask.h>
34dc7c2f
BB
34
35#ifdef __cplusplus
36extern "C" {
37#endif
38
39struct dsl_dataset;
b128c09f 40struct dsl_dir;
34dc7c2f
BB
41
42/* The callback func may not call into the DMU or DSL! */
43typedef void (dsl_prop_changed_cb_t)(void *arg, uint64_t newval);
44
0eb21616
JG
45typedef struct dsl_prop_record {
46 list_node_t pr_node; /* link on dd_props */
47 const char *pr_propname;
48 list_t pr_cbs;
49} dsl_prop_record_t;
50
34dc7c2f 51typedef struct dsl_prop_cb_record {
0eb21616
JG
52 list_node_t cbr_pr_node; /* link on pr_cbs */
53 list_node_t cbr_ds_node; /* link on ds_prop_cbs */
54 dsl_prop_record_t *cbr_pr;
34dc7c2f 55 struct dsl_dataset *cbr_ds;
34dc7c2f
BB
56 dsl_prop_changed_cb_t *cbr_func;
57 void *cbr_arg;
58} dsl_prop_cb_record_t;
59
428870ff
BB
60typedef struct dsl_props_arg {
61 nvlist_t *pa_props;
62 zprop_source_t pa_source;
63} dsl_props_arg_t;
64
e2ef1cbf
JK
65typedef struct dsl_props_set_arg {
66 const char *dpsa_dsname;
67 zprop_source_t dpsa_source;
68 nvlist_t *dpsa_props;
69} dsl_props_set_arg_t;
70
0eb21616
JG
71void dsl_prop_init(dsl_dir_t *dd);
72void dsl_prop_fini(dsl_dir_t *dd);
34dc7c2f
BB
73int dsl_prop_register(struct dsl_dataset *ds, const char *propname,
74 dsl_prop_changed_cb_t *callback, void *cbarg);
75int dsl_prop_unregister(struct dsl_dataset *ds, const char *propname,
76 dsl_prop_changed_cb_t *callback, void *cbarg);
0eb21616 77void dsl_prop_unregister_all(struct dsl_dataset *ds, void *cbarg);
13fe0198
MA
78void dsl_prop_notify_all(struct dsl_dir *dd);
79boolean_t dsl_prop_hascb(struct dsl_dataset *ds);
34dc7c2f
BB
80
81int dsl_prop_get(const char *ddname, const char *propname,
82 int intsz, int numints, void *buf, char *setpoint);
83int dsl_prop_get_integer(const char *ddname, const char *propname,
84 uint64_t *valuep, char *setpoint);
428870ff 85int dsl_prop_get_all(objset_t *os, nvlist_t **nvp);
13fe0198 86int dsl_prop_get_received(const char *dsname, nvlist_t **nvp);
b128c09f
BB
87int dsl_prop_get_ds(struct dsl_dataset *ds, const char *propname,
88 int intsz, int numints, void *buf, char *setpoint);
13fe0198
MA
89int dsl_prop_get_int_ds(struct dsl_dataset *ds, const char *propname,
90 uint64_t *valuep);
b128c09f 91int dsl_prop_get_dd(struct dsl_dir *dd, const char *propname,
428870ff
BB
92 int intsz, int numints, void *buf, char *setpoint,
93 boolean_t snapshot);
34dc7c2f 94
e2ef1cbf
JK
95int dsl_props_set_check(void *arg, dmu_tx_t *tx);
96void dsl_props_set_sync(void *arg, dmu_tx_t *tx);
13fe0198
MA
97void dsl_props_set_sync_impl(struct dsl_dataset *ds, zprop_source_t source,
98 nvlist_t *props, dmu_tx_t *tx);
99void dsl_prop_set_sync_impl(struct dsl_dataset *ds, const char *propname,
100 zprop_source_t source, int intsz, int numints, const void *value,
101 dmu_tx_t *tx);
428870ff 102int dsl_props_set(const char *dsname, zprop_source_t source, nvlist_t *nvl);
13fe0198
MA
103int dsl_prop_set_int(const char *dsname, const char *propname,
104 zprop_source_t source, uint64_t value);
105int dsl_prop_set_string(const char *dsname, const char *propname,
106 zprop_source_t source, const char *value);
107int dsl_prop_inherit(const char *dsname, const char *propname,
108 zprop_source_t source);
428870ff 109
13fe0198
MA
110int dsl_prop_predict(dsl_dir_t *dd, const char *propname,
111 zprop_source_t source, uint64_t value, uint64_t *newvalp);
428870ff
BB
112
113/* flag first receive on or after SPA_VERSION_RECVD_PROPS */
13fe0198
MA
114boolean_t dsl_prop_get_hasrecvd(const char *dsname);
115int dsl_prop_set_hasrecvd(const char *dsname);
116void dsl_prop_unset_hasrecvd(const char *dsname);
34dc7c2f
BB
117
118void dsl_prop_nvlist_add_uint64(nvlist_t *nv, zfs_prop_t prop, uint64_t value);
119void dsl_prop_nvlist_add_string(nvlist_t *nv,
120 zfs_prop_t prop, const char *value);
121
122#ifdef __cplusplus
123}
124#endif
125
126#endif /* _SYS_DSL_PROP_H */