1 /* SPDX-License-Identifier: GPL-2.0 */
3 * Copyright (C) 2012 Alexander Block. All rights reserved.
4 * Copyright (C) 2012 STRATO. All rights reserved.
12 #define BTRFS_SEND_STREAM_MAGIC "btrfs-stream"
13 #define BTRFS_SEND_STREAM_VERSION 1
15 #define BTRFS_SEND_BUF_SIZE SZ_64K
16 #define BTRFS_SEND_READ_SIZE (48 * SZ_1K)
29 struct btrfs_stream_header
{
30 char magic
[sizeof(BTRFS_SEND_STREAM_MAGIC
)];
32 } __attribute__ ((__packed__
));
34 struct btrfs_cmd_header
{
35 /* len excluding the header */
38 /* crc including the header with zero crc field */
40 } __attribute__ ((__packed__
));
42 struct btrfs_tlv_header
{
44 /* len excluding the header */
46 } __attribute__ ((__packed__
));
53 BTRFS_SEND_C_SNAPSHOT
,
67 BTRFS_SEND_C_SET_XATTR
,
68 BTRFS_SEND_C_REMOVE_XATTR
,
73 BTRFS_SEND_C_TRUNCATE
,
79 BTRFS_SEND_C_UPDATE_EXTENT
,
82 #define BTRFS_SEND_C_MAX (__BTRFS_SEND_C_MAX - 1)
84 /* attributes in send stream */
89 BTRFS_SEND_A_CTRANSID
,
102 BTRFS_SEND_A_XATTR_NAME
,
103 BTRFS_SEND_A_XATTR_DATA
,
106 BTRFS_SEND_A_PATH_TO
,
107 BTRFS_SEND_A_PATH_LINK
,
109 BTRFS_SEND_A_FILE_OFFSET
,
112 BTRFS_SEND_A_CLONE_UUID
,
113 BTRFS_SEND_A_CLONE_CTRANSID
,
114 BTRFS_SEND_A_CLONE_PATH
,
115 BTRFS_SEND_A_CLONE_OFFSET
,
116 BTRFS_SEND_A_CLONE_LEN
,
120 #define BTRFS_SEND_A_MAX (__BTRFS_SEND_A_MAX - 1)
123 long btrfs_ioctl_send(struct file
*mnt_file
, struct btrfs_ioctl_send_args
*arg
);