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.
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.
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.
17 #ifndef __BTRFS_CONVERT_SOURCE_EXT2_H__
18 #define __BTRFS_CONVERT_SOURCE_EXT2_H__
22 #include "kerncompat.h"
24 #include <ext2fs/ext2_fs.h>
25 #include <ext2fs/ext2fs.h>
26 #include <ext2fs/ext2_ext_attr.h>
27 #include "convert/source-fs.h"
29 #define INO_OFFSET (BTRFS_FIRST_FREE_OBJECTID - EXT2_ROOT_INO)
32 * Compatibility code for e2fsprogs 1.41 which doesn't support RO compat flag
34 * Unlike normal RO compat flag, BIGALLOC affects how e2fsprogs check used
35 * space, and btrfs-convert heavily relies on it.
37 #ifdef HAVE_OLD_E2FSPROGS
38 #define EXT2FS_CLUSTER_RATIO(fs) (1)
39 #define EXT2_CLUSTERS_PER_GROUP(s) (EXT2_BLOCKS_PER_GROUP(s))
40 #define EXT2FS_B2C(fs, blk) (blk)
44 * Following xattr/acl related codes are based on codes in
45 * fs/ext3/xattr.c and fs/ext3/acl.c
47 #define EXT2_XATTR_BHDR(ptr) ((struct ext2_ext_attr_header *)(ptr))
48 #define EXT2_XATTR_BFIRST(ptr) \
49 ((struct ext2_ext_attr_entry *)(EXT2_XATTR_BHDR(ptr) + 1))
50 #define EXT2_XATTR_IHDR(inode) \
51 ((struct ext2_ext_attr_header *) ((void *)(inode) + \
52 EXT2_GOOD_OLD_INODE_SIZE + (inode)->i_extra_isize))
53 #define EXT2_XATTR_IFIRST(inode) \
54 ((struct ext2_ext_attr_entry *) ((void *)EXT2_XATTR_IHDR(inode) + \
55 sizeof(EXT2_XATTR_IHDR(inode)->h_magic)))
57 struct dir_iterate_data {
58 struct btrfs_trans_handle *trans;
59 struct btrfs_root *root;
60 struct btrfs_inode_item *inode;
67 #define EXT2_ACL_VERSION 0x0001
69 #endif /* BTRFSCONVERT_EXT2 */