ext4_mkfs: use EXT4_SUPERBLOCK_SIZE instead of sizeof op.
[lwext4.git] / lwext4 / ext4_mkfs.c
index 5faf5ed99b81dedd73f344ce8f2eac72f3351a3c..6501925a7cf47e285165169bf4302c94ab96c31f 100644 (file)
@@ -180,7 +180,7 @@ static int create_fs_aux_info(struct fs_aux_info *aux_info, struct ext4_mkfs_inf
                aux_info->len_blocks -= last_group_size;
        }
 
-       aux_info->sb = calloc(1, sizeof(struct ext4_sblock));
+       aux_info->sb = calloc(1, EXT4_SUPERBLOCK_SIZE);
        if (!aux_info->sb)
                return ENOMEM;
 
@@ -318,7 +318,7 @@ static int bdev_write_sb(struct ext4_blockdev *bd, struct fs_aux_info *aux_info,
 
                        aux_info->sb->block_group_index = i;
                        r = ext4_block_writebytes(bd, offset, aux_info->sb,
-                                                 sizeof(struct ext4_sblock));
+                                                 EXT4_SUPERBLOCK_SIZE);
                        if (r != EOK)
                                return r;
                }
@@ -327,7 +327,7 @@ static int bdev_write_sb(struct ext4_blockdev *bd, struct fs_aux_info *aux_info,
        /* write out the primary superblock */
        aux_info->sb->block_group_index = 0;
        return ext4_block_writebytes(bd, 1024, aux_info->sb,
-                                    sizeof(struct ext4_sblock));
+                                    EXT4_SUPERBLOCK_SIZE);
 }
 
 
@@ -339,7 +339,7 @@ int ext4_mkfs_read_info(struct ext4_blockdev *bd, struct ext4_mkfs_info *info)
        if (r != EOK)
                return r;
 
-       sb = malloc(sizeof(struct ext4_sblock));
+       sb = malloc(EXT4_SUPERBLOCK_SIZE);
        if (!sb)
                goto Finish;
 
@@ -391,12 +391,12 @@ int ext4_mkfs(struct ext4_blockdev *bd, struct ext4_mkfs_info *info)
 
        info->inodes_per_group = compute_inodes_per_group(info);
 
-       info->feat_compat = CONFIG_SUPPORTED_FCOM;
-       info->feat_ro_compat = CONFIG_SUPPORTED_FRO_COM;
-       info->feat_incompat = CONFIG_SUPPORTED_FINCOM;
+       info->feat_compat = EXT2_SUPPORTED_FCOM;
+       info->feat_ro_compat = EXT2_SUPPORTED_FRO_COM;
+       info->feat_incompat = EXT2_SUPPORTED_FINCOM;
 
        if (info->no_journal == 0)
-               info->feat_compat |= EXT4_FCOM_HAS_JOURNAL;
+               info->feat_compat |= 0;
 
        info->bg_desc_reserve_blocks = compute_bg_desc_reserve_blocks(info);