dmu_send.h revision 276081
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) 2013 by Delphix. All rights reserved.
25 * Copyright 2011 Nexenta Systems, Inc. All rights reserved.
26 * Copyright (c) 2013, Joyent, Inc. All rights reserved.
27 */
28
29#ifndef _DMU_SEND_H
30#define	_DMU_SEND_H
31
32#include <sys/spa.h>
33
34struct vnode;
35struct dsl_dataset;
36struct drr_begin;
37struct avl_tree;
38
39int dmu_send(const char *tosnap, const char *fromsnap,
40    boolean_t embedok, boolean_t large_block_ok,
41#ifdef illumos
42    int outfd, struct vnode *vp, offset_t *off);
43#else
44    int outfd, struct file *fp, offset_t *off);
45#endif
46int dmu_send_estimate(struct dsl_dataset *ds, struct dsl_dataset *fromds,
47    uint64_t *sizep);
48int dmu_send_obj(const char *pool, uint64_t tosnap, uint64_t fromsnap,
49    boolean_t embedok, boolean_t large_block_ok,
50#ifdef illumos
51    int outfd, struct vnode *vp, offset_t *off);
52#else
53    int outfd, struct file *fp, offset_t *off);
54#endif
55
56typedef struct dmu_recv_cookie {
57	struct dsl_dataset *drc_ds;
58	struct drr_begin *drc_drrb;
59	const char *drc_tofs;
60	const char *drc_tosnap;
61	boolean_t drc_newfs;
62	boolean_t drc_byteswap;
63	boolean_t drc_force;
64	struct avl_tree *drc_guid_to_ds_map;
65	zio_cksum_t drc_cksum;
66	uint64_t drc_newsnapobj;
67	void *drc_owner;
68	cred_t *drc_cred;
69} dmu_recv_cookie_t;
70
71int dmu_recv_begin(char *tofs, char *tosnap, struct drr_begin *drrb,
72    boolean_t force, char *origin, dmu_recv_cookie_t *drc);
73#ifdef illumos
74int dmu_recv_stream(dmu_recv_cookie_t *drc, struct vnode *vp, offset_t *voffp,
75#else
76int dmu_recv_stream(dmu_recv_cookie_t *drc, struct file *fp, offset_t *voffp,
77#endif
78    int cleanup_fd, uint64_t *action_handlep);
79int dmu_recv_end(dmu_recv_cookie_t *drc, void *owner);
80boolean_t dmu_objset_is_receiving(objset_t *os);
81
82#endif /* _DMU_SEND_H */
83