178f17100SMatthew Ahrens /*
278f17100SMatthew Ahrens  * CDDL HEADER START
378f17100SMatthew Ahrens  *
478f17100SMatthew Ahrens  * This file and its contents are supplied under the terms of the
578f17100SMatthew Ahrens  * Common Development and Distribution License ("CDDL"), version 1.0.
678f17100SMatthew Ahrens  * You may only use this file in accordance with the terms of version
778f17100SMatthew Ahrens  * 1.0 of the CDDL.
878f17100SMatthew Ahrens  *
978f17100SMatthew Ahrens  * A full copy of the text of the CDDL should have accompanied this
1078f17100SMatthew Ahrens  * source.  A copy of the CDDL is also available via the Internet at
1178f17100SMatthew Ahrens  * http://www.illumos.org/license/CDDL.
1278f17100SMatthew Ahrens  *
1378f17100SMatthew Ahrens  * CDDL HEADER END
1478f17100SMatthew Ahrens  */
1578f17100SMatthew Ahrens /*
1678f17100SMatthew Ahrens  * Copyright (c) 2013 by Delphix. All rights reserved.
1778f17100SMatthew Ahrens  */
1878f17100SMatthew Ahrens 
1978f17100SMatthew Ahrens #ifndef	_SYS_DSL_BOOKMARK_H
2078f17100SMatthew Ahrens #define	_SYS_DSL_BOOKMARK_H
2178f17100SMatthew Ahrens 
2278f17100SMatthew Ahrens #include <sys/zfs_context.h>
230fa1b3ccSPaul Dagnelie #include <sys/dsl_dataset.h>
2478f17100SMatthew Ahrens 
2578f17100SMatthew Ahrens #ifdef	__cplusplus
2678f17100SMatthew Ahrens extern "C" {
2778f17100SMatthew Ahrens #endif
2878f17100SMatthew Ahrens 
2978f17100SMatthew Ahrens struct dsl_pool;
3078f17100SMatthew Ahrens struct dsl_dataset;
3178f17100SMatthew Ahrens 
3278f17100SMatthew Ahrens /*
3378f17100SMatthew Ahrens  * On disk zap object.
3478f17100SMatthew Ahrens  */
3578f17100SMatthew Ahrens typedef struct zfs_bookmark_phys {
3678f17100SMatthew Ahrens 	uint64_t zbm_guid;		/* guid of bookmarked dataset */
3778f17100SMatthew Ahrens 	uint64_t zbm_creation_txg;	/* birth transaction group */
3878f17100SMatthew Ahrens 	uint64_t zbm_creation_time;	/* bookmark creation time */
39*eb633035STom Caputi 
40*eb633035STom Caputi 	/* the following fields are reserved for redacted send / recv */
41*eb633035STom Caputi 	uint64_t zbm_redaction_obj;	/* redaction list object */
42*eb633035STom Caputi 	uint64_t zbm_flags;		/* ZBM_FLAG_* */
43*eb633035STom Caputi 	uint64_t zbm_referenced_bytes_refd;
44*eb633035STom Caputi 	uint64_t zbm_compressed_bytes_refd;
45*eb633035STom Caputi 	uint64_t zbm_uncompressed_bytes_refd;
46*eb633035STom Caputi 	uint64_t zbm_referenced_freed_before_next_snap;
47*eb633035STom Caputi 	uint64_t zbm_compressed_freed_before_next_snap;
48*eb633035STom Caputi 	uint64_t zbm_uncompressed_freed_before_next_snap;
49*eb633035STom Caputi 
50*eb633035STom Caputi 	/* fields used for raw sends */
51*eb633035STom Caputi 	uint64_t zbm_ivset_guid;
5278f17100SMatthew Ahrens } zfs_bookmark_phys_t;
5378f17100SMatthew Ahrens 
54*eb633035STom Caputi 
55*eb633035STom Caputi #define	BOOKMARK_PHYS_SIZE_V1	(3 * sizeof (uint64_t))
56*eb633035STom Caputi #define	BOOKMARK_PHYS_SIZE_V2	(12 * sizeof (uint64_t))
57*eb633035STom Caputi 
5878f17100SMatthew Ahrens int dsl_bookmark_create(nvlist_t *, nvlist_t *);
5978f17100SMatthew Ahrens int dsl_get_bookmarks(const char *, nvlist_t *, nvlist_t *);
6078f17100SMatthew Ahrens int dsl_get_bookmarks_impl(dsl_dataset_t *, nvlist_t *, nvlist_t *);
6178f17100SMatthew Ahrens int dsl_bookmark_destroy(nvlist_t *, nvlist_t *);
6278f17100SMatthew Ahrens int dsl_bookmark_lookup(struct dsl_pool *, const char *,
6378f17100SMatthew Ahrens     struct dsl_dataset *, zfs_bookmark_phys_t *);
6478f17100SMatthew Ahrens 
6578f17100SMatthew Ahrens #ifdef	__cplusplus
6678f17100SMatthew Ahrens }
6778f17100SMatthew Ahrens #endif
6878f17100SMatthew Ahrens 
6978f17100SMatthew Ahrens #endif /* _SYS_DSL_BOOKMARK_H */
70