3b2aab18808792cbd248a12f1edf139b89833c13Matthew Ahrens/*
3b2aab18808792cbd248a12f1edf139b89833c13Matthew Ahrens * CDDL HEADER START
3b2aab18808792cbd248a12f1edf139b89833c13Matthew Ahrens *
3b2aab18808792cbd248a12f1edf139b89833c13Matthew Ahrens * The contents of this file are subject to the terms of the
3b2aab18808792cbd248a12f1edf139b89833c13Matthew Ahrens * Common Development and Distribution License (the "License").
3b2aab18808792cbd248a12f1edf139b89833c13Matthew Ahrens * You may not use this file except in compliance with the License.
3b2aab18808792cbd248a12f1edf139b89833c13Matthew Ahrens *
3b2aab18808792cbd248a12f1edf139b89833c13Matthew Ahrens * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
3b2aab18808792cbd248a12f1edf139b89833c13Matthew Ahrens * or http://www.opensolaris.org/os/licensing.
3b2aab18808792cbd248a12f1edf139b89833c13Matthew Ahrens * See the License for the specific language governing permissions
3b2aab18808792cbd248a12f1edf139b89833c13Matthew Ahrens * and limitations under the License.
3b2aab18808792cbd248a12f1edf139b89833c13Matthew Ahrens *
3b2aab18808792cbd248a12f1edf139b89833c13Matthew Ahrens * When distributing Covered Code, include this CDDL HEADER in each
3b2aab18808792cbd248a12f1edf139b89833c13Matthew Ahrens * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
3b2aab18808792cbd248a12f1edf139b89833c13Matthew Ahrens * If applicable, add the following below this CDDL HEADER, with the
3b2aab18808792cbd248a12f1edf139b89833c13Matthew Ahrens * fields enclosed by brackets "[]" replaced with your own identifying
3b2aab18808792cbd248a12f1edf139b89833c13Matthew Ahrens * information: Portions Copyright [yyyy] [name of copyright owner]
3b2aab18808792cbd248a12f1edf139b89833c13Matthew Ahrens *
3b2aab18808792cbd248a12f1edf139b89833c13Matthew Ahrens * CDDL HEADER END
3b2aab18808792cbd248a12f1edf139b89833c13Matthew Ahrens */
3b2aab18808792cbd248a12f1edf139b89833c13Matthew Ahrens
3b2aab18808792cbd248a12f1edf139b89833c13Matthew Ahrens/*
3b2aab18808792cbd248a12f1edf139b89833c13Matthew Ahrens * Copyright (c) 2005, 2010, Oracle and/or its affiliates. All rights reserved.
643da460c8ca583e39ce053081754e24087f84c8Max Grossman * Copyright (c) 2012, 2014 by Delphix. All rights reserved.
3b2aab18808792cbd248a12f1edf139b89833c13Matthew Ahrens * Copyright 2011 Nexenta Systems, Inc. All rights reserved.
a2afb611b30628fb74ad9eade4ae465f9031e262Jerry Jelinek * Copyright (c) 2013, Joyent, Inc. All rights reserved.
c3d26abc9ee97b4f60233556aadeb57e0bd30bb9Matthew Ahrens * Copyright (c) 2014 Integros [integros.com]
3b2aab18808792cbd248a12f1edf139b89833c13Matthew Ahrens */
3b2aab18808792cbd248a12f1edf139b89833c13Matthew Ahrens
3b2aab18808792cbd248a12f1edf139b89833c13Matthew Ahrens#ifndef _DMU_SEND_H
3b2aab18808792cbd248a12f1edf139b89833c13Matthew Ahrens#define _DMU_SEND_H
3b2aab18808792cbd248a12f1edf139b89833c13Matthew Ahrens
3b2aab18808792cbd248a12f1edf139b89833c13Matthew Ahrens#include <sys/inttypes.h>
3b2aab18808792cbd248a12f1edf139b89833c13Matthew Ahrens#include <sys/spa.h>
3b2aab18808792cbd248a12f1edf139b89833c13Matthew Ahrens
3b2aab18808792cbd248a12f1edf139b89833c13Matthew Ahrensstruct vnode;
3b2aab18808792cbd248a12f1edf139b89833c13Matthew Ahrensstruct dsl_dataset;
3b2aab18808792cbd248a12f1edf139b89833c13Matthew Ahrensstruct drr_begin;
3b2aab18808792cbd248a12f1edf139b89833c13Matthew Ahrensstruct avl_tree;
9c3fd1216fa7fb02cfbc78a2518a686d54b48ab8Matthew Ahrensstruct dmu_replay_record;
3b2aab18808792cbd248a12f1edf139b89833c13Matthew Ahrens
9c3fd1216fa7fb02cfbc78a2518a686d54b48ab8Matthew Ahrensextern const char *recv_clone_name;
9c3fd1216fa7fb02cfbc78a2518a686d54b48ab8Matthew Ahrens
9c3fd1216fa7fb02cfbc78a2518a686d54b48ab8Matthew Ahrensint dmu_send(const char *tosnap, const char *fromsnap, boolean_t embedok,
5602294fda888d923d57a78bafdaf48ae6223deaDan Kimmel boolean_t large_block_ok, boolean_t compressok, int outfd,
5602294fda888d923d57a78bafdaf48ae6223deaDan Kimmel uint64_t resumeobj, uint64_t resumeoff,
9c3fd1216fa7fb02cfbc78a2518a686d54b48ab8Matthew Ahrens struct vnode *vp, offset_t *off);
3b2aab18808792cbd248a12f1edf139b89833c13Matthew Ahrensint dmu_send_estimate(struct dsl_dataset *ds, struct dsl_dataset *fromds,
5602294fda888d923d57a78bafdaf48ae6223deaDan Kimmel boolean_t stream_compressed, uint64_t *sizep);
643da460c8ca583e39ce053081754e24087f84c8Max Grossmanint dmu_send_estimate_from_txg(struct dsl_dataset *ds, uint64_t fromtxg,
5602294fda888d923d57a78bafdaf48ae6223deaDan Kimmel boolean_t stream_compressed, uint64_t *sizep);
3b2aab18808792cbd248a12f1edf139b89833c13Matthew Ahrensint dmu_send_obj(const char *pool, uint64_t tosnap, uint64_t fromsnap,
5602294fda888d923d57a78bafdaf48ae6223deaDan Kimmel boolean_t embedok, boolean_t large_block_ok, boolean_t compressok,
b515258426fed6c7311fd3f1dea697cfbd4085c6Matthew Ahrens int outfd, struct vnode *vp, offset_t *off);
3b2aab18808792cbd248a12f1edf139b89833c13Matthew Ahrens
3b2aab18808792cbd248a12f1edf139b89833c13Matthew Ahrenstypedef struct dmu_recv_cookie {
3b2aab18808792cbd248a12f1edf139b89833c13Matthew Ahrens struct dsl_dataset *drc_ds;
9c3fd1216fa7fb02cfbc78a2518a686d54b48ab8Matthew Ahrens struct dmu_replay_record *drc_drr_begin;
3b2aab18808792cbd248a12f1edf139b89833c13Matthew Ahrens struct drr_begin *drc_drrb;
3b2aab18808792cbd248a12f1edf139b89833c13Matthew Ahrens const char *drc_tofs;
3b2aab18808792cbd248a12f1edf139b89833c13Matthew Ahrens const char *drc_tosnap;
3b2aab18808792cbd248a12f1edf139b89833c13Matthew Ahrens boolean_t drc_newfs;
3b2aab18808792cbd248a12f1edf139b89833c13Matthew Ahrens boolean_t drc_byteswap;
3b2aab18808792cbd248a12f1edf139b89833c13Matthew Ahrens boolean_t drc_force;
9c3fd1216fa7fb02cfbc78a2518a686d54b48ab8Matthew Ahrens boolean_t drc_resumable;
3b2aab18808792cbd248a12f1edf139b89833c13Matthew Ahrens struct avl_tree *drc_guid_to_ds_map;
3b2aab18808792cbd248a12f1edf139b89833c13Matthew Ahrens zio_cksum_t drc_cksum;
3b2aab18808792cbd248a12f1edf139b89833c13Matthew Ahrens uint64_t drc_newsnapobj;
91948b51b8e978ddc88a36b2bc3ae83c20cdc9aaKeith M Wesolowski void *drc_owner;
a2afb611b30628fb74ad9eade4ae465f9031e262Jerry Jelinek cred_t *drc_cred;
3b2aab18808792cbd248a12f1edf139b89833c13Matthew Ahrens} dmu_recv_cookie_t;
3b2aab18808792cbd248a12f1edf139b89833c13Matthew Ahrens
9c3fd1216fa7fb02cfbc78a2518a686d54b48ab8Matthew Ahrensint dmu_recv_begin(char *tofs, char *tosnap,
9c3fd1216fa7fb02cfbc78a2518a686d54b48ab8Matthew Ahrens struct dmu_replay_record *drr_begin,
9c3fd1216fa7fb02cfbc78a2518a686d54b48ab8Matthew Ahrens boolean_t force, boolean_t resumable, char *origin, dmu_recv_cookie_t *drc);
3b2aab18808792cbd248a12f1edf139b89833c13Matthew Ahrensint dmu_recv_stream(dmu_recv_cookie_t *drc, struct vnode *vp, offset_t *voffp,
3b2aab18808792cbd248a12f1edf139b89833c13Matthew Ahrens int cleanup_fd, uint64_t *action_handlep);
91948b51b8e978ddc88a36b2bc3ae83c20cdc9aaKeith M Wesolowskiint dmu_recv_end(dmu_recv_cookie_t *drc, void *owner);
2f3d878000c3b33cde13e16c4f0a1ab15d883a18Matthew Ahrensboolean_t dmu_objset_is_receiving(objset_t *os);
3b2aab18808792cbd248a12f1edf139b89833c13Matthew Ahrens
3b2aab18808792cbd248a12f1edf139b89833c13Matthew Ahrens#endif /* _DMU_SEND_H */