btrfs-progs: remove unused argument from write_and_map_eb
[platform/upstream/btrfs-progs.git] / convert / source-fs.h
1 /*
2  * This program is free software; you can redistribute it and/or
3  * modify it under the terms of the GNU General Public
4  * License v2 as published by the Free Software Foundation.
5  *
6  * This program is distributed in the hope that it will be useful,
7  * but WITHOUT ANY WARRANTY; without even the implied warranty of
8  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
9  * General Public License for more details.
10  *
11  * You should have received a copy of the GNU General Public
12  * License along with this program; if not, write to the
13  * Free Software Foundation, Inc., 59 Temple Place - Suite 330,
14  * Boston, MA 021110-1307, USA.
15  */
16
17 #ifndef __BTRFS_CONVERT_SOURCE_FS_H__
18 #define __BTRFS_CONVERT_SOURCE_FS_H__
19
20 #include "kerncompat.h"
21
22 #define CONV_IMAGE_SUBVOL_OBJECTID BTRFS_FIRST_FREE_OBJECTID
23
24 struct task_info;
25
26 struct task_ctx {
27         u64 max_copy_inodes;
28         u64 cur_copy_inodes;
29         struct task_info *info;
30 };
31
32 struct btrfs_convert_context;
33
34 #define SOURCE_FS_NAME_LEN      (16)
35
36 #define CONVERT_FLAG_DATACSUM           (1U << 0)
37 #define CONVERT_FLAG_INLINE_DATA        (1U << 1)
38 #define CONVERT_FLAG_XATTR              (1U << 2)
39 #define CONVERT_FLAG_COPY_LABEL         (1U << 3)
40 #define CONVERT_FLAG_SET_LABEL          (1U << 4)
41
42 struct btrfs_convert_operations {
43         const char name[SOURCE_FS_NAME_LEN];
44         int (*open_fs)(struct btrfs_convert_context *cctx, const char *devname);
45         int (*read_used_space)(struct btrfs_convert_context *cctx);
46         int (*copy_inodes)(struct btrfs_convert_context *cctx,
47                          struct btrfs_root *root, u32 covert_flags,
48                          struct task_ctx *p);
49         void (*close_fs)(struct btrfs_convert_context *cctx);
50         int (*check_state)(struct btrfs_convert_context *cctx);
51 };
52
53 struct btrfs_trans_handle;
54 struct btrfs_root;
55 struct btrfs_inode_item;
56
57 struct blk_iterate_data {
58         struct btrfs_trans_handle *trans;
59         struct btrfs_root *root;
60         struct btrfs_root *convert_root;
61         struct btrfs_inode_item *inode;
62         u64 convert_ino;
63         u64 objectid;
64         u64 first_block;
65         u64 disk_block;
66         u64 num_blocks;
67         u64 boundary;
68         int checksum;
69         int errcode;
70 };
71
72 void init_convert_context(struct btrfs_convert_context *cctx);
73 void clean_convert_context(struct btrfs_convert_context *cctx);
74 int block_iterate_proc(u64 disk_block, u64 file_block,
75                               struct blk_iterate_data *idata);
76 void init_blk_iterate_data(struct blk_iterate_data *data,
77                                   struct btrfs_trans_handle *trans,
78                                   struct btrfs_root *root,
79                                   struct btrfs_inode_item *inode,
80                                   u64 objectid, int checksum);
81 int convert_insert_dirent(struct btrfs_trans_handle *trans,
82                                  struct btrfs_root *root,
83                                  const char *name, size_t name_len,
84                                  u64 dir, u64 objectid,
85                                  u8 file_type, u64 index_cnt,
86                                  struct btrfs_inode_item *inode);
87 int read_disk_extent(struct btrfs_root *root, u64 bytenr,
88                             u32 num_bytes, char *buffer);
89 int record_file_blocks(struct blk_iterate_data *data,
90                               u64 file_block, u64 disk_block, u64 num_blocks);
91
92 #endif