Change structure braces policy
authorgkostka <kostka.grzegorz@gmail.com>
Sat, 27 Jun 2015 21:16:25 +0000 (23:16 +0200)
committergkostka <kostka.grzegorz@gmail.com>
Sat, 27 Jun 2015 21:16:25 +0000 (23:16 +0200)
.clang-format
lwext4/ext4.c
lwext4/ext4.h
lwext4/ext4_bcache.h
lwext4/ext4_blockdev.h
lwext4/ext4_dir_idx.c
lwext4/ext4_types.h

index 6422547d00217348216b50b0f84871b2a1f97ae3..662c219501d3b94204c1419c33dbab975007044d 100644 (file)
@@ -1,6 +1,6 @@
 BasedOnStyle: LLVM
 IndentWidth: 4
 UseTab: Never
-BreakBeforeBraces: Linux
+BreakBeforeBraces: Stroustrup
 AllowShortIfStatementsOnASingleLine: false
 IndentCaseLabels: false
index 7ea21586ddb2f605b4ee2aef21404d2561cbfa42..dea3dfe53c02017933d39dfed6a6570e34bbf36d 100644 (file)
@@ -65,8 +65,7 @@
     } while (0)\r
 \r
 /**@brief   Mount point descrpitor.*/\r
-struct ext4_mountpoint\r
-{\r
+struct ext4_mountpoint {\r
 \r
     /**@brief   Mount done flag.*/\r
     bool mounted;\r
@@ -85,8 +84,7 @@ struct ext4_mountpoint
 };\r
 \r
 /**@brief   Block devices descriptor.*/\r
-struct _ext4_devices\r
-{\r
+struct _ext4_devices {\r
 \r
     /**@brief   Block device name (@ref ext4_device_register)*/\r
     char name[32];\r
index 3f7cf4453fe1e422a80cfad32a02810526b3c3e8..873698de434a2a65aaa6094a73f3c7a7a3df0dd8 100644 (file)
@@ -89,8 +89,7 @@
 /********************************OS LOCK INFERFACE***************************/\r
 \r
 /**@brief   OS dependent lock interface.*/\r
-struct ext4_lock\r
-{\r
+struct ext4_lock {\r
 \r
     /**@brief   Lock access to mount point*/\r
     void (*lock)(void);\r
@@ -102,8 +101,7 @@ struct ext4_lock
 /********************************FILE DESCRIPTOR*****************************/\r
 \r
 /**@brief   File descriptor*/\r
-typedef struct ext4_file\r
-{\r
+typedef struct ext4_file {\r
 \r
     /**@brief   Mount point handle.*/\r
     struct ext4_mountpoint *mp;\r
@@ -135,8 +133,7 @@ enum {
 };\r
 \r
 /**@brief   Directory entry descriptor. Copy from ext4_types.h*/\r
-typedef struct\r
-{\r
+typedef struct {\r
     uint32_t inode;\r
     uint16_t entry_length;\r
     uint8_t name_length;\r
@@ -144,8 +141,7 @@ typedef struct
     uint8_t name[255];\r
 } ext4_direntry;\r
 \r
-typedef struct\r
-{\r
+typedef struct {\r
     /**@brief   File descriptor*/\r
     ext4_file f;\r
     /**@brief   Current directory entry.*/\r
@@ -184,8 +180,7 @@ int ext4_mount(const char *dev_name, char *mount_point);
 int ext4_umount(char *mount_point);\r
 \r
 /**@brief   Some of the filesystem stats.*/\r
-struct ext4_mount_stats\r
-{\r
+struct ext4_mount_stats {\r
     uint32_t inodes_count;\r
     uint32_t free_inodes_count;\r
     uint64_t blocks_count;\r
index 95811c0c6ff4367f7bc17ea5cfb7694ed99064fd..692bd86559330820724312653f69177a0e5320b5 100644 (file)
@@ -43,8 +43,7 @@
 #include <stdbool.h>\r
 \r
 /**@brief   Single block descriptor.*/\r
-struct ext4_block\r
-{\r
+struct ext4_block {\r
     /**@brief   Dirty flag.*/\r
     bool dirty;\r
 \r
@@ -59,8 +58,7 @@ struct ext4_block
 };\r
 \r
 /**@brief   Block cache descriptor.*/\r
-struct ext4_bcache\r
-{\r
+struct ext4_bcache {\r
 \r
     /**@brief   Item count in block cache*/\r
     uint32_t cnt;\r
index a34a2900891fd324b2a1e318e167c3b2f4bcb031..884df965b6b618795123a15d5563fda16b79e0b0 100644 (file)
@@ -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.*/
index 37eef2b9b844b81b2a247fad6595c51e34e6d45f..a65d7ce252e78173ef6606ebc2295e8ac7922e2a 100644 (file)
@@ -189,8 +189,7 @@ ext4_dir_dx_entry_set_block(struct ext4_directory_dx_entry *entry,
 }\r
 \r
 /**@brief Sort entry item.*/\r
-struct ext4_dx_sort_entry\r
-{\r
+struct ext4_dx_sort_entry {\r
     uint32_t hash;\r
     uint32_t rec_len;\r
     void *dentry;\r
index 4d054590db64aa8dca5fcb9d111cc10dcdfd3e08..22d19d2fd966d522bb1f6d99db535dbbe252274a 100644 (file)
@@ -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 @@ struct ext4_sblock
 /*
  * 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 @@ struct ext4_sblock
                      EXT4_FEATURE_RO_COMPAT_QUOTA)
 #endif
 
-struct ext4_fs
-{
+struct ext4_fs {
     struct ext4_blockdev *bdev;
     struct ext4_sblock sb;
 
@@ -294,17 +289,17 @@ struct ext4_fs
     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 @@ struct ext4_bgroup
     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 @@ struct ext4_block_group_ref
 /*
  * 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,18 +373,15 @@ struct ext4_inode
     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;
             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 @@ struct ext4_inode
 
 #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 @@ struct ext4_inode_ref
 #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 @@ union ext4_directory_entry_ll_internal
 /**
  * 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,30 +481,26 @@ struct ext4_directory_entry_ll
     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;
     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;
 };
 
 /* 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 @@ struct ext4_directory_dx_dot_entry
     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,35 +516,30 @@ struct ext4_directory_dx_root_info
     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;
     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 @@ struct ext4_directory_dx_block
  * 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 @@ struct ext4_extent
  * 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 @@ struct ext4_extent_index
 /*
  * 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 @@ struct ext4_extent_header
     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 @@ struct ext4_extent_path
 
 #define EXT2_HTREE_EOF 0x7FFFFFFFUL
 
-struct ext4_hash_info
-{
+struct ext4_hash_info {
     uint32_t hash;
     uint32_t minor_hash;
     uint32_t hash_version;