2012-08-12 09:45:05

by Cruz Julian Bishop

[permalink] [raw]
Subject: [PATCH 0/7] Fat checkstyle patch set (1)

Hi (and to the mailing list, again).

This is a patch series that fixes checkpatch issues in fs/fat.

I didn't get to do all of the files, but I'll be sure to come back for
them later :)

Please let me know if I did something wrong - I'll be sure to take it on
for my next patches.

Thanks in advance
~Cruz

Cruz Julian Bishop (7):
fs/fat: Fix a checkpatch issue in namei_msdos.c
fs/fat: Fix some checkpatch issues in fat.h
fs/fat: Changed indentation of some comments in fat.h
fs/fat: Fix two checkstyle issues in cache.c
fs/fat: Fixes some small checkpatch issues is dir.c
fs/fat: Fix all other checkstyle issues in dir.c
fs/fat: Fix checkpatch issues in fatent.c

fs/fat/cache.c | 10 ++++---
fs/fat/dir.c | 31 ++++++++++----------
fs/fat/fat.h | 78 +++++++++++++++++++++++++-------------------------
fs/fat/fatent.c | 10 ++++---
fs/fat/namei_msdos.c | 2 +-
5 files changed, 67 insertions(+), 64 deletions(-)

--
1.7.9.5


2012-08-12 09:45:29

by Cruz Julian Bishop

[permalink] [raw]
Subject: [PATCH 1/7] fs/fat: Fix a checkpatch issue in namei_msdos.c

Added a space before an equals sign/operator in line 410.

Yeah, I know. It's a lame commit, but at least it works!

Signed-off-by: Cruz Julian Bishop <[email protected]>
---
fs/fat/namei_msdos.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/fs/fat/namei_msdos.c b/fs/fat/namei_msdos.c
index c27c630..c1055e7 100644
--- a/fs/fat/namei_msdos.c
+++ b/fs/fat/namei_msdos.c
@@ -407,7 +407,7 @@ out:
static int msdos_unlink(struct inode *dir, struct dentry *dentry)
{
struct inode *inode = dentry->d_inode;
- struct super_block *sb= inode->i_sb;
+ struct super_block *sb = inode->i_sb;
struct fat_slot_info sinfo;
int err;

--
1.7.9.5

2012-08-12 09:45:36

by Cruz Julian Bishop

[permalink] [raw]
Subject: [PATCH 3/7] fs/fat: Changed indentation of some comments in fat.h

The comments were not lined up properly, so I just
re-indented them.

This also fixes a stupid checkpatch issue unknowingly

Signed-off-by: Cruz Julian Bishop <[email protected]>
---
fs/fat/fat.h | 72 +++++++++++++++++++++++++++++-----------------------------
1 file changed, 36 insertions(+), 36 deletions(-)

diff --git a/fs/fat/fat.h b/fs/fat/fat.h
index 2ef82cf..76f036f 100644
--- a/fs/fat/fat.h
+++ b/fs/fat/fat.h
@@ -28,27 +28,27 @@ struct fat_mount_options {
gid_t fs_gid;
unsigned short fs_fmask;
unsigned short fs_dmask;
- unsigned short codepage; /* Codepage for shortname conversions */
- char *iocharset; /* Charset used for filename input/display */
- unsigned short shortname; /* flags for shortname display/create rule */
- unsigned char name_check; /* r = relaxed, n = normal, s = strict */
- unsigned char errors; /* On error: continue, panic, remount-ro */
+ unsigned short codepage; /* Codepage for shortname conversions */
+ char *iocharset; /* Charset used for filename input/display */
+ unsigned short shortname; /* flags for shortname display/create rule */
+ unsigned char name_check; /* r = relaxed, n = normal, s = strict */
+ unsigned char errors; /* On error: continue, panic, remount-ro */
unsigned short allow_utime;/* permission for setting the [am]time */
- unsigned quiet:1, /* set = fake successful chmods and chowns */
- showexec:1, /* set = only set x bit for com/exe/bat */
- sys_immutable:1, /* set = system files are immutable */
- dotsOK:1, /* set = hidden and system files are named '.filename' */
- isvfat:1, /* 0=no vfat long filename support, 1=vfat support */
- utf8:1, /* Use of UTF-8 character set (Default) */
- unicode_xlate:1, /* create escape sequences for unhandled Unicode */
- numtail:1, /* Does first alias have a numeric '~1' type tail? */
- flush:1, /* write things quickly */
- nocase:1, /* Does this need case conversion? 0=need case conversion*/
- usefree:1, /* Use free_clusters for FAT32 */
- tz_utc:1, /* Filesystem timestamps are in UTC */
- rodir:1, /* allow ATTR_RO for directory */
- discard:1, /* Issue discard requests on deletions */
- nfs:1; /* Do extra work needed for NFS export */
+ unsigned quiet:1, /* set = fake successful chmods and chowns */
+ showexec:1, /* set = only set x bit for com/exe/bat */
+ sys_immutable:1, /* set = system files are immutable */
+ dotsOK:1, /* set = hidden and system files are named '.filename' */
+ isvfat:1, /* 0=no vfat long filename support, 1=vfat support */
+ utf8:1, /* Use of UTF-8 character set (Default) */
+ unicode_xlate:1, /* create escape sequences for unhandled Unicode */
+ numtail:1, /* Does first alias have a numeric '~1' type tail? */
+ flush:1, /* write things quickly */
+ nocase:1, /* Does this need case conversion? 0=need case conversion*/
+ usefree:1, /* Use free_clusters for FAT32 */
+ tz_utc:1, /* Filesystem timestamps are in UTC */
+ rodir:1, /* allow ATTR_RO for directory */
+ discard:1, /* Issue discard requests on deletions */
+ nfs:1; /* Do extra work needed for NFS export */
};

#define FAT_HASH_BITS 8
@@ -58,28 +58,28 @@ struct fat_mount_options {
* MS-DOS file system in-core superblock data
*/
struct msdos_sb_info {
- unsigned short sec_per_clus; /* sectors/cluster */
- unsigned short cluster_bits; /* log2(cluster_size) */
- unsigned int cluster_size; /* cluster size */
+ unsigned short sec_per_clus; /* sectors/cluster */
+ unsigned short cluster_bits; /* log2(cluster_size) */
+ unsigned int cluster_size; /* cluster size */
unsigned char fats, fat_bits; /* number of FATs, FAT bits (12 or 16) */
unsigned short fat_start;
- unsigned long fat_length; /* FAT start & length (sec.) */
+ unsigned long fat_length; /* FAT start & length (sec.) */
unsigned long dir_start;
- unsigned short dir_entries; /* root dir start & entries */
- unsigned long data_start; /* first data sector */
- unsigned long max_cluster; /* maximum cluster number */
- unsigned long root_cluster; /* first cluster of the root directory */
- unsigned long fsinfo_sector; /* sector number of FAT32 fsinfo */
+ unsigned short dir_entries; /* root dir start & entries */
+ unsigned long data_start; /* first data sector */
+ unsigned long max_cluster; /* maximum cluster number */
+ unsigned long root_cluster; /* first cluster of the root directory */
+ unsigned long fsinfo_sector; /* sector number of FAT32 fsinfo */
struct mutex fat_lock;
- unsigned int prev_free; /* previously allocated cluster number */
- unsigned int free_clusters; /* -1 if undefined */
+ unsigned int prev_free; /* previously allocated cluster number */
+ unsigned int free_clusters; /* -1 if undefined */
unsigned int free_clus_valid; /* is free_clusters valid? */
struct fat_mount_options options;
- struct nls_table *nls_disk; /* Codepage used on disk */
- struct nls_table *nls_io; /* Charset used for input and display */
- const void *dir_ops; /* Opaque; default directory operations */
- int dir_per_block; /* dir entries per block */
- int dir_per_block_bits; /* log2(dir_per_block) */
+ struct nls_table *nls_disk; /* Codepage used on disk */
+ struct nls_table *nls_io; /* Charset used for input and display */
+ const void *dir_ops; /* Opaque; default directory operations */
+ int dir_per_block; /* dir entries per block */
+ int dir_per_block_bits; /* log2(dir_per_block) */

int fatent_shift;
struct fatent_operations *fatent_ops;
--
1.7.9.5

2012-08-12 09:45:33

by Cruz Julian Bishop

[permalink] [raw]
Subject: [PATCH 2/7] fs/fat: Fix some checkpatch issues in fat.h

Mainly fixed spacing issues such as "foo * bar" and "foo= bar"

Signed-off-by: Cruz Julian Bishop <[email protected]>
---
fs/fat/fat.h | 6 +++---
1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/fs/fat/fat.h b/fs/fat/fat.h
index 88b6c29..2ef82cf 100644
--- a/fs/fat/fat.h
+++ b/fs/fat/fat.h
@@ -61,7 +61,7 @@ struct msdos_sb_info {
unsigned short sec_per_clus; /* sectors/cluster */
unsigned short cluster_bits; /* log2(cluster_size) */
unsigned int cluster_size; /* cluster size */
- unsigned char fats,fat_bits; /* number of FATs, FAT bits (12 or 16) */
+ unsigned char fats, fat_bits; /* number of FATs, FAT bits (12 or 16) */
unsigned short fat_start;
unsigned long fat_length; /* FAT start & length (sec.) */
unsigned long dir_start;
@@ -328,7 +328,7 @@ extern long fat_generic_ioctl(struct file *filp, unsigned int cmd,
unsigned long arg);
extern const struct file_operations fat_file_operations;
extern const struct inode_operations fat_file_inode_operations;
-extern int fat_setattr(struct dentry * dentry, struct iattr * attr);
+extern int fat_setattr(struct dentry *dentry, struct iattr *attr);
extern void fat_truncate_blocks(struct inode *inode, loff_t offset);
extern int fat_getattr(struct vfsmount *mnt, struct dentry *dentry,
struct kstat *stat);
@@ -346,7 +346,7 @@ extern int fat_fill_super(struct super_block *sb, void *data, int silent,
int isvfat, void (*setup)(struct super_block *));

extern int fat_flush_inodes(struct super_block *sb, struct inode *i1,
- struct inode *i2);
+ struct inode *i2);
static inline unsigned long fat_dir_hash(int logstart)
{
return hash_32(logstart, FAT_HASH_BITS);
--
1.7.9.5

2012-08-12 09:45:41

by Cruz Julian Bishop

[permalink] [raw]
Subject: [PATCH 4/7] fs/fat: Fix two checkpatch issues in cache.c

This does the following:
1: Splits the arguments of a function call to stop it
from exceeding 80 characters
2: Re-indents the arguments of another function call
to prevent the splitting of a quoted string.

Signed-off-by: Cruz Julian Bishop <[email protected]>
---
fs/fat/cache.c | 10 ++++++----
1 file changed, 6 insertions(+), 4 deletions(-)

diff --git a/fs/fat/cache.c b/fs/fat/cache.c
index 1cc7038..91ad9e1 100644
--- a/fs/fat/cache.c
+++ b/fs/fat/cache.c
@@ -190,7 +190,8 @@ static void __fat_cache_inval_inode(struct inode *inode)
struct fat_cache *cache;

while (!list_empty(&i->cache_lru)) {
- cache = list_entry(i->cache_lru.next, struct fat_cache, cache_list);
+ cache = list_entry(i->cache_lru.next,
+ struct fat_cache, cache_list);
list_del_init(&cache->cache_list);
i->nr_caches--;
fat_cache_free(cache);
@@ -261,9 +262,10 @@ int fat_get_cluster(struct inode *inode, int cluster, int *fclus, int *dclus)
if (nr < 0)
goto out;
else if (nr == FAT_ENT_FREE) {
- fat_fs_error_ratelimit(sb, "%s: invalid cluster chain"
- " (i_pos %lld)", __func__,
- MSDOS_I(inode)->i_pos);
+ fat_fs_error_ratelimit(sb,
+ "%s: invalid cluster chain (i_pos %lld)",
+ __func__,
+ MSDOS_I(inode)->i_pos);
nr = -EIO;
goto out;
} else if (nr == FAT_ENT_EOF) {
--
1.7.9.5

2012-08-12 09:45:45

by Cruz Julian Bishop

[permalink] [raw]
Subject: [PATCH 5/7] fs/fat: Fixes some small checkpatch issues in dir.c

This commit simply removes the spacing between function
definitions and EXPORT_SYMBOL_GPL calls, which were
previously generating warnings.

Signed-off-by: Cruz Julian Bishop <[email protected]>
---
fs/fat/dir.c | 7 -------
1 file changed, 7 deletions(-)

diff --git a/fs/fat/dir.c b/fs/fat/dir.c
index 7b1b9c1..4b04d5e 100644
--- a/fs/fat/dir.c
+++ b/fs/fat/dir.c
@@ -537,7 +537,6 @@ end_of_dir:

return err;
}
-
EXPORT_SYMBOL_GPL(fat_search_long);

struct fat_ioctl_filldir_callback {
@@ -892,7 +891,6 @@ int fat_get_dotdot_entry(struct inode *dir, struct buffer_head **bh,
}
return -ENOENT;
}
-
EXPORT_SYMBOL_GPL(fat_get_dotdot_entry);

/* See if directory is empty */
@@ -915,7 +913,6 @@ int fat_dir_empty(struct inode *dir)
brelse(bh);
return result;
}
-
EXPORT_SYMBOL_GPL(fat_dir_empty);

/*
@@ -961,7 +958,6 @@ int fat_scan(struct inode *dir, const unsigned char *name,
}
return -ENOENT;
}
-
EXPORT_SYMBOL_GPL(fat_scan);

static int __fat_remove_entries(struct inode *dir, loff_t pos, int nr_slots)
@@ -1049,7 +1045,6 @@ int fat_remove_entries(struct inode *dir, struct fat_slot_info *sinfo)

return 0;
}
-
EXPORT_SYMBOL_GPL(fat_remove_entries);

static int fat_zeroed_cluster(struct inode *dir, sector_t blknr, int nr_used,
@@ -1163,7 +1158,6 @@ error_free:
error:
return err;
}
-
EXPORT_SYMBOL_GPL(fat_alloc_new_dir);

static int fat_add_new_entries(struct inode *dir, void *slots, int nr_slots,
@@ -1379,5 +1373,4 @@ error_remove:
__fat_remove_entries(dir, pos, free_slots);
return err;
}
-
EXPORT_SYMBOL_GPL(fat_add_entries);
--
1.7.9.5

2012-08-12 09:45:48

by Cruz Julian Bishop

[permalink] [raw]
Subject: [PATCH 6/7] fs/fat: Fix all other checkpatch issues in dir.c

This does the following:

1: Import linux/uaccess.h instead of asm.uaccess.h
2: Stop any lines going over 80 characters
3: Stopped setting any variables in if statements
4: Stopped splitting quoted strings
5: Removed unneeded parentheses

Signed-off-by: Cruz Julian Bishop <[email protected]>
---
fs/fat/dir.c | 24 +++++++++++++++---------
1 file changed, 15 insertions(+), 9 deletions(-)

diff --git a/fs/fat/dir.c b/fs/fat/dir.c
index 4b04d5e..79fdec6 100644
--- a/fs/fat/dir.c
+++ b/fs/fat/dir.c
@@ -18,7 +18,7 @@
#include <linux/time.h>
#include <linux/buffer_head.h>
#include <linux/compat.h>
-#include <asm/uaccess.h>
+#include <linux/uaccess.h>
#include <linux/kernel.h>
#include "fat.h"

@@ -123,7 +123,8 @@ static inline int fat_get_entry(struct inode *dir, loff_t *pos,
{
/* Fast stuff first */
if (*bh && *de &&
- (*de - (struct msdos_dir_entry *)(*bh)->b_data) < MSDOS_SB(dir->i_sb)->dir_per_block - 1) {
+ (*de - (struct msdos_dir_entry *)(*bh)->b_data) <
+ MSDOS_SB(dir->i_sb)->dir_per_block - 1) {
*pos += sizeof(struct msdos_dir_entry);
(*de)++;
return 0;
@@ -155,7 +156,8 @@ static int uni16_to_x8(struct super_block *sb, unsigned char *ascii,

while (*ip && ((len - NLS_MAX_CHARSET_SIZE) > 0)) {
ec = *ip++;
- if ((charlen = nls->uni2char(ec, op, NLS_MAX_CHARSET_SIZE)) > 0) {
+ charlen = nls->uni2char(ec, op, NLS_MAX_CHARSET_SIZE);
+ if (charlen > 0) {
op += charlen;
len -= charlen;
} else {
@@ -172,12 +174,12 @@ static int uni16_to_x8(struct super_block *sb, unsigned char *ascii,
}

if (unlikely(*ip)) {
- fat_msg(sb, KERN_WARNING, "filename was truncated while "
- "converting.");
+ fat_msg(sb, KERN_WARNING,
+ "filename was truncated while converting.");
}

*op = 0;
- return (op - ascii);
+ return op - ascii;
}

static inline int fat_uni_to_x8(struct super_block *sb, const wchar_t *uni,
@@ -205,7 +207,8 @@ fat_short2uni(struct nls_table *t, unsigned char *c, int clen, wchar_t *uni)
}

static inline int
-fat_short2lower_uni(struct nls_table *t, unsigned char *c, int clen, wchar_t *uni)
+fat_short2lower_uni(struct nls_table *t, unsigned char *c,
+ int clen, wchar_t *uni)
{
int charlen;
wchar_t wc;
@@ -220,7 +223,9 @@ fat_short2lower_uni(struct nls_table *t, unsigned char *c, int clen, wchar_t *un
if (!nc)
nc = *c;

- if ( (charlen = t->char2uni(&nc, 1, uni)) < 0) {
+ charlen = t->char2uni(&nc, 1, uni);
+
+ if (charlen < 0) {
*uni = 0x003f; /* a question mark */
charlen = 1;
}
@@ -573,7 +578,8 @@ static int __fat_readdir(struct inode *inode, struct file *filp, void *dirent,
/* Fake . and .. for the root directory. */
if (inode->i_ino == MSDOS_ROOT_INO) {
while (cpos < 2) {
- if (filldir(dirent, "..", cpos+1, cpos, MSDOS_ROOT_INO, DT_DIR) < 0)
+ if (filldir(dirent, "..", cpos+1, cpos,
+ MSDOS_ROOT_INO, DT_DIR) < 0)
goto out;
cpos++;
filp->f_pos++;
--
1.7.9.5

2012-08-12 09:45:51

by Cruz Julian Bishop

[permalink] [raw]
Subject: [PATCH 7/7] fs/fat: Fix checkpatch issues in fatent.c

This patch does the following:

1: Stops any lines going over 80 characters
2: Removes a blank line before EXPORT_SYMBOL_GPL

Signed-off-by: Cruz Julian Bishop <[email protected]>
---
fs/fat/fatent.c | 10 ++++++----
1 file changed, 6 insertions(+), 4 deletions(-)

diff --git a/fs/fat/fatent.c b/fs/fat/fatent.c
index 31f08ab..67fd237 100644
--- a/fs/fat/fatent.c
+++ b/fs/fat/fatent.c
@@ -203,15 +203,18 @@ static int fat12_ent_next(struct fat_entry *fatent)

fatent->entry++;
if (fatent->nr_bhs == 1) {
- WARN_ON(ent12_p[0] > (u8 *)(bhs[0]->b_data + (bhs[0]->b_size - 2)));
- WARN_ON(ent12_p[1] > (u8 *)(bhs[0]->b_data + (bhs[0]->b_size - 1)));
+ WARN_ON(ent12_p[0] > (u8 *)(bhs[0]->b_data +
+ (bhs[0]->b_size - 2)));
+ WARN_ON(ent12_p[1] > (u8 *)(bhs[0]->b_data +
+ (bhs[0]->b_size - 1)));
if (nextp < (u8 *)(bhs[0]->b_data + (bhs[0]->b_size - 1))) {
ent12_p[0] = nextp - 1;
ent12_p[1] = nextp;
return 1;
}
} else {
- WARN_ON(ent12_p[0] != (u8 *)(bhs[0]->b_data + (bhs[0]->b_size - 1)));
+ WARN_ON(ent12_p[0] != (u8 *)(bhs[0]->b_data +
+ (bhs[0]->b_size - 1)));
WARN_ON(ent12_p[1] != (u8 *)bhs[1]->b_data);
ent12_p[0] = nextp - 1;
ent12_p[1] = nextp;
@@ -631,7 +634,6 @@ error:

return err;
}
-
EXPORT_SYMBOL_GPL(fat_free_clusters);

/* 128kb is the whole sectors for FAT12 and FAT16 */
--
1.7.9.5

2012-08-12 10:14:15

by OGAWA Hirofumi

[permalink] [raw]
Subject: Re: [PATCH 6/7] fs/fat: Fix all other checkpatch issues in dir.c

Cruz Julian Bishop <[email protected]> writes:

> + charlen = t->char2uni(&nc, 1, uni);
> +

Here is strange new line.

> + if (charlen < 0) {
> *uni = 0x003f; /* a question mark */
> charlen = 1;

--
OGAWA Hirofumi <[email protected]>

2012-08-12 10:18:23

by OGAWA Hirofumi

[permalink] [raw]
Subject: Re: [PATCH 0/7] Fat checkstyle patch set (1)

Cruz Julian Bishop <[email protected]> writes:

> Hi (and to the mailing list, again).
>
> This is a patch series that fixes checkpatch issues in fs/fat.
>
> I didn't get to do all of the files, but I'll be sure to come back for
> them later :)
>
> Please let me know if I did something wrong - I'll be sure to take it on
> for my next patches.

Is this for -mm tree? Please make sure there is no conflict.

Yeah, small patch is preferred, but it should be the logical separation,
and one patch would be better in this case, IMHO.

Personally, I'm not against this type cleanup only if there is no
conflict though (i.e. doesn't increase maintain cost). So, if akpm is
fine to take this, then I'm ok.

> Cruz Julian Bishop (7):
> fs/fat: Fix a checkpatch issue in namei_msdos.c
> fs/fat: Fix some checkpatch issues in fat.h
> fs/fat: Changed indentation of some comments in fat.h
> fs/fat: Fix two checkstyle issues in cache.c
> fs/fat: Fixes some small checkpatch issues is dir.c
> fs/fat: Fix all other checkstyle issues in dir.c
> fs/fat: Fix checkpatch issues in fatent.c

There was one strange new line in a patch. Otherwise,

Acked-by: OGAWA Hirofumi <[email protected]>

--
OGAWA Hirofumi <[email protected]>

2012-08-12 11:02:02

by Cruz Julian Bishop

[permalink] [raw]
Subject: Re: [PATCH 0/7] Fat checkstyle patch set (1)

On 12/08/12 20:18, OGAWA Hirofumi wrote:
> Cruz Julian Bishop <[email protected]> writes:
>
>> Hi (and to the mailing list, again).
>>
>> This is a patch series that fixes checkpatch issues in fs/fat.
>>
>> I didn't get to do all of the files, but I'll be sure to come back for
>> them later :)
>>
>> Please let me know if I did something wrong - I'll be sure to take it on
>> for my next patches.
> Is this for -mm tree? Please make sure there is no conflict.
It's actually based on -next, but I think that's taken over what -mm
was doing in the past, anyway.
>
> Yeah, small patch is preferred, but it should be the logical separation,
> and one patch would be better in this case, IMHO.
>
> Personally, I'm not against this type cleanup only if there is no
> conflict though (i.e. doesn't increase maintain cost). So, if akpm is
> fine to take this, then I'm ok.
Thank you - I'll remember that in the future
>
>> Cruz Julian Bishop (7):
>> fs/fat: Fix a checkpatch issue in namei_msdos.c
>> fs/fat: Fix some checkpatch issues in fat.h
>> fs/fat: Changed indentation of some comments in fat.h
>> fs/fat: Fix two checkstyle issues in cache.c
>> fs/fat: Fixes some small checkpatch issues is dir.c
>> fs/fat: Fix all other checkstyle issues in dir.c
>> fs/fat: Fix checkpatch issues in fatent.c
> There was one strange new line in a patch. Otherwise,
>
> Acked-by: OGAWA Hirofumi <[email protected]>
Again, thank you :)