btrfs-progs: add missing limits headers
[btrfs-progs-unstable/devel.git] / send.h
blobfe613cbb83b7c3056c71c4ac4c64352b9dad8629
1 /*
2 * Copyright (C) 2012 Alexander Block. All rights reserved.
3 * Copyright (C) 2012 STRATO. All rights reserved.
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.
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.
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.
20 #ifndef __BTRFS_SEND_H__
21 #define __BTRFS_SEND_H__
23 #include "ctree.h"
25 #ifdef __cplusplus
26 extern "C" {
27 #endif
29 #define BTRFS_SEND_STREAM_MAGIC "btrfs-stream"
30 #define BTRFS_SEND_STREAM_VERSION 1
32 #define BTRFS_SEND_BUF_SIZE SZ_64K
33 #define BTRFS_SEND_READ_SIZE (1024 * 48)
35 enum btrfs_tlv_type {
36 BTRFS_TLV_U8,
37 BTRFS_TLV_U16,
38 BTRFS_TLV_U32,
39 BTRFS_TLV_U64,
40 BTRFS_TLV_BINARY,
41 BTRFS_TLV_STRING,
42 BTRFS_TLV_UUID,
43 BTRFS_TLV_TIMESPEC,
46 struct btrfs_stream_header {
47 char magic[sizeof(BTRFS_SEND_STREAM_MAGIC)];
48 __le32 version;
49 } __attribute__ ((__packed__));
51 struct btrfs_cmd_header {
52 /* len excluding the header */
53 __le32 len;
54 __le16 cmd;
55 /* crc including the header with zero crc field */
56 __le32 crc;
57 } __attribute__ ((__packed__));
59 struct btrfs_tlv_header {
60 __le16 tlv_type;
61 /* len excluding the header */
62 __le16 tlv_len;
63 } __attribute__ ((__packed__));
65 /* commands */
66 enum btrfs_send_cmd {
67 BTRFS_SEND_C_UNSPEC,
69 BTRFS_SEND_C_SUBVOL,
70 BTRFS_SEND_C_SNAPSHOT,
72 BTRFS_SEND_C_MKFILE,
73 BTRFS_SEND_C_MKDIR,
74 BTRFS_SEND_C_MKNOD,
75 BTRFS_SEND_C_MKFIFO,
76 BTRFS_SEND_C_MKSOCK,
77 BTRFS_SEND_C_SYMLINK,
79 BTRFS_SEND_C_RENAME,
80 BTRFS_SEND_C_LINK,
81 BTRFS_SEND_C_UNLINK,
82 BTRFS_SEND_C_RMDIR,
84 BTRFS_SEND_C_SET_XATTR,
85 BTRFS_SEND_C_REMOVE_XATTR,
87 BTRFS_SEND_C_WRITE,
88 BTRFS_SEND_C_CLONE,
90 BTRFS_SEND_C_TRUNCATE,
91 BTRFS_SEND_C_CHMOD,
92 BTRFS_SEND_C_CHOWN,
93 BTRFS_SEND_C_UTIMES,
95 BTRFS_SEND_C_END,
96 BTRFS_SEND_C_UPDATE_EXTENT,
97 __BTRFS_SEND_C_MAX,
99 #define BTRFS_SEND_C_MAX (__BTRFS_SEND_C_MAX - 1)
101 /* attributes in send stream */
102 enum {
103 BTRFS_SEND_A_UNSPEC,
105 BTRFS_SEND_A_UUID,
106 BTRFS_SEND_A_CTRANSID,
108 BTRFS_SEND_A_INO,
109 BTRFS_SEND_A_SIZE,
110 BTRFS_SEND_A_MODE,
111 BTRFS_SEND_A_UID,
112 BTRFS_SEND_A_GID,
113 BTRFS_SEND_A_RDEV,
114 BTRFS_SEND_A_CTIME,
115 BTRFS_SEND_A_MTIME,
116 BTRFS_SEND_A_ATIME,
117 BTRFS_SEND_A_OTIME,
119 BTRFS_SEND_A_XATTR_NAME,
120 BTRFS_SEND_A_XATTR_DATA,
122 BTRFS_SEND_A_PATH,
123 BTRFS_SEND_A_PATH_TO,
124 BTRFS_SEND_A_PATH_LINK,
126 BTRFS_SEND_A_FILE_OFFSET,
127 BTRFS_SEND_A_DATA,
129 BTRFS_SEND_A_CLONE_UUID,
130 BTRFS_SEND_A_CLONE_CTRANSID,
131 BTRFS_SEND_A_CLONE_PATH,
132 BTRFS_SEND_A_CLONE_OFFSET,
133 BTRFS_SEND_A_CLONE_LEN,
135 __BTRFS_SEND_A_MAX,
137 #define BTRFS_SEND_A_MAX (__BTRFS_SEND_A_MAX - 1)
139 #ifdef __KERNEL__
140 long btrfs_ioctl_send(struct file *mnt_file, void __user *arg);
141 #endif
143 #ifdef __cplusplus
145 #endif
147 #endif