FreeBSD ZFS
The Zettabyte File System

sys/dsl_prop.h

Go to the documentation of this file.
00001 /*
00002  * CDDL HEADER START
00003  *
00004  * The contents of this file are subject to the terms of the
00005  * Common Development and Distribution License (the "License").
00006  * You may not use this file except in compliance with the License.
00007  *
00008  * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
00009  * or http://www.opensolaris.org/os/licensing.
00010  * See the License for the specific language governing permissions
00011  * and limitations under the License.
00012  *
00013  * When distributing Covered Code, include this CDDL HEADER in each
00014  * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
00015  * If applicable, add the following below this CDDL HEADER, with the
00016  * fields enclosed by brackets "[]" replaced with your own identifying
00017  * information: Portions Copyright [yyyy] [name of copyright owner]
00018  *
00019  * CDDL HEADER END
00020  */
00021 /*
00022  * Copyright (c) 2005, 2010, Oracle and/or its affiliates. All rights reserved.
00023  */
00024 
00025 #ifndef _SYS_DSL_PROP_H
00026 #define _SYS_DSL_PROP_H
00027 
00028 #include <sys/dmu.h>
00029 #include <sys/dsl_pool.h>
00030 #include <sys/zfs_context.h>
00031 #include <sys/dsl_synctask.h>
00032 
00033 #ifdef  __cplusplus
00034 extern "C" {
00035 #endif
00036 
00037 struct dsl_dataset;
00038 struct dsl_dir;
00039 
00041 typedef void (dsl_prop_changed_cb_t)(void *arg, uint64_t newval);
00042 
00043 typedef struct dsl_prop_cb_record {
00044         list_node_t cbr_node; 
00045         struct dsl_dataset *cbr_ds;
00046         const char *cbr_propname;
00047         dsl_prop_changed_cb_t *cbr_func;
00048         void *cbr_arg;
00049 } dsl_prop_cb_record_t;
00050 
00051 typedef struct dsl_props_arg {
00052         nvlist_t *pa_props;
00053         zprop_source_t pa_source;
00054 } dsl_props_arg_t;
00055 
00056 typedef struct dsl_prop_set_arg {
00057         const char *psa_name;
00058         zprop_source_t psa_source;
00059         int psa_intsz;
00060         int psa_numints;
00061         const void *psa_value;
00062 
00067         uint64_t psa_effective_value;
00068 } dsl_prop_setarg_t;
00069 
00070 int dsl_prop_register(struct dsl_dataset *ds, const char *propname,
00071     dsl_prop_changed_cb_t *callback, void *cbarg);
00072 int dsl_prop_unregister(struct dsl_dataset *ds, const char *propname,
00073     dsl_prop_changed_cb_t *callback, void *cbarg);
00074 int dsl_prop_numcb(struct dsl_dataset *ds);
00075 
00076 int dsl_prop_get(const char *ddname, const char *propname,
00077     int intsz, int numints, void *buf, char *setpoint);
00078 int dsl_prop_get_integer(const char *ddname, const char *propname,
00079     uint64_t *valuep, char *setpoint);
00080 int dsl_prop_get_all(objset_t *os, nvlist_t **nvp);
00081 int dsl_prop_get_received(objset_t *os, nvlist_t **nvp);
00082 int dsl_prop_get_ds(struct dsl_dataset *ds, const char *propname,
00083     int intsz, int numints, void *buf, char *setpoint);
00084 int dsl_prop_get_dd(struct dsl_dir *dd, const char *propname,
00085     int intsz, int numints, void *buf, char *setpoint,
00086     boolean_t snapshot);
00087 
00088 dsl_syncfunc_t dsl_props_set_sync;
00089 int dsl_prop_set(const char *ddname, const char *propname,
00090     zprop_source_t source, int intsz, int numints, const void *buf);
00091 int dsl_props_set(const char *dsname, zprop_source_t source, nvlist_t *nvl);
00092 void dsl_dir_prop_set_uint64_sync(dsl_dir_t *dd, const char *name, uint64_t val,
00093     dmu_tx_t *tx);
00094 
00095 void dsl_prop_setarg_init_uint64(dsl_prop_setarg_t *psa, const char *propname,
00096     zprop_source_t source, uint64_t *value);
00097 int dsl_prop_predict_sync(dsl_dir_t *dd, dsl_prop_setarg_t *psa);
00098 #ifdef  ZFS_DEBUG
00099 void dsl_prop_check_prediction(dsl_dir_t *dd, dsl_prop_setarg_t *psa);
00100 #define DSL_PROP_CHECK_PREDICTION(dd, psa)      \
00101         dsl_prop_check_prediction((dd), (psa))
00102 #else
00103 #define DSL_PROP_CHECK_PREDICTION(dd, psa)      /* nothing */
00104 #endif
00105 
00106 /* flag first receive on or after SPA_VERSION_RECVD_PROPS */
00107 boolean_t dsl_prop_get_hasrecvd(objset_t *os);
00108 void dsl_prop_set_hasrecvd(objset_t *os);
00109 void dsl_prop_unset_hasrecvd(objset_t *os);
00110 
00111 void dsl_prop_nvlist_add_uint64(nvlist_t *nv, zfs_prop_t prop, uint64_t value);
00112 void dsl_prop_nvlist_add_string(nvlist_t *nv,
00113     zfs_prop_t prop, const char *value);
00114 
00115 #ifdef  __cplusplus
00116 }
00117 #endif
00118 
00119 #endif  /* _SYS_DSL_PROP_H */
 All Data Structures Files Functions Variables Typedefs Enumerations Enumerator Defines