diff options
author | David Sterba <dsterba@suse.com> | 2017-01-27 15:47:17 +0100 |
---|---|---|
committer | David Sterba <dsterba@suse.com> | 2017-03-08 13:00:45 +0100 |
commit | 2798a5df33d7749b223ffff38956a5c615bef874 (patch) | |
tree | fcd4f120344a5e51f57088f1dc9d9613878d0741 /convert/source-fs.h | |
parent | a20142ed719d98caa1b27f6ec48bda29ec26f009 (diff) |
btrfs-progs: convert: move definitions for interal conversion API to own file
Signed-off-by: David Sterba <dsterba@suse.com>
Diffstat (limited to 'convert/source-fs.h')
-rw-r--r-- | convert/source-fs.h | 81 |
1 files changed, 81 insertions, 0 deletions
diff --git a/convert/source-fs.h b/convert/source-fs.h new file mode 100644 index 00000000..b6a159e5 --- /dev/null +++ b/convert/source-fs.h @@ -0,0 +1,81 @@ +/* + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public + * License v2 as published by the Free Software Foundation. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * General Public License for more details. + * + * You should have received a copy of the GNU General Public + * License along with this program; if not, write to the + * Free Software Foundation, Inc., 59 Temple Place - Suite 330, + * Boston, MA 021110-1307, USA. + */ + +#ifndef __BTRFS_CONVERT_SOURCE_FS_H__ +#define __BTRFS_CONVERT_SOURCE_FS_H__ + +#include "kerncompat.h" + +#define CONV_IMAGE_SUBVOL_OBJECTID BTRFS_FIRST_FREE_OBJECTID + +struct task_ctx { + uint32_t max_copy_inodes; + uint32_t cur_copy_inodes; + struct task_info *info; +}; + +struct btrfs_convert_context; +struct btrfs_root; +struct btrfs_trans_handle; +struct btrfs_inode_item; + +struct btrfs_convert_operations { + const char *name; + int (*open_fs)(struct btrfs_convert_context *cctx, const char *devname); + int (*read_used_space)(struct btrfs_convert_context *cctx); + int (*copy_inodes)(struct btrfs_convert_context *cctx, + struct btrfs_root *root, int datacsum, + int packing, int noxattr, struct task_ctx *p); + void (*close_fs)(struct btrfs_convert_context *cctx); + int (*check_state)(struct btrfs_convert_context *cctx); +}; + +struct blk_iterate_data { + struct btrfs_trans_handle *trans; + struct btrfs_root *root; + struct btrfs_root *convert_root; + struct btrfs_inode_item *inode; + u64 convert_ino; + u64 objectid; + u64 first_block; + u64 disk_block; + u64 num_blocks; + u64 boundary; + int checksum; + int errcode; +}; + +void init_convert_context(struct btrfs_convert_context *cctx); +void clean_convert_context(struct btrfs_convert_context *cctx); +int block_iterate_proc(u64 disk_block, u64 file_block, + struct blk_iterate_data *idata); +void init_blk_iterate_data(struct blk_iterate_data *data, + struct btrfs_trans_handle *trans, + struct btrfs_root *root, + struct btrfs_inode_item *inode, + u64 objectid, int checksum); +int convert_insert_dirent(struct btrfs_trans_handle *trans, + struct btrfs_root *root, + const char *name, size_t name_len, + u64 dir, u64 objectid, + u8 file_type, u64 index_cnt, + struct btrfs_inode_item *inode); +int read_disk_extent(struct btrfs_root *root, u64 bytenr, + u32 num_bytes, char *buffer); +int record_file_blocks(struct blk_iterate_data *data, + u64 file_block, u64 disk_block, u64 num_blocks); + +#endif |