[PATCH V2 3/6] erofs-utils: fix general style problem

Huang Jianan jnhuang95 at gmail.com
Fri Sep 3 23:40:32 AEST 2021


From: Huang Jianan <huangjianan at oppo.com>

Signed-off-by: Huang Jianan <huangjianan at oppo.com>
---
 include/erofs/block_list.h | 4 ++--
 lib/block_list.c           | 5 +----
 lib/compress.c             | 9 ++++-----
 lib/compressor.c           | 2 +-
 lib/namei.c                | 3 ++-
 lib/xattr.c                | 2 +-
 mkfs/main.c                | 2 +-
 7 files changed, 12 insertions(+), 15 deletions(-)

diff --git a/include/erofs/block_list.h b/include/erofs/block_list.h
index fca476a..dcc0e50 100644
--- a/include/erofs/block_list.h
+++ b/include/erofs/block_list.h
@@ -18,8 +18,8 @@ void erofs_droid_blocklist_write_tail_end(struct erofs_inode *inode,
 #else
 static inline void erofs_droid_blocklist_write(struct erofs_inode *inode,
 				 erofs_blk_t blk_start, erofs_blk_t nblocks) {}
-static inline
-void erofs_droid_blocklist_write_tail_end(struct erofs_inode *inode,
+static inline void
+erofs_droid_blocklist_write_tail_end(struct erofs_inode *inode,
 					  erofs_blk_t blkaddr) {}
 #endif
 #endif
diff --git a/lib/block_list.c b/lib/block_list.c
index 73c1bde..15bb5cf 100644
--- a/lib/block_list.c
+++ b/lib/block_list.c
@@ -11,13 +11,10 @@
 #define pr_fmt(fmt) "EROFS block_list: " FUNC_LINE_FMT fmt "\n"
 #include "erofs/print.h"
 
-static FILE *block_list_fp = NULL;
+static FILE *block_list_fp;
 
 int erofs_droid_blocklist_fopen(void)
 {
-	if (block_list_fp)
-		return 0;
-
 	block_list_fp = fopen(cfg.block_list_file, "w");
 
 	if (!block_list_fp)
diff --git a/lib/compress.c b/lib/compress.c
index 5ac9427..6df30ea 100644
--- a/lib/compress.c
+++ b/lib/compress.c
@@ -292,13 +292,12 @@ static void *write_compacted_indexes(u8 *out,
 	bool update_blkaddr;
 	erofs_blk_t blkaddr;
 
-	if (destsize == 4) {
+	if (destsize == 4)
 		vcnt = 2;
-	} else if (destsize == 2 && logical_clusterbits == 12) {
+	else if (destsize == 2 && logical_clusterbits == 12)
 		vcnt = 16;
-	} else {
+	else
 		return ERR_PTR(-EINVAL);
-	}
 	encodebits = (vcnt * destsize * 8 - 32) / vcnt;
 	blkaddr = *blkaddr_ret;
 	update_blkaddr = erofs_sb_has_big_pcluster();
@@ -467,8 +466,8 @@ int erofs_write_compressed_file(struct erofs_inode *inode)
 	erofs_blk_t blkaddr, compressed_blocks;
 	unsigned int legacymetasize;
 	int ret, fd;
-
 	u8 *compressmeta = malloc(vle_compressmeta_capacity(inode->i_size));
+
 	if (!compressmeta)
 		return -ENOMEM;
 
diff --git a/lib/compressor.c b/lib/compressor.c
index c14fc05..1f1a33d 100644
--- a/lib/compressor.c
+++ b/lib/compressor.c
@@ -26,7 +26,7 @@ int erofs_compress_destsize(struct erofs_compress *c,
 			    void *dst,
 			    unsigned int dstsize)
 {
-	unsigned uncompressed_size;
+	unsigned int uncompressed_size;
 	int ret;
 
 	DBG_BUGON(!c->alg);
diff --git a/lib/namei.c b/lib/namei.c
index 755a5ad..f96e400 100644
--- a/lib/namei.c
+++ b/lib/namei.c
@@ -243,7 +243,8 @@ static int link_path_walk(const char *name, struct nameidata *nd)
 
 		name = p;
 		/* Skip until no more slashes. */
-		for (name = p; *name == '/'; ++name);
+		for (name = p; *name == '/'; ++name)
+			;
 	}
 	return 0;
 }
diff --git a/lib/xattr.c b/lib/xattr.c
index ffc5f7a..196133a 100644
--- a/lib/xattr.c
+++ b/lib/xattr.c
@@ -215,7 +215,7 @@ static struct xattr_item *erofs_get_selabel_xattr(const char *srcpath,
 				       erofs_fspath(srcpath));
 		else
 #endif
-		ret = asprintf(&fspath, "/%s", erofs_fspath(srcpath));
+			ret = asprintf(&fspath, "/%s", erofs_fspath(srcpath));
 		if (ret <= 0)
 			return ERR_PTR(-ENOMEM);
 
diff --git a/mkfs/main.c b/mkfs/main.c
index debb754..40ca94f 100644
--- a/mkfs/main.c
+++ b/mkfs/main.c
@@ -174,7 +174,7 @@ static int mkfs_parse_options_cfg(int argc, char *argv[])
 	char *endptr;
 	int opt, i;
 
-	while((opt = getopt_long(argc, argv, "d:x:z:E:T:U:C:",
+	while ((opt = getopt_long(argc, argv, "d:x:z:E:T:U:C:",
 				 long_options, NULL)) != -1) {
 		switch (opt) {
 		case 'z':
-- 
2.25.1



More information about the Linux-erofs mailing list