xref: /illumos-gate/usr/src/uts/common/fs/zfs/sys/dsl_bookmark.h (revision eb633035c80613ec93d62f90482837adaaf21a0a)
1 /*
2  * CDDL HEADER START
3  *
4  * This file and its contents are supplied under the terms of the
5  * Common Development and Distribution License ("CDDL"), version 1.0.
6  * You may only use this file in accordance with the terms of version
7  * 1.0 of the CDDL.
8  *
9  * A full copy of the text of the CDDL should have accompanied this
10  * source.  A copy of the CDDL is also available via the Internet at
11  * http://www.illumos.org/license/CDDL.
12  *
13  * CDDL HEADER END
14  */
15 /*
16  * Copyright (c) 2013 by Delphix. All rights reserved.
17  */
18 
19 #ifndef	_SYS_DSL_BOOKMARK_H
20 #define	_SYS_DSL_BOOKMARK_H
21 
22 #include <sys/zfs_context.h>
23 #include <sys/dsl_dataset.h>
24 
25 #ifdef	__cplusplus
26 extern "C" {
27 #endif
28 
29 struct dsl_pool;
30 struct dsl_dataset;
31 
32 /*
33  * On disk zap object.
34  */
35 typedef struct zfs_bookmark_phys {
36 	uint64_t zbm_guid;		/* guid of bookmarked dataset */
37 	uint64_t zbm_creation_txg;	/* birth transaction group */
38 	uint64_t zbm_creation_time;	/* bookmark creation time */
39 
40 	/* the following fields are reserved for redacted send / recv */
41 	uint64_t zbm_redaction_obj;	/* redaction list object */
42 	uint64_t zbm_flags;		/* ZBM_FLAG_* */
43 	uint64_t zbm_referenced_bytes_refd;
44 	uint64_t zbm_compressed_bytes_refd;
45 	uint64_t zbm_uncompressed_bytes_refd;
46 	uint64_t zbm_referenced_freed_before_next_snap;
47 	uint64_t zbm_compressed_freed_before_next_snap;
48 	uint64_t zbm_uncompressed_freed_before_next_snap;
49 
50 	/* fields used for raw sends */
51 	uint64_t zbm_ivset_guid;
52 } zfs_bookmark_phys_t;
53 
54 
55 #define	BOOKMARK_PHYS_SIZE_V1	(3 * sizeof (uint64_t))
56 #define	BOOKMARK_PHYS_SIZE_V2	(12 * sizeof (uint64_t))
57 
58 int dsl_bookmark_create(nvlist_t *, nvlist_t *);
59 int dsl_get_bookmarks(const char *, nvlist_t *, nvlist_t *);
60 int dsl_get_bookmarks_impl(dsl_dataset_t *, nvlist_t *, nvlist_t *);
61 int dsl_bookmark_destroy(nvlist_t *, nvlist_t *);
62 int dsl_bookmark_lookup(struct dsl_pool *, const char *,
63     struct dsl_dataset *, zfs_bookmark_phys_t *);
64 
65 #ifdef	__cplusplus
66 }
67 #endif
68 
69 #endif /* _SYS_DSL_BOOKMARK_H */
70