ext4_journal: handle EXT4_FINCOM_RECOVER flag properly.
[lwext4.git] / lwext4 / ext4_super.h
index 2dac61a610c07f04984967fb0b53fbd51081a63d..2172698e5981a1ab59465e72554f3b5f86275afe 100644 (file)
 #ifndef EXT4_SUPER_H_
 #define EXT4_SUPER_H_
 
+#ifdef __cplusplus
+extern "C" {
+#endif
+
 #include "ext4_config.h"
 #include "ext4_types.h"
 
@@ -54,6 +58,15 @@ static inline uint64_t ext4_sb_get_blocks_cnt(struct ext4_sblock *s)
               to_le32(s->blocks_count_lo);
 }
 
+/**@brief   Blocks count set  in superblock.
+ * @param   s superblock descriptor
+ * @return  count of blocks*/
+static inline void ext4_sb_set_blocks_cnt(struct ext4_sblock *s, uint64_t cnt)
+{
+       s->blocks_count_lo = to_le32((cnt << 32) >> 32);
+       s->blocks_count_hi = to_le32(cnt >> 32);
+}
+
 /**@brief   Free blocks count get stored in superblock.
  * @param   s superblock descriptor
  * @return  free blocks*/
@@ -108,8 +121,7 @@ static inline bool ext4_sb_check_flag(struct ext4_sblock *s, uint32_t v)
  * @param   s superblock descriptor
  * @param   v feature to check
  * @return  true if feature is supported*/
-static inline bool ext4_sb_has_feature_compatible(struct ext4_sblock *s,
-                                                 uint32_t v)
+static inline bool ext4_sb_feature_com(struct ext4_sblock *s, uint32_t v)
 {
        return to_le32(s->features_compatible) & v;
 }
@@ -118,8 +130,7 @@ static inline bool ext4_sb_has_feature_compatible(struct ext4_sblock *s,
  * @param   s superblock descriptor
  * @param   v feature to check
  * @return  true if feature is supported*/
-static inline bool ext4_sb_has_feature_incompatible(struct ext4_sblock *s,
-                                                   uint32_t v)
+static inline bool ext4_sb_feature_incom(struct ext4_sblock *s, uint32_t v)
 {
        return to_le32(s->features_incompatible) & v;
 }
@@ -128,8 +139,7 @@ static inline bool ext4_sb_has_feature_incompatible(struct ext4_sblock *s,
  * @param   s superblock descriptor
  * @param   v flag to check
  * @return  true if flag is supported*/
-static inline bool ext4_sb_has_feature_read_only(struct ext4_sblock *s,
-                                                uint32_t v)
+static inline bool ext4_sb_feature_ro_com(struct ext4_sblock *s, uint32_t v)
 {
        return to_le32(s->features_read_only) & v;
 }
@@ -216,6 +226,10 @@ uint32_t ext4_bg_num_gdb(struct ext4_sblock *s, uint32_t group);
 uint32_t ext4_num_base_meta_clusters(struct ext4_sblock *s,
                                     uint32_t block_group);
 
+#ifdef __cplusplus
+}
+#endif
+
 #endif /* EXT4_SUPER_H_ */
 
 /**