diff options
| author | gkostka <kostka.grzegorz@gmail.com> | 2015-10-11 14:11:20 +0200 |
|---|---|---|
| committer | gkostka <kostka.grzegorz@gmail.com> | 2015-10-11 14:11:20 +0200 |
| commit | 193a315b1cb77111ce76592c3bf6fe9ef875df63 (patch) | |
| tree | e069ed0dd75ee5b4443c6d609962caf2a5b3ab7d | |
| parent | 23d805b5fafc38eb3a60e6663129e5abfe592f7b (diff) | |
Make ext4_sb_sparse public
| -rw-r--r-- | lwext4/ext4_super.c | 8 | ||||
| -rw-r--r-- | lwext4/ext4_super.h | 2 |
2 files changed, 6 insertions, 4 deletions
diff --git a/lwext4/ext4_super.c b/lwext4/ext4_super.c index 0258ca7..09f000a 100644 --- a/lwext4/ext4_super.c +++ b/lwext4/ext4_super.c @@ -123,7 +123,7 @@ bool ext4_sb_check(struct ext4_sblock *s) return true; } -static inline int is_multiple(uint32_t a, uint32_t b) +static inline int is_power_of(uint32_t a, uint32_t b) { while (1) { if (a < b) @@ -136,7 +136,7 @@ static inline int is_multiple(uint32_t a, uint32_t b) } } -static int ext4_sb_sparse(uint32_t group) +bool ext4_sb_sparse(uint32_t group) { if (group <= 1) return 1; @@ -144,8 +144,8 @@ static int ext4_sb_sparse(uint32_t group) if (!(group & 1)) return 0; - return (is_multiple(group, 7) || is_multiple(group, 5) || - is_multiple(group, 3)); + return (is_power_of(group, 7) || is_power_of(group, 5) || + is_power_of(group, 3)); } bool ext4_sb_is_super_in_bg(struct ext4_sblock *s, uint32_t group) diff --git a/lwext4/ext4_super.h b/lwext4/ext4_super.h index 9451218..02ec6f7 100644 --- a/lwext4/ext4_super.h +++ b/lwext4/ext4_super.h @@ -206,6 +206,8 @@ bool ext4_sb_check(struct ext4_sblock *s); * @return true if block group has superblock*/ bool ext4_sb_is_super_in_bg(struct ext4_sblock *s, uint32_t block_group); +bool ext4_sb_sparse(uint32_t group); + /**@brief TODO:*/ uint32_t ext4_bg_num_gdb(struct ext4_sblock *s, uint32_t group); |
