shithub: lwext4

Download patch

ref: 2322b927d8ec8a20b5515ec39f1bdac58b63fe86
parent: ee301d4abbb9e17aa0c0fdb0c750925da3e03305
author: gkostka <kostka.grzegorz@gmail.com>
date: Tue Jun 16 06:02:01 EDT 2015

clang-format: ext4_bitmap

--- a/lwext4/ext4_bitmap.c
+++ b/lwext4/ext4_bitmap.c
@@ -39,14 +39,13 @@
 
 #include <ext4_errno.h>
 
-
 void ext4_bmap_bits_free(uint8_t *bmap, uint32_t sbit, uint32_t bcnt)
 {
     uint32_t i = sbit;
 
-    while(i & 7){
+    while (i & 7) {
 
-        if(!bcnt)
+        if (!bcnt)
             return;
 
         ext4_bmap_bit_clr(bmap, i);
@@ -54,10 +53,10 @@
         bcnt--;
         i++;
     }
-    sbit  = i;
+    sbit = i;
     bmap += (sbit >> 3);
 
-    while(bcnt >= 32){
+    while (bcnt >= 32) {
         *(uint32_t *)bmap = 0;
         bmap += 4;
         bcnt -= 32;
@@ -64,7 +63,7 @@
         sbit += 32;
     }
 
-    while(bcnt >= 16){
+    while (bcnt >= 16) {
         *(uint16_t *)bmap = 0;
         bmap += 2;
         bcnt -= 16;
@@ -71,7 +70,7 @@
         sbit += 16;
     }
 
-    while(bcnt >= 8){
+    while (bcnt >= 8) {
         *bmap = 0;
         bmap += 1;
         bcnt -= 8;
@@ -83,10 +82,8 @@
     }
 }
 
-
-
 int ext4_bmap_bit_find_clr(uint8_t *bmap, uint32_t sbit, uint32_t ebit,
-    uint32_t *bit_id)
+                           uint32_t *bit_id)
 {
     uint32_t i;
     uint32_t bcnt = ebit - sbit;
@@ -93,12 +90,12 @@
 
     i = sbit;
 
-    while(i & 7){
+    while (i & 7) {
 
-        if(!bcnt)
+        if (!bcnt)
             return ENOSPC;
 
-        if(ext4_bmap_is_bit_clr(bmap, i)){
+        if (ext4_bmap_is_bit_clr(bmap, i)) {
             *bit_id = sbit;
             return EOK;
         }
@@ -107,12 +104,11 @@
         bcnt--;
     }
 
-    sbit  = i;
+    sbit = i;
     bmap += (sbit >> 3);
 
-
-    while(bcnt >= 32){
-        if(*(uint32_t *)bmap != 0xFFFFFFFF)
+    while (bcnt >= 32) {
+        if (*(uint32_t *)bmap != 0xFFFFFFFF)
             goto finish_it;
 
         bmap += 4;
@@ -120,8 +116,8 @@
         sbit += 32;
     }
 
-    while(bcnt >= 16){
-        if(*(uint16_t *)bmap != 0xFFFF)
+    while (bcnt >= 16) {
+        if (*(uint16_t *)bmap != 0xFFFF)
             goto finish_it;
 
         bmap += 2;
@@ -129,11 +125,11 @@
         sbit += 16;
     }
 
-    finish_it:
-    while(bcnt >= 8){
-        if(*bmap != 0xFF){
+finish_it:
+    while (bcnt >= 8) {
+        if (*bmap != 0xFF) {
             for (i = 0; i < 8; ++i) {
-                if(ext4_bmap_is_bit_clr(bmap, i)){
+                if (ext4_bmap_is_bit_clr(bmap, i)) {
                     *bit_id = sbit + i;
                     return EOK;
                 }
@@ -146,7 +142,7 @@
     }
 
     for (i = 0; i < bcnt; ++i) {
-        if(ext4_bmap_is_bit_clr(bmap, i)){
+        if (ext4_bmap_is_bit_clr(bmap, i)) {
             *bit_id = sbit + i;
             return EOK;
         }
@@ -158,5 +154,3 @@
 /**
  * @}
  */
-
-
--- a/lwext4/ext4_bitmap.h
+++ b/lwext4/ext4_bitmap.h
@@ -34,7 +34,6 @@
  * @brief Block/inode bitmap allocator.
  */
 
-
 #ifndef EXT4_BITMAP_H_
 #define EXT4_BITMAP_H_
 
@@ -58,7 +57,6 @@
     *(bmap + (bit >> 3)) &= ~(1 << (bit & 7));
 }
 
-
 /**@brief   Check if the bitmap bit is set.
  * @param   bmap bitmap buffer
  * @param   bit bit to check*/
@@ -87,12 +85,10 @@
  * @param   bit_id output parameter (first free bit)
  * @return  standard error code*/
 int ext4_bmap_bit_find_clr(uint8_t *bmap, uint32_t sbit, uint32_t ebit,
-    uint32_t *bit_id);
+                           uint32_t *bit_id);
 
-
 #endif /* EXT4_BITMAP_H_ */
 
 /**
  * @}
  */
-