ref: c3ad7832038f84531ff13bd964fce2b8981237d9
parent: 5252521e18749639eb5584a1ef3604a8064a9f43
author: gkostka <kostka.grzegorz@gmail.com>
date: Tue Oct 27 15:51:49 EDT 2015
Refactor FEATURE_RO to FRO
--- a/lwext4/ext4_balloc.c
+++ b/lwext4/ext4_balloc.c
@@ -83,7 +83,7 @@
{
uint32_t checksum = 0;
if (ext4_sb_has_feature_read_only(sb,
- EXT4_FEATURE_RO_COMPAT_METADATA_CSUM)) {
+ EXT4_FRO_COM_METADATA_CSUM)) {
uint32_t blocks_per_group =
ext4_get32(sb, blocks_per_group);
--- a/lwext4/ext4_dir.c
+++ b/lwext4/ext4_dir.c
@@ -100,7 +100,7 @@
/* Compute the checksum only if the filesystem supports it */
if (ext4_sb_has_feature_read_only(sb,
- EXT4_FEATURE_RO_COMPAT_METADATA_CSUM)) {
+ EXT4_FRO_COM_METADATA_CSUM)) {
t = ext4_dir_get_tail(inode_ref, dirent);
if (!t) {
/* There is no space to hold the checksum */
@@ -131,7 +131,7 @@
/* Compute the checksum only if the filesystem supports it */
if (ext4_sb_has_feature_read_only(sb,
- EXT4_FEATURE_RO_COMPAT_METADATA_CSUM)) {
+ EXT4_FRO_COM_METADATA_CSUM)) {
t = ext4_dir_get_tail(inode_ref, dirent);
if (!t) {
/* There is no space to hold the checksum */
@@ -413,7 +413,7 @@
/* Save new block */
if (ext4_sb_has_feature_read_only(&fs->sb,
- EXT4_FEATURE_RO_COMPAT_METADATA_CSUM)) {
+ EXT4_FRO_COM_METADATA_CSUM)) {
ext4_dir_write_entry(&fs->sb, block_entry,
block_size - sizeof(struct ext4_directory_entry_tail),
child,
--- a/lwext4/ext4_dir_idx.c
+++ b/lwext4/ext4_dir_idx.c
@@ -215,7 +215,7 @@
/* Compute the checksum only if the filesystem supports it */
if (ext4_sb_has_feature_read_only(sb,
- EXT4_FEATURE_RO_COMPAT_METADATA_CSUM)) {
+ EXT4_FRO_COM_METADATA_CSUM)) {
uint32_t ino_index = to_le32(inode_ref->index);
uint32_t ino_gen =
to_le32(ext4_inode_get_generation(inode_ref->inode));
@@ -285,7 +285,7 @@
int count_offset, limit, count;
if (ext4_sb_has_feature_read_only(sb,
- EXT4_FEATURE_RO_COMPAT_METADATA_CSUM)) {
+ EXT4_FRO_COM_METADATA_CSUM)) {
struct ext4_directory_dx_countlimit *countlimit =
ext4_dir_dx_get_countlimit(inode_ref, dirent, &count_offset);
if (!countlimit) {
@@ -321,7 +321,7 @@
struct ext4_sblock *sb = &inode_ref->fs->sb;
if (ext4_sb_has_feature_read_only(sb,
- EXT4_FEATURE_RO_COMPAT_METADATA_CSUM)) {
+ EXT4_FRO_COM_METADATA_CSUM)) {
struct ext4_directory_dx_countlimit *countlimit =
ext4_dir_dx_get_countlimit(inode_ref, dirent, &count_offset);
if (!countlimit) {
@@ -399,7 +399,7 @@
2 * sizeof(struct ext4_directory_dx_dot_entry) -
sizeof(struct ext4_directory_dx_root_info);
if (ext4_sb_has_feature_read_only(sb,
- EXT4_FEATURE_RO_COMPAT_METADATA_CSUM))
+ EXT4_FRO_COM_METADATA_CSUM))
entry_space -= sizeof(struct ext4_directory_dx_tail);
uint16_t root_limit =
@@ -426,7 +426,7 @@
struct ext4_directory_entry_ll *block_entry = (void *)new_block.data;
if (ext4_sb_has_feature_read_only(sb,
- EXT4_FEATURE_RO_COMPAT_METADATA_CSUM)) {
+ EXT4_FRO_COM_METADATA_CSUM)) {
ext4_dir_entry_ll_set_entry_length(block_entry,
block_size -
sizeof(struct ext4_directory_entry_tail));
@@ -500,7 +500,7 @@
entry_space -= 2 * sizeof(struct ext4_directory_dx_dot_entry);
entry_space -= sizeof(struct ext4_directory_dx_root_info);
if (ext4_sb_has_feature_read_only(sb,
- EXT4_FEATURE_RO_COMPAT_METADATA_CSUM))
+ EXT4_FRO_COM_METADATA_CSUM))
entry_space -= sizeof(struct ext4_directory_dx_tail);
entry_space = entry_space / sizeof(struct ext4_directory_dx_entry);
@@ -619,7 +619,7 @@
sizeof(struct ext4_fake_directory_entry);
if (ext4_sb_has_feature_read_only(&inode_ref->fs->sb,
- EXT4_FEATURE_RO_COMPAT_METADATA_CSUM))
+ EXT4_FRO_COM_METADATA_CSUM))
entry_space -= sizeof(struct ext4_directory_dx_tail);
entry_space =
@@ -1041,7 +1041,7 @@
void *ptr;
if (ext4_sb_has_feature_read_only(&inode_ref->fs->sb,
- EXT4_FEATURE_RO_COMPAT_METADATA_CSUM))
+ EXT4_FRO_COM_METADATA_CSUM))
block_size -= sizeof(struct ext4_directory_entry_tail);
/* First part - to the old block */
@@ -1081,7 +1081,7 @@
/* Do some steps to finish operation */
if (ext4_sb_has_feature_read_only(&inode_ref->fs->sb,
- EXT4_FEATURE_RO_COMPAT_METADATA_CSUM)) {
+ EXT4_FRO_COM_METADATA_CSUM)) {
initialize_dir_tail(EXT4_DIRENT_TAIL(old_data_block->data,
block_size));
initialize_dir_tail(EXT4_DIRENT_TAIL(new_data_block_tmp.data,
@@ -1210,7 +1210,7 @@
block_size -
sizeof(struct ext4_fake_directory_entry);
if (ext4_sb_has_feature_read_only(sb,
- EXT4_FEATURE_RO_COMPAT_METADATA_CSUM))
+ EXT4_FRO_COM_METADATA_CSUM))
entry_space -= sizeof(struct ext4_directory_dx_tail);
uint32_t node_limit =
entry_space /
@@ -1273,7 +1273,7 @@
block_size -
sizeof(struct ext4_fake_directory_entry);
if (ext4_sb_has_feature_read_only(sb,
- EXT4_FEATURE_RO_COMPAT_METADATA_CSUM))
+ EXT4_FRO_COM_METADATA_CSUM))
entry_space -= sizeof(struct ext4_directory_dx_tail);
uint32_t node_limit =
entry_space /
--- a/lwext4/ext4_extent_full.c
+++ b/lwext4/ext4_extent_full.c
@@ -316,7 +316,7 @@
struct ext4_sblock *sb = &inode_ref->fs->sb;
if (ext4_sb_has_feature_read_only(sb,
- EXT4_FEATURE_RO_COMPAT_METADATA_CSUM)) {
+ EXT4_FRO_COM_METADATA_CSUM)) {
uint32_t ino_index = to_le32(inode_ref->index);
uint32_t ino_gen =
to_le32(ext4_inode_get_generation(inode_ref->inode));
@@ -410,7 +410,7 @@
tail = find_ext4_extent_tail(eh);
if (ext4_sb_has_feature_read_only(&inode_ref->fs->sb,
- EXT4_FEATURE_RO_COMPAT_METADATA_CSUM)) {
+ EXT4_FRO_COM_METADATA_CSUM)) {
if (tail->et_checksum != to_le32(ext4_ext_block_csum(inode_ref, eh))) {
/* FIXME: Warning: extent checksum damaged? */
}
--- a/lwext4/ext4_fs.c
+++ b/lwext4/ext4_fs.c
@@ -175,25 +175,25 @@
static void ext4_fs_debug_features_ro(uint32_t features_ro)
{
- if (features_ro & EXT4_FEATURE_RO_COMPAT_SPARSE_SUPER)
+ if (features_ro & EXT4_FRO_COM_SPARSE_SUPER)
ext4_dbg(DEBUG_FS, DBG_NONE "sparse_super\n");
- if (features_ro & EXT4_FEATURE_RO_COMPAT_LARGE_FILE)
+ if (features_ro & EXT4_FRO_COM_LARGE_FILE)
ext4_dbg(DEBUG_FS, DBG_NONE "large_file\n");
- if (features_ro & EXT4_FEATURE_RO_COMPAT_BTREE_DIR)
+ if (features_ro & EXT4_FRO_COM_BTREE_DIR)
ext4_dbg(DEBUG_FS, DBG_NONE "btree_dir\n");
- if (features_ro & EXT4_FEATURE_RO_COMPAT_HUGE_FILE)
+ if (features_ro & EXT4_FRO_COM_HUGE_FILE)
ext4_dbg(DEBUG_FS, DBG_NONE "huge_file\n");
- if (features_ro & EXT4_FEATURE_RO_COMPAT_GDT_CSUM)
+ if (features_ro & EXT4_FRO_COM_GDT_CSUM)
ext4_dbg(DEBUG_FS, DBG_NONE "gtd_csum\n");
- if (features_ro & EXT4_FEATURE_RO_COMPAT_DIR_NLINK)
+ if (features_ro & EXT4_FRO_COM_DIR_NLINK)
ext4_dbg(DEBUG_FS, DBG_NONE "dir_nlink\n");
- if (features_ro & EXT4_FEATURE_RO_COMPAT_EXTRA_ISIZE)
+ if (features_ro & EXT4_FRO_COM_EXTRA_ISIZE)
ext4_dbg(DEBUG_FS, DBG_NONE "extra_isize\n");
- if (features_ro & EXT4_FEATURE_RO_COMPAT_QUOTA)
+ if (features_ro & EXT4_FRO_COM_QUOTA)
ext4_dbg(DEBUG_FS, DBG_NONE "quota\n");
- if (features_ro & EXT4_FEATURE_RO_COMPAT_BIGALLOC)
+ if (features_ro & EXT4_FRO_COM_BIGALLOC)
ext4_dbg(DEBUG_FS, DBG_NONE "bigalloc\n");
- if (features_ro & EXT4_FEATURE_RO_COMPAT_METADATA_CSUM)
+ if (features_ro & EXT4_FRO_COM_METADATA_CSUM)
ext4_dbg(DEBUG_FS, DBG_NONE "metadata_csum\n");
}
@@ -576,7 +576,7 @@
/* Compute the checksum only if the filesystem supports it */
if (ext4_sb_has_feature_read_only(sb,
- EXT4_FEATURE_RO_COMPAT_METADATA_CSUM)) {
+ EXT4_FRO_COM_METADATA_CSUM)) {
/* Use metadata_csum algorithm instead */
uint32_t le32_bgid = to_le32(bgid);
uint32_t orig_checksum, checksum;
@@ -597,7 +597,7 @@
crc = checksum & 0xFFFF;
} else if (ext4_sb_has_feature_read_only(sb,
- EXT4_FEATURE_RO_COMPAT_GDT_CSUM)) {
+ EXT4_FRO_COM_GDT_CSUM)) {
uint8_t *base = (uint8_t *)bg;
uint8_t *checksum = (uint8_t *)&bg->checksum;
@@ -656,7 +656,7 @@
uint16_t inode_size = ext4_get16(sb, inode_size);
if (ext4_sb_has_feature_read_only(sb,
- EXT4_FEATURE_RO_COMPAT_METADATA_CSUM)) {
+ EXT4_FRO_COM_METADATA_CSUM)) {
uint32_t orig_checksum;
uint32_t ino_index = to_le32(inode_ref->index);
@@ -689,7 +689,7 @@
{
struct ext4_sblock *sb = &inode_ref->fs->sb;
if (!ext4_sb_has_feature_read_only(sb,
- EXT4_FEATURE_RO_COMPAT_METADATA_CSUM))
+ EXT4_FRO_COM_METADATA_CSUM))
return;
ext4_inode_set_checksum(sb, inode_ref->inode,
@@ -1686,7 +1686,7 @@
uint32_t v =
ext4_get32(&inode_ref->fs->sb, features_read_only);
- v |= EXT4_FEATURE_RO_COMPAT_DIR_NLINK;
+ v |= EXT4_FRO_COM_DIR_NLINK;
ext4_set32(&inode_ref->fs->sb, features_read_only, v);
}
}
--- a/lwext4/ext4_ialloc.c
+++ b/lwext4/ext4_ialloc.c
@@ -91,7 +91,7 @@
{
uint32_t checksum = 0;
if (ext4_sb_has_feature_read_only(sb,
- EXT4_FEATURE_RO_COMPAT_METADATA_CSUM)) {
+ EXT4_FRO_COM_METADATA_CSUM)) {
uint32_t inodes_per_group =
ext4_get32(sb, inodes_per_group);
--- a/lwext4/ext4_inode.c
+++ b/lwext4/ext4_inode.c
@@ -195,7 +195,7 @@
uint64_t count = to_le32(inode->blocks_count_lo);
if (ext4_sb_has_feature_read_only(sb,
- EXT4_FEATURE_RO_COMPAT_HUGE_FILE)) {
+ EXT4_FRO_COM_HUGE_FILE)) {
/* 48-bit field */
count |= ((uint64_t)to_le16(inode->osd2.linux2.blocks_high))
@@ -229,7 +229,7 @@
/* Check if there can be used huge files (many blocks) */
if (!ext4_sb_has_feature_read_only(sb,
- EXT4_FEATURE_RO_COMPAT_HUGE_FILE))
+ EXT4_FRO_COM_HUGE_FILE))
return EINVAL;
/* 48-bit maximum */
--- a/lwext4/ext4_mkfs.c
+++ b/lwext4/ext4_mkfs.c
@@ -145,7 +145,7 @@
static bool has_superblock(struct ext4_mkfs_info *info, uint32_t bgid)
{
- if (!(info->feat_ro_compat & EXT4_FEATURE_RO_COMPAT_SPARSE_SUPER))
+ if (!(info->feat_ro_compat & EXT4_FRO_COM_SPARSE_SUPER))
return true;
return ext4_sb_sparse(bgid);
--- a/lwext4/ext4_super.c
+++ b/lwext4/ext4_super.c
@@ -89,7 +89,7 @@
static bool ext4_sb_verify_csum(struct ext4_sblock *s)
{
if (!ext4_sb_has_feature_read_only(s,
- EXT4_FEATURE_RO_COMPAT_METADATA_CSUM))
+ EXT4_FRO_COM_METADATA_CSUM))
return true;
if (s->checksum_type != to_le32(EXT4_CHECKSUM_CRC32C))
@@ -101,7 +101,7 @@
static void ext4_sb_set_csum(struct ext4_sblock *s)
{
if (!ext4_sb_has_feature_read_only(s,
- EXT4_FEATURE_RO_COMPAT_METADATA_CSUM))
+ EXT4_FRO_COM_METADATA_CSUM))
return;
s->checksum = to_le32(ext4_sb_csum(s));
@@ -183,7 +183,7 @@
bool ext4_sb_is_super_in_bg(struct ext4_sblock *s, uint32_t group)
{
if (ext4_sb_has_feature_read_only(
- s, EXT4_FEATURE_RO_COMPAT_SPARSE_SUPER) &&
+ s, EXT4_FRO_COM_SPARSE_SUPER) &&
!ext4_sb_sparse(group))
return false;
return true;
--- a/lwext4/ext4_types.h
+++ b/lwext4/ext4_types.h
@@ -203,16 +203,16 @@
/*
* Read-only compatible features
*/
-#define EXT4_FEATURE_RO_COMPAT_SPARSE_SUPER 0x0001
-#define EXT4_FEATURE_RO_COMPAT_LARGE_FILE 0x0002
-#define EXT4_FEATURE_RO_COMPAT_BTREE_DIR 0x0004
-#define EXT4_FEATURE_RO_COMPAT_HUGE_FILE 0x0008
-#define EXT4_FEATURE_RO_COMPAT_GDT_CSUM 0x0010
-#define EXT4_FEATURE_RO_COMPAT_DIR_NLINK 0x0020
-#define EXT4_FEATURE_RO_COMPAT_EXTRA_ISIZE 0x0040
-#define EXT4_FEATURE_RO_COMPAT_QUOTA 0x0100
-#define EXT4_FEATURE_RO_COMPAT_BIGALLOC 0x0200
-#define EXT4_FEATURE_RO_COMPAT_METADATA_CSUM 0x0400
+#define EXT4_FRO_COM_SPARSE_SUPER 0x0001
+#define EXT4_FRO_COM_LARGE_FILE 0x0002
+#define EXT4_FRO_COM_BTREE_DIR 0x0004
+#define EXT4_FRO_COM_HUGE_FILE 0x0008
+#define EXT4_FRO_COM_GDT_CSUM 0x0010
+#define EXT4_FRO_COM_DIR_NLINK 0x0020
+#define EXT4_FRO_COM_EXTRA_ISIZE 0x0040
+#define EXT4_FRO_COM_QUOTA 0x0100
+#define EXT4_FRO_COM_BIGALLOC 0x0200
+#define EXT4_FRO_COM_METADATA_CSUM 0x0400
/*
* Incompatible features
@@ -241,8 +241,8 @@
(EXT4_FEATURE_INCOMPAT_FILETYPE | EXT4_FEATURE_INCOMPAT_META_BG)
#define EXT2_FEATURE_RO_COMPAT_SUPP \
- (EXT4_FEATURE_RO_COMPAT_SPARSE_SUPER | \
- EXT4_FEATURE_RO_COMPAT_LARGE_FILE | EXT4_FEATURE_RO_COMPAT_BTREE_DIR)
+ (EXT4_FRO_COM_SPARSE_SUPER | \
+ EXT4_FRO_COM_LARGE_FILE | EXT4_FRO_COM_BTREE_DIR)
/*
* EXT3 supported feature set
@@ -253,8 +253,8 @@
(EXT4_FEATURE_INCOMPAT_FILETYPE | EXT4_FEATURE_INCOMPAT_META_BG)
#define EXT3_FEATURE_RO_COMPAT_SUPP \
- (EXT4_FEATURE_RO_COMPAT_SPARSE_SUPER | \
- EXT4_FEATURE_RO_COMPAT_LARGE_FILE | EXT4_FEATURE_RO_COMPAT_BTREE_DIR)
+ (EXT4_FRO_COM_SPARSE_SUPER | \
+ EXT4_FRO_COM_LARGE_FILE | EXT4_FRO_COM_BTREE_DIR)
/*
* EXT4 supported feature set
@@ -267,12 +267,12 @@
EXT4_FEATURE_INCOMPAT_64BIT)
#define EXT4_FEATURE_RO_COMPAT_SUPP \
- (EXT4_FEATURE_RO_COMPAT_SPARSE_SUPER | \
- EXT4_FEATURE_RO_COMPAT_METADATA_CSUM | \
- EXT4_FEATURE_RO_COMPAT_LARGE_FILE | EXT4_FEATURE_RO_COMPAT_GDT_CSUM | \
- EXT4_FEATURE_RO_COMPAT_DIR_NLINK | \
- EXT4_FEATURE_RO_COMPAT_EXTRA_ISIZE | \
- EXT4_FEATURE_RO_COMPAT_BTREE_DIR | EXT4_FEATURE_RO_COMPAT_HUGE_FILE)
+ (EXT4_FRO_COM_SPARSE_SUPER | \
+ EXT4_FRO_COM_METADATA_CSUM | \
+ EXT4_FRO_COM_LARGE_FILE | EXT4_FRO_COM_GDT_CSUM | \
+ EXT4_FRO_COM_DIR_NLINK | \
+ EXT4_FRO_COM_EXTRA_ISIZE | \
+ EXT4_FRO_COM_BTREE_DIR | EXT4_FRO_COM_HUGE_FILE)
/*Ignored features:
* RECOVER - journaling in lwext4 is not supported
@@ -289,9 +289,9 @@
/*TODO: Features read only to implement*/
#define EXT4_FEATURE_RO_COMPAT_SUPP
- EXT4_FEATURE_RO_COMPAT_BIGALLOC |\
- EXT4_FEATURE_RO_COMPAT_METADATA_CSUM|\
- EXT4_FEATURE_RO_COMPAT_QUOTA)
+ EXT4_FRO_COM_BIGALLOC |\
+ EXT4_FRO_COM_METADATA_CSUM|\
+ EXT4_FRO_COM_QUOTA)
#endif
struct ext4_fs {
--- a/lwext4/ext4_xattr.c
+++ b/lwext4/ext4_xattr.c
@@ -122,7 +122,7 @@
struct ext4_sblock *sb = &inode_ref->fs->sb;
if (ext4_sb_has_feature_read_only(sb,
- EXT4_FEATURE_RO_COMPAT_METADATA_CSUM)) {
+ EXT4_FRO_COM_METADATA_CSUM)) {
uint32_t orig_checksum;
/* Preparation: temporarily set bg checksum to 0 */
@@ -149,7 +149,7 @@
{
struct ext4_sblock *sb = &inode_ref->fs->sb;
if (!ext4_sb_has_feature_read_only(sb,
- EXT4_FEATURE_RO_COMPAT_METADATA_CSUM))
+ EXT4_FRO_COM_METADATA_CSUM))
return;
header->h_checksum =