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 * Copyright (c) 2012, Joyent, Inc. All rights reserved.
25 */
26
27 #ifndef _SYS_DSL_DATASET_H
28 #define _SYS_DSL_DATASET_H
29
30 #include <sys/dmu.h>
31 #include <sys/spa.h>
32 #include <sys/txg.h>
33 #include <sys/zio.h>
34 #include <sys/bplist.h>
35 #include <sys/dsl_synctask.h>
36 #include <sys/zfs_context.h>
37 #include <sys/dsl_deadlist.h>
38 #include <sys/refcount.h>
39
40 #ifdef __cplusplus
41 extern "C" {
42 #endif
43
44 struct dsl_dataset;
170 #define MAX_TAG_PREFIX_LEN 17
171
172 #define dsl_dataset_is_snapshot(ds) \
173 ((ds)->ds_phys->ds_num_children != 0)
174
175 #define DS_UNIQUE_IS_ACCURATE(ds) \
176 (((ds)->ds_phys->ds_flags & DS_FLAG_UNIQUE_ACCURATE) != 0)
177
178 int dsl_dataset_hold(struct dsl_pool *dp, const char *name, void *tag,
179 dsl_dataset_t **dsp);
180 int dsl_dataset_hold_obj(struct dsl_pool *dp, uint64_t dsobj, void *tag,
181 dsl_dataset_t **);
182 void dsl_dataset_rele(dsl_dataset_t *ds, void *tag);
183 int dsl_dataset_own(struct dsl_pool *dp, const char *name,
184 void *tag, dsl_dataset_t **dsp);
185 int dsl_dataset_own_obj(struct dsl_pool *dp, uint64_t dsobj,
186 void *tag, dsl_dataset_t **dsp);
187 void dsl_dataset_disown(dsl_dataset_t *ds, void *tag);
188 void dsl_dataset_name(dsl_dataset_t *ds, char *name);
189 boolean_t dsl_dataset_tryown(dsl_dataset_t *ds, void *tag);
190 void dsl_register_onexit_hold_cleanup(dsl_dataset_t *ds, const char *htag,
191 minor_t minor);
192 uint64_t dsl_dataset_create_sync(dsl_dir_t *pds, const char *lastname,
193 dsl_dataset_t *origin, uint64_t flags, cred_t *, dmu_tx_t *);
194 uint64_t dsl_dataset_create_sync_dd(dsl_dir_t *dd, dsl_dataset_t *origin,
195 uint64_t flags, dmu_tx_t *tx);
196 int dsl_dataset_snapshot(nvlist_t *snaps, nvlist_t *props, nvlist_t *errors);
197 int dsl_dataset_promote(const char *name, char *conflsnap);
198 int dsl_dataset_clone_swap(dsl_dataset_t *clone, dsl_dataset_t *origin_head,
199 boolean_t force);
200 int dsl_dataset_rename_snapshot(const char *fsname,
201 const char *oldsnapname, const char *newsnapname, boolean_t recursive);
202 int dsl_dataset_snapshot_tmp(const char *fsname, const char *snapname,
203 minor_t cleanup_minor, const char *htag);
204
205 blkptr_t *dsl_dataset_get_blkptr(dsl_dataset_t *ds);
206 void dsl_dataset_set_blkptr(dsl_dataset_t *ds, blkptr_t *bp, dmu_tx_t *tx);
207
208 spa_t *dsl_dataset_get_spa(dsl_dataset_t *ds);
209
210 boolean_t dsl_dataset_modified_since_lastsnap(dsl_dataset_t *ds);
211
|
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 * Copyright (c) 2012, Joyent, Inc. All rights reserved.
25 * Copyright (c) 2013 Steven Hartland. All rights reserved.
26 */
27
28 #ifndef _SYS_DSL_DATASET_H
29 #define _SYS_DSL_DATASET_H
30
31 #include <sys/dmu.h>
32 #include <sys/spa.h>
33 #include <sys/txg.h>
34 #include <sys/zio.h>
35 #include <sys/bplist.h>
36 #include <sys/dsl_synctask.h>
37 #include <sys/zfs_context.h>
38 #include <sys/dsl_deadlist.h>
39 #include <sys/refcount.h>
40
41 #ifdef __cplusplus
42 extern "C" {
43 #endif
44
45 struct dsl_dataset;
171 #define MAX_TAG_PREFIX_LEN 17
172
173 #define dsl_dataset_is_snapshot(ds) \
174 ((ds)->ds_phys->ds_num_children != 0)
175
176 #define DS_UNIQUE_IS_ACCURATE(ds) \
177 (((ds)->ds_phys->ds_flags & DS_FLAG_UNIQUE_ACCURATE) != 0)
178
179 int dsl_dataset_hold(struct dsl_pool *dp, const char *name, void *tag,
180 dsl_dataset_t **dsp);
181 int dsl_dataset_hold_obj(struct dsl_pool *dp, uint64_t dsobj, void *tag,
182 dsl_dataset_t **);
183 void dsl_dataset_rele(dsl_dataset_t *ds, void *tag);
184 int dsl_dataset_own(struct dsl_pool *dp, const char *name,
185 void *tag, dsl_dataset_t **dsp);
186 int dsl_dataset_own_obj(struct dsl_pool *dp, uint64_t dsobj,
187 void *tag, dsl_dataset_t **dsp);
188 void dsl_dataset_disown(dsl_dataset_t *ds, void *tag);
189 void dsl_dataset_name(dsl_dataset_t *ds, char *name);
190 boolean_t dsl_dataset_tryown(dsl_dataset_t *ds, void *tag);
191 uint64_t dsl_dataset_create_sync(dsl_dir_t *pds, const char *lastname,
192 dsl_dataset_t *origin, uint64_t flags, cred_t *, dmu_tx_t *);
193 uint64_t dsl_dataset_create_sync_dd(dsl_dir_t *dd, dsl_dataset_t *origin,
194 uint64_t flags, dmu_tx_t *tx);
195 int dsl_dataset_snapshot(nvlist_t *snaps, nvlist_t *props, nvlist_t *errors);
196 int dsl_dataset_promote(const char *name, char *conflsnap);
197 int dsl_dataset_clone_swap(dsl_dataset_t *clone, dsl_dataset_t *origin_head,
198 boolean_t force);
199 int dsl_dataset_rename_snapshot(const char *fsname,
200 const char *oldsnapname, const char *newsnapname, boolean_t recursive);
201 int dsl_dataset_snapshot_tmp(const char *fsname, const char *snapname,
202 minor_t cleanup_minor, const char *htag);
203
204 blkptr_t *dsl_dataset_get_blkptr(dsl_dataset_t *ds);
205 void dsl_dataset_set_blkptr(dsl_dataset_t *ds, blkptr_t *bp, dmu_tx_t *tx);
206
207 spa_t *dsl_dataset_get_spa(dsl_dataset_t *ds);
208
209 boolean_t dsl_dataset_modified_since_lastsnap(dsl_dataset_t *ds);
210
|