--- trunk/mkinitrd-magellan/klibc/usr/kinit/fstype/fstype.c 2010/07/22 07:47:49 1121 +++ trunk/mkinitrd-magellan/klibc/usr/kinit/fstype/fstype.c 2010/08/18 21:11:40 1122 @@ -23,19 +23,20 @@ #define cpu_to_be32(x) __cpu_to_be32(x) /* Needed by romfs_fs.h */ -#include "romfs_fs.h" +#include "btrfs.h" #include "cramfs_fs.h" -#include "minix_fs.h" #include "ext2_fs.h" #include "ext3_fs.h" -#include "xfs_sb.h" +#include "gfs2_fs.h" +#include "iso9660_sb.h" #include "luks_fs.h" #include "lvm2_sb.h" -#include "iso9660_sb.h" -#include "squashfs_fs.h" -#include "gfs2_fs.h" -#include "ocfs2_fs.h" +#include "minix_fs.h" #include "nilfs_fs.h" +#include "ocfs2_fs.h" +#include "romfs_fs.h" +#include "squashfs_fs.h" +#include "xfs_sb.h" /* * Slightly cleaned up version of jfs_superblock to @@ -196,14 +197,6 @@ if (sb->s_magic != __cpu_to_le16(EXT2_SUPER_MAGIC)) return 0; - /* - * For now, ext4 requires a journal -- but this may change - * soon if we get that patch from Google. :-) - */ - if ((sb->s_feature_compat - & __cpu_to_le32(EXT3_FEATURE_COMPAT_HAS_JOURNAL)) == 0) - return 0; - /* There is at least one feature not supported by ext3 */ if ((sb->s_feature_incompat & __cpu_to_le32(EXT3_FEATURE_INCOMPAT_UNSUPPORTED)) || @@ -461,6 +454,18 @@ return 0; } +static int btrfs_image(const void *buf, unsigned long long *bytes) +{ + const struct btrfs_super_block *sb = + (const struct btrfs_super_block *)buf; + + if (!memcmp(sb->magic, BTRFS_MAGIC, BTRFS_MAGIC_L)) { + *bytes = (unsigned long long)__le64_to_cpu(sb->total_bytes); + return 1; + } + return 0; +} + struct imagetype { off_t block; const char name[12]; @@ -496,6 +501,7 @@ {64, "reiserfs", reiserfs_image}, {64, "reiser4", reiser4_image}, {64, "gfs2", gfs2_image}, + {64, "btrfs", btrfs_image}, {32, "jfs", jfs_image}, {32, "iso9660", iso_image}, {0, "luks", luks_image},