shithub: lwext4

Download patch

ref: 1a5e7936d092eb17327fe1df4f7d77adbf12d686
parent: 0d391d0e7cffe2d2910775b2a3550e6d4334f9f5
author: gkostka <kostka.grzegorz@gmail.com>
date: Sat Jun 27 19:16:25 EDT 2015

Change structure braces policy

--- a/.clang-format
+++ b/.clang-format
@@ -1,6 +1,6 @@
 BasedOnStyle: LLVM
 IndentWidth: 4
 UseTab: Never
-BreakBeforeBraces: Linux
+BreakBeforeBraces: Stroustrup
 AllowShortIfStatementsOnASingleLine: false
 IndentCaseLabels: false
--- a/lwext4/ext4.c
+++ b/lwext4/ext4.c
@@ -65,8 +65,7 @@
     } while (0)
 
 /**@brief   Mount point descrpitor.*/
-struct ext4_mountpoint
-{
+struct ext4_mountpoint {
 
     /**@brief   Mount done flag.*/
     bool mounted;
@@ -85,8 +84,7 @@
 };
 
 /**@brief   Block devices descriptor.*/
-struct _ext4_devices
-{
+struct _ext4_devices {
 
     /**@brief   Block device name (@ref ext4_device_register)*/
     char name[32];
--- a/lwext4/ext4.h
+++ b/lwext4/ext4.h
@@ -89,8 +89,7 @@
 /********************************OS LOCK INFERFACE***************************/
 
 /**@brief   OS dependent lock interface.*/
-struct ext4_lock
-{
+struct ext4_lock {
 
     /**@brief   Lock access to mount point*/
     void (*lock)(void);
@@ -102,8 +101,7 @@
 /********************************FILE DESCRIPTOR*****************************/
 
 /**@brief   File descriptor*/
-typedef struct ext4_file
-{
+typedef struct ext4_file {
 
     /**@brief   Mount point handle.*/
     struct ext4_mountpoint *mp;
@@ -135,8 +133,7 @@
 };
 
 /**@brief   Directory entry descriptor. Copy from ext4_types.h*/
-typedef struct
-{
+typedef struct {
     uint32_t inode;
     uint16_t entry_length;
     uint8_t name_length;
@@ -144,8 +141,7 @@
     uint8_t name[255];
 } ext4_direntry;
 
-typedef struct
-{
+typedef struct {
     /**@brief   File descriptor*/
     ext4_file f;
     /**@brief   Current directory entry.*/
@@ -184,8 +180,7 @@
 int ext4_umount(char *mount_point);
 
 /**@brief   Some of the filesystem stats.*/
-struct ext4_mount_stats
-{
+struct ext4_mount_stats {
     uint32_t inodes_count;
     uint32_t free_inodes_count;
     uint64_t blocks_count;
--- a/lwext4/ext4_bcache.h
+++ b/lwext4/ext4_bcache.h
@@ -43,8 +43,7 @@
 #include <stdbool.h>
 
 /**@brief   Single block descriptor.*/
-struct ext4_block
-{
+struct ext4_block {
     /**@brief   Dirty flag.*/
     bool dirty;
 
@@ -59,8 +58,7 @@
 };
 
 /**@brief   Block cache descriptor.*/
-struct ext4_bcache
-{
+struct ext4_bcache {
 
     /**@brief   Item count in block cache*/
     uint32_t cnt;
--- a/lwext4/ext4_blockdev.h
+++ b/lwext4/ext4_blockdev.h
@@ -47,8 +47,7 @@
 #define EXT4_BDEV_INITIALIZED (1 << 0)
 
 /**@brief   Definiton of the simple block device.*/
-struct ext4_blockdev
-{
+struct ext4_blockdev {
 
     /**@brief   Open device function
      * @param   bdev block device.*/
--- a/lwext4/ext4_dir_idx.c
+++ b/lwext4/ext4_dir_idx.c
@@ -189,8 +189,7 @@
 }
 
 /**@brief Sort entry item.*/
-struct ext4_dx_sort_entry
-{
+struct ext4_dx_sort_entry {
     uint32_t hash;
     uint32_t rec_len;
     void *dentry;
--- a/lwext4/ext4_types.h
+++ b/lwext4/ext4_types.h
@@ -50,8 +50,7 @@
 /*
  * Structure of the super block
  */
-struct ext4_sblock
-{
+struct ext4_sblock {
     uint32_t inodes_count;             /* I-nodes count */
     uint32_t blocks_count_lo;          /* Blocks count */
     uint32_t reserved_blocks_count_lo; /* Reserved blocks count */
@@ -160,12 +159,9 @@
 /*
  * Misc. filesystem flags
  */
-#define EXT4_SUPERBLOCK_FLAGS_SIGNED_HASH 0x0001   /* Signed dirhash in use */
-#define EXT4_SUPERBLOCK_FLAGS_UNSIGNED_HASH 0x0002 /* Unsigned dirhash in use  \
-                                                      */
-#define EXT4_SUPERBLOCK_FLAGS_TEST_FILESYS 0x0004  /* to test development code \
-                                                      */
-
+#define EXT4_SUPERBLOCK_FLAGS_SIGNED_HASH 0x0001
+#define EXT4_SUPERBLOCK_FLAGS_UNSIGNED_HASH 0x0002
+#define EXT4_SUPERBLOCK_FLAGS_TEST_FILESYS 0x0004
 /*
  * Filesystem states
  */
@@ -283,8 +279,7 @@
                      EXT4_FEATURE_RO_COMPAT_QUOTA)
 #endif
 
-struct ext4_fs
-{
+struct ext4_fs {
     struct ext4_blockdev *bdev;
     struct ext4_sblock sb;
 
@@ -294,17 +289,17 @@
     uint32_t last_inode_bg_id;
 };
 
-#define EXT4_BLOCK_GROUP_INODE_UNINIT 0x0001 /* Inode table/bitmap not in use  \
-                                                */
-#define EXT4_BLOCK_GROUP_BLOCK_UNINIT 0x0002 /* Block bitmap not in use */
-#define EXT4_BLOCK_GROUP_ITABLE_ZEROED                                         \
-    0x0004 /* On-disk itable initialized to zero */
+/* Inode table/bitmap not in use */
+#define EXT4_BLOCK_GROUP_INODE_UNINIT 0x0001
+/* Block bitmap not in use */
+#define EXT4_BLOCK_GROUP_BLOCK_UNINIT 0x0002
+/* On-disk itable initialized to zero */
+#define EXT4_BLOCK_GROUP_ITABLE_ZEROED 0x0004
 
 /*
  * Structure of a blocks group descriptor
  */
-struct ext4_bgroup
-{
+struct ext4_bgroup {
     uint32_t block_bitmap_lo;            /* Blocks bitmap block */
     uint32_t inode_bitmap_lo;            /* Inodes bitmap block */
     uint32_t inode_table_first_block_lo; /* Inodes table block */
@@ -331,8 +326,7 @@
     uint32_t reserved;                   /* Padding */
 };
 
-struct ext4_block_group_ref
-{
+struct ext4_block_group_ref {
     struct ext4_block block;
     struct ext4_bgroup *block_group;
     struct ext4_fs *fs;
@@ -360,8 +354,7 @@
 /*
  * Structure of an inode on the disk
  */
-struct ext4_inode
-{
+struct ext4_inode {
     uint16_t mode;                      /* File mode */
     uint16_t uid;                       /* Low 16 bits of owner uid */
     uint32_t size_lo;                   /* Size in bytes */
@@ -380,10 +373,8 @@
     uint32_t size_hi;
     uint32_t obso_faddr; /* Obsoleted fragment address */
 
-    union
-    {
-        struct
-        {
+    union {
+        struct {
             uint16_t blocks_high;
             uint16_t file_acl_high;
             uint16_t uid_high;
@@ -390,8 +381,7 @@
             uint16_t gid_high;
             uint32_t reserved2;
         } linux2;
-        struct
-        {
+        struct {
             uint16_t reserved1;
             uint16_t mode_high;
             uint16_t uid_high;
@@ -454,8 +444,7 @@
 
 #define EXT4_INODE_ROOT_INDEX 2
 
-struct ext4_inode_ref
-{
+struct ext4_inode_ref {
     struct ext4_block block;
     struct ext4_inode *inode;
     struct ext4_fs *fs;
@@ -474,8 +463,7 @@
 #define EXT4_DIRECTORY_FILETYPE_SOCK 6
 #define EXT4_DIRECTORY_FILETYPE_SYMLINK 7
 
-union ext4_directory_entry_ll_internal
-{
+union ext4_directory_entry_ll_internal {
     uint8_t name_length_high; /* Higher 8 bits of name length */
     uint8_t inode_type;       /* Type of referenced inode (in rev >= 0.5) */
 } __attribute__((packed));
@@ -483,8 +471,7 @@
 /**
  * Linked list directory entry structure
  */
-struct ext4_directory_entry_ll
-{
+struct ext4_directory_entry_ll {
     uint32_t inode;        /* I-node for the entry */
     uint16_t entry_length; /* Distance to the next directory entry */
     uint8_t name_length;   /* Lower 8 bits of name length */
@@ -494,8 +481,7 @@
     uint8_t name[EXT4_DIRECTORY_FILENAME_LEN]; /* Entry name */
 } __attribute__((packed));
 
-struct ext4_directory_iterator
-{
+struct ext4_directory_iterator {
     struct ext4_inode_ref *inode_ref;
     struct ext4_block current_block;
     uint64_t current_offset;
@@ -502,8 +488,7 @@
     struct ext4_directory_entry_ll *current;
 };
 
-struct ext4_directory_search_result
-{
+struct ext4_directory_search_result {
     struct ext4_block block;
     struct ext4_directory_entry_ll *dentry;
 };
@@ -510,14 +495,12 @@
 
 /* Structures for indexed directory */
 
-struct ext4_directory_dx_countlimit
-{
+struct ext4_directory_dx_countlimit {
     uint16_t limit;
     uint16_t count;
 };
 
-struct ext4_directory_dx_dot_entry
-{
+struct ext4_directory_dx_dot_entry {
     uint32_t inode;
     uint16_t entry_length;
     uint8_t name_length;
@@ -525,8 +508,7 @@
     uint8_t name[4];
 };
 
-struct ext4_directory_dx_root_info
-{
+struct ext4_directory_dx_root_info {
     uint32_t reserved_zero;
     uint8_t hash_version;
     uint8_t info_length;
@@ -534,21 +516,18 @@
     uint8_t unused_flags;
 };
 
-struct ext4_directory_dx_entry
-{
+struct ext4_directory_dx_entry {
     uint32_t hash;
     uint32_t block;
 };
 
-struct ext4_directory_dx_root
-{
+struct ext4_directory_dx_root {
     struct ext4_directory_dx_dot_entry dots[2];
     struct ext4_directory_dx_root_info info;
     struct ext4_directory_dx_entry entries[];
 };
 
-struct ext4_fake_directory_entry
-{
+struct ext4_fake_directory_entry {
     uint32_t inode;
     uint16_t entry_length;
     uint8_t name_length;
@@ -555,14 +534,12 @@
     uint8_t inode_type;
 };
 
-struct ext4_directory_dx_node
-{
+struct ext4_directory_dx_node {
     struct ext4_fake_directory_entry fake;
     struct ext4_directory_dx_entry entries[];
 };
 
-struct ext4_directory_dx_block
-{
+struct ext4_directory_dx_block {
     struct ext4_block block;
     struct ext4_directory_dx_entry *entries;
     struct ext4_directory_dx_entry *position;
@@ -576,8 +553,7 @@
  * This is the extent on-disk structure.
  * It's used at the bottom of the tree.
  */
-struct ext4_extent
-{
+struct ext4_extent {
     uint32_t first_block; /* First logical block extent covers */
     uint16_t block_count; /* Number of blocks covered by extent */
     uint16_t start_hi;    /* High 16 bits of physical block */
@@ -588,8 +564,7 @@
  * This is index on-disk structure.
  * It's used at all the levels except the bottom.
  */
-struct ext4_extent_index
-{
+struct ext4_extent_index {
     uint32_t first_block; /* Index covers logical blocks from 'block' */
 
     /**
@@ -605,8 +580,7 @@
 /*
  * Each block (leaves and indexes), even inode-stored has header.
  */
-struct ext4_extent_header
-{
+struct ext4_extent_header {
     uint16_t magic;
     uint16_t entries_count;     /* Number of valid entries */
     uint16_t max_entries_count; /* Capacity of store in entries */
@@ -614,8 +588,7 @@
     uint32_t generation;        /* generation of the tree */
 };
 
-struct ext4_extent_path
-{
+struct ext4_extent_path {
     struct ext4_block block;
     uint16_t depth;
     struct ext4_extent_header *header;
@@ -643,8 +616,7 @@
 
 #define EXT2_HTREE_EOF 0x7FFFFFFFUL
 
-struct ext4_hash_info
-{
+struct ext4_hash_info {
     uint32_t hash;
     uint32_t minor_hash;
     uint32_t hash_version;