xref: /illumos-gate/usr/src/uts/common/fs/zfs/sys/dmu_recv.h (revision 85f4cb87104c72587029a6e0f1663332c85ba118)
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
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 /*
23  * Copyright (c) 2005, 2010, Oracle and/or its affiliates. All rights reserved.
24  * Copyright (c) 2012, 2014 by Delphix. All rights reserved.
25  * Copyright 2011 Nexenta Systems, Inc. All rights reserved.
26  * Copyright (c) 2013, Joyent, Inc. All rights reserved.
27  * Copyright (c) 2014 Integros [integros.com]
28  */
29 
30 #ifndef _DMU_RECV_H
31 #define	_DMU_RECV_H
32 
33 #include <sys/inttypes.h>
34 #include <sys/dsl_crypt.h>
35 #include <sys/spa.h>
36 
37 extern const char *recv_clone_name;
38 
39 typedef struct dmu_recv_cookie {
40 	struct dsl_dataset *drc_ds;
41 	struct dmu_replay_record *drc_drr_begin;
42 	struct drr_begin *drc_drrb;
43 	const char *drc_tofs;
44 	const char *drc_tosnap;
45 	boolean_t drc_newfs;
46 	boolean_t drc_byteswap;
47 	boolean_t drc_force;
48 	boolean_t drc_resumable;
49 	boolean_t drc_raw;
50 	boolean_t drc_clone;
51 	boolean_t drc_spill;
52 	struct avl_tree *drc_guid_to_ds_map;
53 	nvlist_t *drc_keynvl;
54 	zio_cksum_t drc_cksum;
55 	uint64_t drc_fromsnapobj;
56 	uint64_t drc_newsnapobj;
57 	uint64_t drc_ivset_guid;
58 	void *drc_owner;
59 	cred_t *drc_cred;
60 } dmu_recv_cookie_t;
61 
62 int dmu_recv_begin(char *tofs, char *tosnap,
63     struct dmu_replay_record *drr_begin, boolean_t force, boolean_t resumable,
64     nvlist_t *localprops, nvlist_t *hidden_args, char *origin,
65     dmu_recv_cookie_t *drc);
66 int dmu_recv_stream(dmu_recv_cookie_t *drc, struct vnode *vp, offset_t *voffp,
67     int cleanup_fd, uint64_t *action_handlep);
68 int dmu_recv_end(dmu_recv_cookie_t *drc, void *owner);
69 boolean_t dmu_objset_is_receiving(objset_t *os);
70 
71 #endif /* _DMU_RECV_H */
72