All of lore.kernel.org
 help / color / mirror / Atom feed
From: Huang Jianan <jnhuang95@gmail.com>
To: linux-erofs@lists.ozlabs.org
Subject: [PATCH 3/5] erofs-utils: fix general style problem
Date: Wed,  1 Sep 2021 00:51:14 +0800	[thread overview]
Message-ID: <20210831165116.16575-4-jnhuang95@gmail.com> (raw)
In-Reply-To: <20210831165116.16575-1-jnhuang95@gmail.com>

From: Huang Jianan <huangjianan@oppo.com>

Signed-off-by: Huang Jianan <huangjianan@oppo.com>
---
 fuse/main.c                | 5 +----
 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 +-
 8 files changed, 13 insertions(+), 19 deletions(-)

diff --git a/fuse/main.c b/fuse/main.c
index 34a9b7a..197943a 100644
--- a/fuse/main.c
+++ b/fuse/main.c
@@ -109,16 +109,13 @@ static struct options {
 	bool odebug;
 } fusecfg;
 
-#define OPTION(t, p)                           \
-    { t, offsetof(struct options, p), 1 }
+#define OPTION(t, p) { t, offsetof(struct options, p), 1 }
 static const struct fuse_opt option_spec[] = {
 	OPTION("--dbglevel=%u", debug_lvl),
 	OPTION("--help", show_help),
 	FUSE_OPT_END
 };
 
-#define OPTION(t, p)    { t, offsetof(struct options, p), 1 }
-
 static void usage(void)
 {
 	struct fuse_args args = FUSE_ARGS_INIT(0, NULL);
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 2b12d67..0530765 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 846a836..6bc5c4c 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 f4094a1..54c368a 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 39d4a96..821e6c9 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


  parent reply	other threads:[~2021-08-31 16:51 UTC|newest]

Thread overview: 21+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-08-31 16:51 [PATCH 0/5] erofs-utils: fix checkpatch.pl complains Huang Jianan
2021-08-31 16:51 ` [PATCH 1/5] erofs-utils: remove filename in the file Huang Jianan
2021-09-03  3:09   ` Gao Xiang
2021-08-31 16:51 ` [PATCH 2/5] erofs-utils: fix SPDX comment style Huang Jianan
2021-09-03  3:10   ` Gao Xiang
2021-08-31 16:51 ` Huang Jianan [this message]
2021-09-03  3:12   ` [PATCH 3/5] erofs-utils: fix general style problem Gao Xiang
2021-08-31 16:51 ` [PATCH 4/5] erofs-utils: remove unnecessary codes and comments Huang Jianan
2021-09-03  3:17   ` Gao Xiang
2021-08-31 16:51 ` [PATCH 5/5] erofs-utils: fix print style Huang Jianan
2021-09-03  3:18   ` Gao Xiang
2021-09-03 13:40 ` [PATCH V2 0/6] erofs-utils: fix checkpatch.pl complains Huang Jianan
2021-09-03 13:40   ` [PATCH V2 1/6] erofs-utils: clean up file headers & footers Huang Jianan
2021-09-03 15:03     ` Gao Xiang
2021-09-03 13:40   ` [PATCH V2 2/6] erofs-utils: fix SPDX comment style Huang Jianan
2021-09-03 13:40   ` [PATCH V2 3/6] erofs-utils: fix general style problem Huang Jianan
2021-09-03 13:40   ` [PATCH V2 4/6] erofs-utils: remove unnecessary codes Huang Jianan
2021-09-03 15:10     ` Gao Xiang
2021-09-03 13:40   ` [PATCH V2 5/6] erofs-utils: fix print style Huang Jianan
2021-09-03 13:40   ` [PATCH V2 6/6] erofs-utils: add missing /* fallthrough */ Huang Jianan
2021-09-03 15:21     ` Gao Xiang

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20210831165116.16575-4-jnhuang95@gmail.com \
    --to=jnhuang95@gmail.com \
    --cc=linux-erofs@lists.ozlabs.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.