btrfs-progs: convert: update some forward declarations
[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 struct btrfs_convert_operations {
35         const char *name;
36         int (*open_fs)(struct btrfs_convert_context *cctx, const char *devname);
37         int (*read_used_space)(struct btrfs_convert_context *cctx);
38         int (*copy_inodes)(struct btrfs_convert_context *cctx,
39                          struct btrfs_root *root, int datacsum,
40                          int packing, int noxattr, struct task_ctx *p);
41         void (*close_fs)(struct btrfs_convert_context *cctx);
42         int (*check_state)(struct btrfs_convert_context *cctx);
43 };
44
45 struct btrfs_trans_handle;
46 struct btrfs_root;
47 struct btrfs_inode_item;
48
49 struct blk_iterate_data {
50         struct btrfs_trans_handle *trans;
51         struct btrfs_root *root;
52         struct btrfs_root *convert_root;
53         struct btrfs_inode_item *inode;
54         u64 convert_ino;
55         u64 objectid;
56         u64 first_block;
57         u64 disk_block;
58         u64 num_blocks;
59         u64 boundary;
60         int checksum;
61         int errcode;
62 };
63
64 void init_convert_context(struct btrfs_convert_context *cctx);
65 void clean_convert_context(struct btrfs_convert_context *cctx);
66 int block_iterate_proc(u64 disk_block, u64 file_block,
67                               struct blk_iterate_data *idata);
68 void init_blk_iterate_data(struct blk_iterate_data *data,
69                                   struct btrfs_trans_handle *trans,
70                                   struct btrfs_root *root,
71                                   struct btrfs_inode_item *inode,
72                                   u64 objectid, int checksum);
73 int convert_insert_dirent(struct btrfs_trans_handle *trans,
74                                  struct btrfs_root *root,
75                                  const char *name, size_t name_len,
76                                  u64 dir, u64 objectid,
77                                  u8 file_type, u64 index_cnt,
78                                  struct btrfs_inode_item *inode);
79 int read_disk_extent(struct btrfs_root *root, u64 bytenr,
80                             u32 num_bytes, char *buffer);
81 int record_file_blocks(struct blk_iterate_data *data,
82                               u64 file_block, u64 disk_block, u64 num_blocks);
83
84 #endif