shithub: lwext4

Download patch

ref: cfc7b2cf39210f7c38b6d42fb4fc678576499343
parent: 7879c285ab00cf261988b46638fe347b39cb142e
author: gkostka <[email protected]>
date: Tue Oct 27 16:15:59 EDT 2015

Feature set definitions refactoring (shorter names)

--- a/lwext4/ext4_config.h
+++ b/lwext4/ext4_config.h
@@ -54,41 +54,27 @@
 /*****************************************************************************/
 
 #if CONFIG_EXT_FEATURE_SET_LVL == F_SET_EXT2
-#define CONFIG_DIR_INDEX_ENABLE 0
-#define CONFIG_EXTENT_ENABLE 0
+/*Superblock features flag EXT2*/
+#define CONFIG_SUPPORTED_FCOM EXT2_SUPPORTED_FCOM
+#define CONFIG_SUPPORTED_FINCOM (EXT2_SUPPORTED_FINCOM | EXT_FINCOM_IGNORED)
+#define CONFIG_SUPPORTED_FRO_COM EXT2_SUPPORTED_FRO_COM
 
-/*Superblock features flag*/
-#define CONFIG_FEATURE_COMPAT_SUPP EXT2_FEATURE_COMPAT_SUPP
-
-#define CONFIG_FEATURE_INCOMPAT_SUPP                                           \
-	(EXT2_FEATURE_INCOMPAT_SUPP | FEATURE_INCOMPAT_IGNORED)
-
-#define CONFIG_FEATURE_RO_COMPAT_SUPP EXT2_FEATURE_RO_COMPAT_SUPP
 #elif CONFIG_EXT_FEATURE_SET_LVL == F_SET_EXT3
-#define CONFIG_DIR_INDEX_ENABLE 1
-#define CONFIG_EXTENT_ENABLE 0
-
-/*Superblock features flag*/
-#define CONFIG_FEATURE_COMPAT_SUPP EXT3_FEATURE_COMPAT_SUPP
-
-#define CONFIG_FEATURE_INCOMPAT_SUPP                                           \
-	(EXT3_FEATURE_INCOMPAT_SUPP | FEATURE_INCOMPAT_IGNORED)
-
-#define CONFIG_FEATURE_RO_COMPAT_SUPP EXT3_FEATURE_RO_COMPAT_SUPP
+/*Superblock features flag EXT3*/
+#define CONFIG_SUPPORTED_FCOM EXT3_SUPPORTED_FCOM
+#define CONFIG_SUPPORTED_FINCOM (EXT3_SUPPORTED_FINCOM | EXT_FINCOM_IGNORED)
+#define CONFIG_SUPPORTED_FRO_COM EXT3_SUPPORTED_FRO_COM
 #elif CONFIG_EXT_FEATURE_SET_LVL == F_SET_EXT4
-#define CONFIG_DIR_INDEX_ENABLE 1
-#define CONFIG_EXTENT_ENABLE 1
-
-/*Superblock features flag*/
-#define CONFIG_FEATURE_COMPAT_SUPP EXT4_FEATURE_COMPAT_SUPP
-
-#define CONFIG_FEATURE_INCOMPAT_SUPP                                           \
-	(EXT4_FEATURE_INCOMPAT_SUPP | FEATURE_INCOMPAT_IGNORED)
-
-#define CONFIG_FEATURE_RO_COMPAT_SUPP EXT4_FEATURE_RO_COMPAT_SUPP
+/*Superblock features flag EXT4*/
+#define CONFIG_SUPPORTED_FCOM EXT4_SUPPORTED_FCOM
+#define CONFIG_SUPPORTED_FINCOM (EXT4_SUPPORTED_FINCOM | EXT_FINCOM_IGNORED)
+#define CONFIG_SUPPORTED_FRO_COM EXT4_SUPPORTED_FRO_COM
 #else
 #define "Unsupported CONFIG_EXT_FEATURE_SET_LVL"
 #endif
+
+#define CONFIG_DIR_INDEX_ENABLE (CONFIG_SUPPORTED_FCOM & EXT4_FCOM_DIR_INDEX)
+#define CONFIG_EXTENT_ENABLE (CONFIG_SUPPORTED_FINCOM & EXT4_FINCOM_EXTENTS)
 
 /*****************************************************************************/
 
--- a/lwext4/ext4_fs.c
+++ b/lwext4/ext4_fs.c
@@ -217,7 +217,7 @@
 
 	/*Check features_incompatible*/
 	v = (ext4_get32(&fs->sb, features_incompatible) &
-	     (~CONFIG_FEATURE_INCOMPAT_SUPP));
+	     (~CONFIG_SUPPORTED_FINCOM));
 	if (v) {
 		ext4_dbg(DEBUG_FS, DBG_ERROR
 				"sblock has unsupported features incompatible:\n");
@@ -227,7 +227,7 @@
 
 	/*Check features_read_only*/
 	v = (ext4_get32(&fs->sb, features_read_only) &
-	     (~CONFIG_FEATURE_RO_COMPAT_SUPP));
+	     (~CONFIG_SUPPORTED_FRO_COM));
 	if (v) {
 		ext4_dbg(DEBUG_FS, DBG_WARN
 				"sblock has unsupported features read only:\n");
--- a/lwext4/ext4_mkfs.c
+++ b/lwext4/ext4_mkfs.c
@@ -388,9 +388,9 @@
 
 	info->inodes_per_group = compute_inodes_per_group(info);
 
-	info->feat_compat = CONFIG_FEATURE_COMPAT_SUPP;
-	info->feat_ro_compat = CONFIG_FEATURE_RO_COMPAT_SUPP;
-	info->feat_incompat = CONFIG_FEATURE_INCOMPAT_SUPP;
+	info->feat_compat = CONFIG_SUPPORTED_FCOM;
+	info->feat_ro_compat = CONFIG_SUPPORTED_FRO_COM;
+	info->feat_incompat = CONFIG_SUPPORTED_FINCOM;
 
 	if (info->no_journal == 0)
 		info->feat_compat |= EXT4_FCOM_HAS_JOURNAL;
--- a/lwext4/ext4_types.h
+++ b/lwext4/ext4_types.h
@@ -235,24 +235,24 @@
 /*
  * EXT2 supported feature set
  */
-#define EXT2_FEATURE_COMPAT_SUPP 0x0000
+#define EXT2_SUPPORTED_FCOM 0x0000
 
-#define EXT2_FEATURE_INCOMPAT_SUPP                                   \
+#define EXT2_SUPPORTED_FINCOM                                   \
 	(EXT4_FINCOM_FILETYPE | EXT4_FINCOM_META_BG)
 
-#define EXT2_FEATURE_RO_COMPAT_SUPP                                  \
-	(EXT4_FRO_COM_SPARSE_SUPER |                                 \
+#define EXT2_SUPPORTED_FRO_COM                                  \
+	(EXT4_FRO_COM_SPARSE_SUPER |                            \
 	 EXT4_FRO_COM_LARGE_FILE | EXT4_FRO_COM_BTREE_DIR)
 
 /*
  * EXT3 supported feature set
  */
-#define EXT3_FEATURE_COMPAT_SUPP (EXT4_FCOM_DIR_INDEX)
+#define EXT3_SUPPORTED_FCOM (EXT4_FCOM_DIR_INDEX)
 
-#define EXT3_FEATURE_INCOMPAT_SUPP                            \
+#define EXT3_SUPPORTED_FINCOM                                 \
 	(EXT4_FINCOM_FILETYPE | EXT4_FINCOM_META_BG)
 
-#define EXT3_FEATURE_RO_COMPAT_SUPP                           \
+#define EXT3_SUPPORTED_FRO_COM                                \
 	(EXT4_FRO_COM_SPARSE_SUPER |                          \
 	 EXT4_FRO_COM_LARGE_FILE | EXT4_FRO_COM_BTREE_DIR)
 
@@ -259,14 +259,14 @@
 /*
  * EXT4 supported feature set
  */
-#define EXT4_FEATURE_COMPAT_SUPP (EXT4_FCOM_DIR_INDEX)
+#define EXT4_SUPPORTED_FCOM (EXT4_FCOM_DIR_INDEX)
 
-#define EXT4_FEATURE_INCOMPAT_SUPP                         \
+#define EXT4_SUPPORTED_FINCOM                              \
 	(EXT4_FINCOM_FILETYPE | EXT4_FINCOM_META_BG |      \
 	 EXT4_FINCOM_EXTENTS | EXT4_FINCOM_FLEX_BG |       \
 	 EXT4_FINCOM_64BIT)
 
-#define EXT4_FEATURE_RO_COMPAT_SUPP                        \
+#define EXT4_SUPPORTED_FRO_COM                             \
 	(EXT4_FRO_COM_SPARSE_SUPER |                       \
 	 EXT4_FRO_COM_METADATA_CSUM |                      \
 	 EXT4_FRO_COM_LARGE_FILE | EXT4_FRO_COM_GDT_CSUM | \
@@ -279,16 +279,16 @@
  *           (probably won't be ever...)
  * MMP - multi-mout protection (impossible scenario)
  * */
-#define FEATURE_INCOMPAT_IGNORED                          \
+#define EXT_FINCOM_IGNORED                                 \
 	EXT4_FINCOM_RECOVER | EXT4_FINCOM_MMP
 
 #if 0
 /*TODO: Features incompatible to implement*/
-#define EXT4_FEATURE_INCOMPAT_SUPP
+#define EXT4_SUPPORTED_FINCOM
                      (EXT4_FINCOM_INLINE_DATA)
 
 /*TODO: Features read only to implement*/
-#define EXT4_FEATURE_RO_COMPAT_SUPP
+#define EXT4_SUPPORTED_FRO_COM
                      EXT4_FRO_COM_BIGALLOC |\
                      EXT4_FRO_COM_QUOTA)
 #endif