2021-02-05 04:54:57

by Amy Parker

[permalink] [raw]
Subject: [PATCH 1/3] fs/efs: Use correct brace styling for statements

Many single-line statements have unnecessary braces, and some statement pairs have mismatched braces. This is a clear violation of the kernel style guide, which mandates that single line statements have no braces and that pairs with at least one multi-line block maintain their braces.

This patch fixes these style violations. Single-line statements that have braces have had their braces stripped. Pair single-line statements have been formatted per the style guide. Pair mixed-line statements have had their braces updated to conform.

Signed-off-by: Amy Parker <[email protected]>
---
fs/efs/inode.c | 10 ++++++----
fs/efs/super.c | 15 ++++++---------
2 files changed, 12 insertions(+), 13 deletions(-)

diff --git a/fs/efs/inode.c b/fs/efs/inode.c
index 89e73a6f0d36..36d6c45046e2 100644
--- a/fs/efs/inode.c
+++ b/fs/efs/inode.c
@@ -107,11 +107,11 @@ struct inode *efs_iget(struct super_block *super, unsigned long ino)
inode->i_atime.tv_nsec = inode->i_mtime.tv_nsec = inode->i_ctime.tv_nsec = 0;

/* this is the number of blocks in the file */
- if (inode->i_size == 0) {
+ if (inode->i_size == 0)
inode->i_blocks = 0;
- } else {
+ else
inode->i_blocks = ((inode->i_size - 1) >> EFS_BLOCKSIZE_BITS) + 1;
- }
+

rdev = be16_to_cpu(efs_inode->di_u.di_dev.odev);
if (rdev == 0xffff) {
@@ -120,8 +120,10 @@ struct inode *efs_iget(struct super_block *super, unsigned long ino)
device = 0;
else
device = MKDEV(sysv_major(rdev), sysv_minor(rdev));
- } else
+ }
+ else {
device = old_decode_dev(rdev);
+ }

/* get the number of extents for this object */
in->numextents = be16_to_cpu(efs_inode->di_numextents);
diff --git a/fs/efs/super.c b/fs/efs/super.c
index 62b155b9366b..874d82096b2f 100644
--- a/fs/efs/super.c
+++ b/fs/efs/super.c
@@ -160,14 +160,13 @@ static efs_block_t efs_validate_vh(struct volume_header *vh) {
struct pt_types *pt_entry;
int pt_type, slice = -1;

- if (be32_to_cpu(vh->vh_magic) != VHMAGIC) {
+ if (be32_to_cpu(vh->vh_magic) != VHMAGIC)
/*
* assume that we're dealing with a partition and allow
* read_super() to try and detect a valid superblock
* on the next block.
*/
return 0;
- }

ui = ((__be32 *) (vh + 1)) - 1;
for(csum = 0; ui >= ((__be32 *) vh);) {
@@ -191,11 +190,11 @@ static efs_block_t efs_validate_vh(struct volume_header *vh) {
}
name[j] = (char) 0;

- if (name[0]) {
+ if (name[0])
pr_debug("vh: %8s block: 0x%08x size: 0x%08x\n",
name, (int) be32_to_cpu(vh->vh_vd[i].vd_lbn),
(int) be32_to_cpu(vh->vh_vd[i].vd_nbytes));
- }
+
}
#endif

@@ -219,15 +218,14 @@ static efs_block_t efs_validate_vh(struct volume_header *vh) {
}
}

- if (slice == -1) {
+ if (slice == -1)
pr_notice("partition table contained no EFS partitions\n");
#ifdef DEBUG
- } else {
+ else
pr_info("using slice %d (type %s, offset 0x%x)\n", slice,
(pt_entry->pt_name) ? pt_entry->pt_name : "unknown",
sblock);
#endif
- }
return sblock;
}

@@ -284,9 +282,8 @@ static int efs_fill_super(struct super_block *s, void *d, int silent)
sb->fs_start = efs_validate_vh((struct volume_header *) bh->b_data);
brelse(bh);

- if (sb->fs_start == -1) {
+ if (sb->fs_start == -1)
return -EINVAL;
- }

bh = sb_bread(s, sb->fs_start + EFS_SUPER);
if (!bh) {
--
2.29.2


2021-02-05 04:59:11

by Chaitanya Kulkarni

[permalink] [raw]
Subject: Re: [PATCH 1/3] fs/efs: Use correct brace styling for statements

On 2/4/21 20:55, Amy Parker wrote:
> Many single-line statements have unnecessary braces, and some statement pairs have mismatched braces. This is a clear violation of the kernel style guide, which mandates that single line statements have no braces and that pairs with at least one multi-line block maintain their braces.
>
> This patch fixes these style violations. Single-line statements that have braces have had their braces stripped. Pair single-line statements have been formatted per the style guide. Pair mixed-line statements have had their braces updated to conform.
>
> Signed-off-by: Amy Parker <[email protected]>
Commit message is too long. Follow the style present in the tree.

2021-02-05 05:03:25

by Amy Parker

[permalink] [raw]
Subject: Re: [PATCH 1/3] fs/efs: Use correct brace styling for statements

On Thu, Feb 4, 2021 at 8:57 PM Chaitanya Kulkarni
<[email protected]> wrote:
>
> On 2/4/21 20:55, Amy Parker wrote:
> > Many single-line statements have unnecessary braces, and some statement pairs have mismatched braces. This is a clear violation of the kernel style guide, which mandates that single line statements have no braces and that pairs with at least one multi-line block maintain their braces.
> >
> > This patch fixes these style violations. Single-line statements that have braces have had their braces stripped. Pair single-line statements have been formatted per the style guide. Pair mixed-line statements have had their braces updated to conform.
> >
> > Signed-off-by: Amy Parker <[email protected]>
> Commit message is too long. Follow the style present in the tree.

Are you referring to the per-line length? That was supposed to have
been broken up, my apologies. Or is it the overall length that is the
issue?

-Amy IP

2021-02-05 05:14:37

by Amy Parker

[permalink] [raw]
Subject: Re: [PATCH 1/3] fs/efs: Use correct brace styling for statements

On Thu, Feb 4, 2021 at 9:09 PM Chaitanya Kulkarni
<[email protected]> wrote:
>
> On 2/4/21 21:01, Amy Parker wrote:
> >> Commit message is too long. Follow the style present in the tree.
> > Are you referring to the per-line length? That was supposed to have
> > been broken up, my apologies. Or is it the overall length that is the
> > issue?
> >
> > -Amy IP
> >
> Per line length. I think it should be < 73.

Alright. Working on it, expect the v2 patchset soon - sorry about that!

-Amy IP

2021-02-05 05:15:10

by Chaitanya Kulkarni

[permalink] [raw]
Subject: Re: [PATCH 1/3] fs/efs: Use correct brace styling for statements

On 2/4/21 21:01, Amy Parker wrote:
>> Commit message is too long. Follow the style present in the tree.
> Are you referring to the per-line length? That was supposed to have
> been broken up, my apologies. Or is it the overall length that is the
> issue?
>
> -Amy IP
>
Per line length. I think it should be < 73.