2 * Copyright (C) 2012 Alexander Block. All rights reserved.
4 * This program is free software; you can redistribute it and/or
5 * modify it under the terms of the GNU General Public
6 * License v2 as published by the Free Software Foundation.
8 * This program is distributed in the hope that it will be useful,
9 * but WITHOUT ANY WARRANTY; without even the implied warranty of
10 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
11 * General Public License for more details.
13 * You should have received a copy of the GNU General Public
14 * License along with this program; if not, write to the
15 * Free Software Foundation, Inc., 59 Temple Place - Suite 330,
16 * Boston, MA 021110-1307, USA.
19 #ifndef __BTRFS_SEND_STREAM_H__
20 #define __BTRFS_SEND_STREAM_H__
23 * NOTE: this file is public API, any incompatible change has to update
31 #if BTRFS_FLAT_INCLUDES
32 #include "kerncompat.h"
34 #include <btrfs/kerncompat.h>
35 #endif /* BTRFS_FLAT_INCLUDES */
37 struct btrfs_send_ops
{
38 int (*subvol
)(const char *path
, const u8
*uuid
, u64 ctransid
,
40 int (*snapshot
)(const char *path
, const u8
*uuid
, u64 ctransid
,
41 const u8
*parent_uuid
, u64 parent_ctransid
,
43 int (*mkfile
)(const char *path
, void *user
);
44 int (*mkdir
)(const char *path
, void *user
);
45 int (*mknod
)(const char *path
, u64 mode
, u64 dev
, void *user
);
46 int (*mkfifo
)(const char *path
, void *user
);
47 int (*mksock
)(const char *path
, void *user
);
48 int (*symlink
)(const char *path
, const char *lnk
, void *user
);
49 int (*rename
)(const char *from
, const char *to
, void *user
);
50 int (*link
)(const char *path
, const char *lnk
, void *user
);
51 int (*unlink
)(const char *path
, void *user
);
52 int (*rmdir
)(const char *path
, void *user
);
53 int (*write
)(const char *path
, const void *data
, u64 offset
, u64 len
,
55 int (*clone
)(const char *path
, u64 offset
, u64 len
,
56 const u8
*clone_uuid
, u64 clone_ctransid
,
57 const char *clone_path
, u64 clone_offset
,
59 int (*set_xattr
)(const char *path
, const char *name
, const void *data
,
61 int (*remove_xattr
)(const char *path
, const char *name
, void *user
);
62 int (*truncate
)(const char *path
, u64 size
, void *user
);
63 int (*chmod
)(const char *path
, u64 mode
, void *user
);
64 int (*chown
)(const char *path
, u64 uid
, u64 gid
, void *user
);
65 int (*utimes
)(const char *path
, struct timespec
*at
,
66 struct timespec
*mt
, struct timespec
*ct
,
68 int (*update_extent
)(const char *path
, u64 offset
, u64 len
, void *user
);
71 int btrfs_read_and_process_send_stream(int fd
,
72 struct btrfs_send_ops
*ops
, void *user
,