diff options
author | Fabian Frederick <fabf@skynet.be> | 2014-12-12 19:57:49 -0500 |
---|---|---|
committer | Linus Torvalds <torvalds@linux-foundation.org> | 2014-12-13 15:42:51 -0500 |
commit | 1ee54b099acecb928bc76ea4beca668697b4a4d0 (patch) | |
tree | fc2a748e4f703bde9ab50b061eb4e79bcf03cf6b /fs/affs | |
parent | 7633978b43ebe3ec4759ef069acd7bf3d743b79c (diff) |
fs/affs/amigaffs.c: use va_format instead of buffer/vnsprintf
-Remove ErrorBuffer and use %pV
-Add __printf to enable argument mistmatch warnings
Original patch by Joe Perches.
Signed-off-by: Fabian Frederick <fabf@skynet.be>
Cc: Joe Perches <joe@perches.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Diffstat (limited to 'fs/affs')
-rw-r--r-- | fs/affs/affs.h | 2 | ||||
-rw-r--r-- | fs/affs/amigaffs.c | 28 | ||||
-rw-r--r-- | fs/affs/file.c | 16 |
3 files changed, 25 insertions, 21 deletions
diff --git a/fs/affs/affs.h b/fs/affs/affs.h index 9bca88159725..ff44ff3ff015 100644 --- a/fs/affs/affs.h +++ b/fs/affs/affs.h | |||
@@ -135,8 +135,10 @@ extern void affs_fix_checksum(struct super_block *sb, struct buffer_head *bh); | |||
135 | extern void secs_to_datestamp(time_t secs, struct affs_date *ds); | 135 | extern void secs_to_datestamp(time_t secs, struct affs_date *ds); |
136 | extern umode_t prot_to_mode(u32 prot); | 136 | extern umode_t prot_to_mode(u32 prot); |
137 | extern void mode_to_prot(struct inode *inode); | 137 | extern void mode_to_prot(struct inode *inode); |
138 | __printf(3, 4) | ||
138 | extern void affs_error(struct super_block *sb, const char *function, | 139 | extern void affs_error(struct super_block *sb, const char *function, |
139 | const char *fmt, ...); | 140 | const char *fmt, ...); |
141 | __printf(3, 4) | ||
140 | extern void affs_warning(struct super_block *sb, const char *function, | 142 | extern void affs_warning(struct super_block *sb, const char *function, |
141 | const char *fmt, ...); | 143 | const char *fmt, ...); |
142 | extern bool affs_nofilenametruncate(const struct dentry *dentry); | 144 | extern bool affs_nofilenametruncate(const struct dentry *dentry); |
diff --git a/fs/affs/amigaffs.c b/fs/affs/amigaffs.c index 937ce8754b24..c852f2fa1710 100644 --- a/fs/affs/amigaffs.c +++ b/fs/affs/amigaffs.c | |||
@@ -10,8 +10,6 @@ | |||
10 | 10 | ||
11 | #include "affs.h" | 11 | #include "affs.h" |
12 | 12 | ||
13 | static char ErrorBuffer[256]; | ||
14 | |||
15 | /* | 13 | /* |
16 | * Functions for accessing Amiga-FFS structures. | 14 | * Functions for accessing Amiga-FFS structures. |
17 | */ | 15 | */ |
@@ -444,30 +442,30 @@ mode_to_prot(struct inode *inode) | |||
444 | void | 442 | void |
445 | affs_error(struct super_block *sb, const char *function, const char *fmt, ...) | 443 | affs_error(struct super_block *sb, const char *function, const char *fmt, ...) |
446 | { | 444 | { |
447 | va_list args; | 445 | struct va_format vaf; |
448 | 446 | va_list args; | |
449 | va_start(args,fmt); | ||
450 | vsnprintf(ErrorBuffer,sizeof(ErrorBuffer),fmt,args); | ||
451 | va_end(args); | ||
452 | 447 | ||
453 | pr_crit("error (device %s): %s(): %s\n", sb->s_id, | 448 | va_start(args, fmt); |
454 | function,ErrorBuffer); | 449 | vaf.fmt = fmt; |
450 | vaf.va = &args; | ||
451 | pr_crit("error (device %s): %s(): %pV\n", sb->s_id, function, &vaf); | ||
455 | if (!(sb->s_flags & MS_RDONLY)) | 452 | if (!(sb->s_flags & MS_RDONLY)) |
456 | pr_warn("Remounting filesystem read-only\n"); | 453 | pr_warn("Remounting filesystem read-only\n"); |
457 | sb->s_flags |= MS_RDONLY; | 454 | sb->s_flags |= MS_RDONLY; |
455 | va_end(args); | ||
458 | } | 456 | } |
459 | 457 | ||
460 | void | 458 | void |
461 | affs_warning(struct super_block *sb, const char *function, const char *fmt, ...) | 459 | affs_warning(struct super_block *sb, const char *function, const char *fmt, ...) |
462 | { | 460 | { |
463 | va_list args; | 461 | struct va_format vaf; |
462 | va_list args; | ||
464 | 463 | ||
465 | va_start(args,fmt); | 464 | va_start(args, fmt); |
466 | vsnprintf(ErrorBuffer,sizeof(ErrorBuffer),fmt,args); | 465 | vaf.fmt = fmt; |
466 | vaf.va = &args; | ||
467 | pr_warn("(device %s): %s(): %pV\n", sb->s_id, function, &vaf); | ||
467 | va_end(args); | 468 | va_end(args); |
468 | |||
469 | pr_warn("(device %s): %s(): %s\n", sb->s_id, | ||
470 | function,ErrorBuffer); | ||
471 | } | 469 | } |
472 | 470 | ||
473 | bool | 471 | bool |
diff --git a/fs/affs/file.c b/fs/affs/file.c index 8e2e60ea1e23..8e510854f487 100644 --- a/fs/affs/file.c +++ b/fs/affs/file.c | |||
@@ -333,7 +333,8 @@ affs_get_block(struct inode *inode, sector_t block, struct buffer_head *bh_resul | |||
333 | 333 | ||
334 | /* store new block */ | 334 | /* store new block */ |
335 | if (bh_result->b_blocknr) | 335 | if (bh_result->b_blocknr) |
336 | affs_warning(sb, "get_block", "block already set (%x)", bh_result->b_blocknr); | 336 | affs_warning(sb, "get_block", "block already set (%lx)", |
337 | (unsigned long)bh_result->b_blocknr); | ||
337 | AFFS_BLOCK(sb, ext_bh, block) = cpu_to_be32(blocknr); | 338 | AFFS_BLOCK(sb, ext_bh, block) = cpu_to_be32(blocknr); |
338 | AFFS_HEAD(ext_bh)->block_count = cpu_to_be32(block + 1); | 339 | AFFS_HEAD(ext_bh)->block_count = cpu_to_be32(block + 1); |
339 | affs_adjust_checksum(ext_bh, blocknr - bh_result->b_blocknr + 1); | 340 | affs_adjust_checksum(ext_bh, blocknr - bh_result->b_blocknr + 1); |
@@ -355,7 +356,8 @@ affs_get_block(struct inode *inode, sector_t block, struct buffer_head *bh_resul | |||
355 | return 0; | 356 | return 0; |
356 | 357 | ||
357 | err_big: | 358 | err_big: |
358 | affs_error(inode->i_sb,"get_block","strange block request %d", block); | 359 | affs_error(inode->i_sb, "get_block", "strange block request %d", |
360 | (int)block); | ||
359 | return -EIO; | 361 | return -EIO; |
360 | err_ext: | 362 | err_ext: |
361 | // unlock cache | 363 | // unlock cache |
@@ -845,8 +847,9 @@ affs_truncate(struct inode *inode) | |||
845 | // lock cache | 847 | // lock cache |
846 | ext_bh = affs_get_extblock(inode, ext); | 848 | ext_bh = affs_get_extblock(inode, ext); |
847 | if (IS_ERR(ext_bh)) { | 849 | if (IS_ERR(ext_bh)) { |
848 | affs_warning(sb, "truncate", "unexpected read error for ext block %u (%d)", | 850 | affs_warning(sb, "truncate", |
849 | ext, PTR_ERR(ext_bh)); | 851 | "unexpected read error for ext block %u (%ld)", |
852 | (unsigned int)ext, PTR_ERR(ext_bh)); | ||
850 | return; | 853 | return; |
851 | } | 854 | } |
852 | if (AFFS_I(inode)->i_lc) { | 855 | if (AFFS_I(inode)->i_lc) { |
@@ -892,8 +895,9 @@ affs_truncate(struct inode *inode) | |||
892 | struct buffer_head *bh = affs_bread_ino(inode, last_blk, 0); | 895 | struct buffer_head *bh = affs_bread_ino(inode, last_blk, 0); |
893 | u32 tmp; | 896 | u32 tmp; |
894 | if (IS_ERR(bh)) { | 897 | if (IS_ERR(bh)) { |
895 | affs_warning(sb, "truncate", "unexpected read error for last block %u (%d)", | 898 | affs_warning(sb, "truncate", |
896 | ext, PTR_ERR(bh)); | 899 | "unexpected read error for last block %u (%ld)", |
900 | (unsigned int)ext, PTR_ERR(bh)); | ||
897 | return; | 901 | return; |
898 | } | 902 | } |
899 | tmp = be32_to_cpu(AFFS_DATA_HEAD(bh)->next); | 903 | tmp = be32_to_cpu(AFFS_DATA_HEAD(bh)->next); |