1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20#include "ctree.h"
21
22#define BTRFS_SEND_STREAM_MAGIC "btrfs-stream"
23#define BTRFS_SEND_STREAM_VERSION 1
24
25#define BTRFS_SEND_BUF_SIZE SZ_64K
26#define BTRFS_SEND_READ_SIZE (48 * SZ_1K)
27
28enum btrfs_tlv_type {
29 BTRFS_TLV_U8,
30 BTRFS_TLV_U16,
31 BTRFS_TLV_U32,
32 BTRFS_TLV_U64,
33 BTRFS_TLV_BINARY,
34 BTRFS_TLV_STRING,
35 BTRFS_TLV_UUID,
36 BTRFS_TLV_TIMESPEC,
37};
38
39struct btrfs_stream_header {
40 char magic[sizeof(BTRFS_SEND_STREAM_MAGIC)];
41 __le32 version;
42} __attribute__ ((__packed__));
43
44struct btrfs_cmd_header {
45
46 __le32 len;
47 __le16 cmd;
48
49 __le32 crc;
50} __attribute__ ((__packed__));
51
52struct btrfs_tlv_header {
53 __le16 tlv_type;
54
55 __le16 tlv_len;
56} __attribute__ ((__packed__));
57
58
59enum btrfs_send_cmd {
60 BTRFS_SEND_C_UNSPEC,
61
62 BTRFS_SEND_C_SUBVOL,
63 BTRFS_SEND_C_SNAPSHOT,
64
65 BTRFS_SEND_C_MKFILE,
66 BTRFS_SEND_C_MKDIR,
67 BTRFS_SEND_C_MKNOD,
68 BTRFS_SEND_C_MKFIFO,
69 BTRFS_SEND_C_MKSOCK,
70 BTRFS_SEND_C_SYMLINK,
71
72 BTRFS_SEND_C_RENAME,
73 BTRFS_SEND_C_LINK,
74 BTRFS_SEND_C_UNLINK,
75 BTRFS_SEND_C_RMDIR,
76
77 BTRFS_SEND_C_SET_XATTR,
78 BTRFS_SEND_C_REMOVE_XATTR,
79
80 BTRFS_SEND_C_WRITE,
81 BTRFS_SEND_C_CLONE,
82
83 BTRFS_SEND_C_TRUNCATE,
84 BTRFS_SEND_C_CHMOD,
85 BTRFS_SEND_C_CHOWN,
86 BTRFS_SEND_C_UTIMES,
87
88 BTRFS_SEND_C_END,
89 BTRFS_SEND_C_UPDATE_EXTENT,
90 __BTRFS_SEND_C_MAX,
91};
92#define BTRFS_SEND_C_MAX (__BTRFS_SEND_C_MAX - 1)
93
94
95enum {
96 BTRFS_SEND_A_UNSPEC,
97
98 BTRFS_SEND_A_UUID,
99 BTRFS_SEND_A_CTRANSID,
100
101 BTRFS_SEND_A_INO,
102 BTRFS_SEND_A_SIZE,
103 BTRFS_SEND_A_MODE,
104 BTRFS_SEND_A_UID,
105 BTRFS_SEND_A_GID,
106 BTRFS_SEND_A_RDEV,
107 BTRFS_SEND_A_CTIME,
108 BTRFS_SEND_A_MTIME,
109 BTRFS_SEND_A_ATIME,
110 BTRFS_SEND_A_OTIME,
111
112 BTRFS_SEND_A_XATTR_NAME,
113 BTRFS_SEND_A_XATTR_DATA,
114
115 BTRFS_SEND_A_PATH,
116 BTRFS_SEND_A_PATH_TO,
117 BTRFS_SEND_A_PATH_LINK,
118
119 BTRFS_SEND_A_FILE_OFFSET,
120 BTRFS_SEND_A_DATA,
121
122 BTRFS_SEND_A_CLONE_UUID,
123 BTRFS_SEND_A_CLONE_CTRANSID,
124 BTRFS_SEND_A_CLONE_PATH,
125 BTRFS_SEND_A_CLONE_OFFSET,
126 BTRFS_SEND_A_CLONE_LEN,
127
128 __BTRFS_SEND_A_MAX,
129};
130#define BTRFS_SEND_A_MAX (__BTRFS_SEND_A_MAX - 1)
131
132#ifdef __KERNEL__
133long btrfs_ioctl_send(struct file *mnt_file, void __user *arg);
134#endif
135