diff options
author | Alexander Block <ablock84@googlemail.com> | 2012-07-25 17:19:24 -0400 |
---|---|---|
committer | Alexander Block <ablock84@googlemail.com> | 2012-07-25 17:30:19 -0400 |
commit | 31db9f7c23fbf7e95026143f79645de6507b583b (patch) | |
tree | a3e416143bd08d8daca762f85a6d260e49c56c61 /fs/btrfs/send.h | |
parent | 7069830a9e381e33d44ded45095f764844c71d24 (diff) |
Btrfs: introduce BTRFS_IOC_SEND for btrfs send/receive
This patch introduces the BTRFS_IOC_SEND ioctl that is
required for send. It allows btrfs-progs to implement
full and incremental sends. Patches for btrfs-progs will
follow.
Signed-off-by: Alexander Block <ablock84@googlemail.com>
Reviewed-by: David Sterba <dave@jikos.cz>
Reviewed-by: Arne Jansen <sensille@gmx.net>
Reviewed-by: Jan Schmidt <list.btrfs@jan-o-sch.net>
Reviewed-by: Alex Lyakas <alex.bolshoy.btrfs@gmail.com>
Diffstat (limited to 'fs/btrfs/send.h')
-rw-r--r-- | fs/btrfs/send.h | 133 |
1 files changed, 133 insertions, 0 deletions
diff --git a/fs/btrfs/send.h b/fs/btrfs/send.h new file mode 100644 index 000000000000..9934e948e57f --- /dev/null +++ b/fs/btrfs/send.h | |||
@@ -0,0 +1,133 @@ | |||
1 | /* | ||
2 | * Copyright (C) 2012 Alexander Block. All rights reserved. | ||
3 | * Copyright (C) 2012 STRATO. All rights reserved. | ||
4 | * | ||
5 | * This program is free software; you can redistribute it and/or | ||
6 | * modify it under the terms of the GNU General Public | ||
7 | * License v2 as published by the Free Software Foundation. | ||
8 | * | ||
9 | * This program is distributed in the hope that it will be useful, | ||
10 | * but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
11 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU | ||
12 | * General Public License for more details. | ||
13 | * | ||
14 | * You should have received a copy of the GNU General Public | ||
15 | * License along with this program; if not, write to the | ||
16 | * Free Software Foundation, Inc., 59 Temple Place - Suite 330, | ||
17 | * Boston, MA 021110-1307, USA. | ||
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 (1024 * 64) | ||
26 | #define BTRFS_SEND_READ_SIZE (1024 * 48) | ||
27 | |||
28 | enum 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 | |||
39 | struct btrfs_stream_header { | ||
40 | char magic[sizeof(BTRFS_SEND_STREAM_MAGIC)]; | ||
41 | __le32 version; | ||
42 | } __attribute__ ((__packed__)); | ||
43 | |||
44 | struct btrfs_cmd_header { | ||
45 | /* len excluding the header */ | ||
46 | __le32 len; | ||
47 | __le16 cmd; | ||
48 | /* crc including the header with zero crc field */ | ||
49 | __le32 crc; | ||
50 | } __attribute__ ((__packed__)); | ||
51 | |||
52 | struct btrfs_tlv_header { | ||
53 | __le16 tlv_type; | ||
54 | /* len excluding the header */ | ||
55 | __le16 tlv_len; | ||
56 | } __attribute__ ((__packed__)); | ||
57 | |||
58 | /* commands */ | ||
59 | enum 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_MAX, | ||
90 | }; | ||
91 | #define BTRFS_SEND_C_MAX (__BTRFS_SEND_C_MAX - 1) | ||
92 | |||
93 | /* attributes in send stream */ | ||
94 | enum { | ||
95 | BTRFS_SEND_A_UNSPEC, | ||
96 | |||
97 | BTRFS_SEND_A_UUID, | ||
98 | BTRFS_SEND_A_CTRANSID, | ||
99 | |||
100 | BTRFS_SEND_A_INO, | ||
101 | BTRFS_SEND_A_SIZE, | ||
102 | BTRFS_SEND_A_MODE, | ||
103 | BTRFS_SEND_A_UID, | ||
104 | BTRFS_SEND_A_GID, | ||
105 | BTRFS_SEND_A_RDEV, | ||
106 | BTRFS_SEND_A_CTIME, | ||
107 | BTRFS_SEND_A_MTIME, | ||
108 | BTRFS_SEND_A_ATIME, | ||
109 | BTRFS_SEND_A_OTIME, | ||
110 | |||
111 | BTRFS_SEND_A_XATTR_NAME, | ||
112 | BTRFS_SEND_A_XATTR_DATA, | ||
113 | |||
114 | BTRFS_SEND_A_PATH, | ||
115 | BTRFS_SEND_A_PATH_TO, | ||
116 | BTRFS_SEND_A_PATH_LINK, | ||
117 | |||
118 | BTRFS_SEND_A_FILE_OFFSET, | ||
119 | BTRFS_SEND_A_DATA, | ||
120 | |||
121 | BTRFS_SEND_A_CLONE_UUID, | ||
122 | BTRFS_SEND_A_CLONE_CTRANSID, | ||
123 | BTRFS_SEND_A_CLONE_PATH, | ||
124 | BTRFS_SEND_A_CLONE_OFFSET, | ||
125 | BTRFS_SEND_A_CLONE_LEN, | ||
126 | |||
127 | __BTRFS_SEND_A_MAX, | ||
128 | }; | ||
129 | #define BTRFS_SEND_A_MAX (__BTRFS_SEND_A_MAX - 1) | ||
130 | |||
131 | #ifdef __KERNEL__ | ||
132 | long btrfs_ioctl_send(struct file *mnt_file, void __user *arg); | ||
133 | #endif | ||