1 /*
   2  * This file and its contents are supplied under the terms of the
   3  * Common Development and Distribution License ("CDDL"), version 1.0.
   4  * You may only use this file in accordance with the terms of version
   5  * 1.0 of the CDDL.
   6  *
   7  * A full copy of the text of the CDDL should have accompanied this
   8  * source.  A copy of the CDDL is also available via the Internet at
   9  * http://www.illumos.org/license/CDDL.
  10  */
  11 
  12 /*
  13  * Copyright 2017 Nexenta Systems, Inc.  All rights reserved.
  14  */
  15 
  16 #ifndef _KREPLICATION_COMMON_H
  17 #define _KREPLICATION_COMMON_H
  18 
  19 #ifdef  __cplusplus
  20 extern "C" {
  21 #endif
  22 
  23 #include <sys/fs/zfs.h>
  24 
  25 #include <sys/param.h>
  26 #include <sys/nvpair.h>
  27 
  28 /*
  29  * This callback is used by send-side to decide what will be used:
  30  * zero-copy ARC-read or regular ARC-read
  31  */
  32 typedef boolean_t krrp_check_enough_mem(size_t, void *);
  33 typedef int (*arc_bypass_io_func)(void *, int, void *);
  34 
  35 
  36 typedef struct kreplication_buffer_s {
  37         void    *data;
  38         size_t  buffer_size;
  39         size_t  data_size;
  40         struct  kreplication_buffer_s *next;
  41 } kreplication_buffer_t;
  42 
  43 typedef struct kreplication_ops_s {
  44     void* (*init_cb)(void*);
  45     int (*fini_cb)(void*);
  46     int (*fill_buf_cb)(void*, kreplication_buffer_t *);
  47     int (*put_buf_cb)(void*, kreplication_buffer_t *);
  48     void* (*init_stream_cb)();
  49     void (*fini_stream_cb)(void*);
  50 } kreplication_ops_t;
  51 
  52 typedef struct kreplication_zfs_args {
  53         char from_ds[ZFS_MAX_DATASET_NAME_LEN];
  54         char from_snap[ZFS_MAX_DATASET_NAME_LEN];
  55         char from_incr_base[ZFS_MAX_DATASET_NAME_LEN];
  56         char to_ds[ZFS_MAX_DATASET_NAME_LEN];
  57         char to_snap[ZFS_MAX_DATASET_NAME_LEN];
  58 
  59         const char *skip_snaps_prop_name;
  60         const char *skip_snaps_prop_val;
  61 
  62         boolean_t force;
  63         boolean_t properties;
  64         boolean_t recursive;
  65         boolean_t do_all;
  66         nvlist_t *ignore_list;
  67         nvlist_t *replace_list;
  68         nvlist_t *resume_info;
  69         boolean_t strip_head;
  70         boolean_t leave_tail;
  71         boolean_t force_cksum;
  72         boolean_t embedok;
  73         boolean_t compressok;
  74         boolean_t large_block_ok;
  75         void *stream_handler;
  76         krrp_check_enough_mem *mem_check_cb;
  77         void *mem_check_cb_arg;
  78 } kreplication_zfs_args_t;
  79 
  80 #ifdef  __cplusplus
  81 }
  82 #endif
  83 
  84 #endif /* _KREPLICATION_COMMON_H */