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>
This commit is contained in:
parent
7633978b43
commit
1ee54b099a
3 changed files with 25 additions and 21 deletions
|
@ -135,8 +135,10 @@ extern void affs_fix_checksum(struct super_block *sb, struct buffer_head *bh);
|
||||||
extern void secs_to_datestamp(time_t secs, struct affs_date *ds);
|
extern void secs_to_datestamp(time_t secs, struct affs_date *ds);
|
||||||
extern umode_t prot_to_mode(u32 prot);
|
extern umode_t prot_to_mode(u32 prot);
|
||||||
extern void mode_to_prot(struct inode *inode);
|
extern void mode_to_prot(struct inode *inode);
|
||||||
|
__printf(3, 4)
|
||||||
extern void affs_error(struct super_block *sb, const char *function,
|
extern void affs_error(struct super_block *sb, const char *function,
|
||||||
const char *fmt, ...);
|
const char *fmt, ...);
|
||||||
|
__printf(3, 4)
|
||||||
extern void affs_warning(struct super_block *sb, const char *function,
|
extern void affs_warning(struct super_block *sb, const char *function,
|
||||||
const char *fmt, ...);
|
const char *fmt, ...);
|
||||||
extern bool affs_nofilenametruncate(const struct dentry *dentry);
|
extern bool affs_nofilenametruncate(const struct dentry *dentry);
|
||||||
|
|
|
@ -10,8 +10,6 @@
|
||||||
|
|
||||||
#include "affs.h"
|
#include "affs.h"
|
||||||
|
|
||||||
static char ErrorBuffer[256];
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Functions for accessing Amiga-FFS structures.
|
* Functions for accessing Amiga-FFS structures.
|
||||||
*/
|
*/
|
||||||
|
@ -444,30 +442,30 @@ mode_to_prot(struct inode *inode)
|
||||||
void
|
void
|
||||||
affs_error(struct super_block *sb, const char *function, const char *fmt, ...)
|
affs_error(struct super_block *sb, const char *function, const char *fmt, ...)
|
||||||
{
|
{
|
||||||
va_list args;
|
struct va_format vaf;
|
||||||
|
va_list args;
|
||||||
|
|
||||||
va_start(args,fmt);
|
va_start(args, fmt);
|
||||||
vsnprintf(ErrorBuffer,sizeof(ErrorBuffer),fmt,args);
|
vaf.fmt = fmt;
|
||||||
va_end(args);
|
vaf.va = &args;
|
||||||
|
pr_crit("error (device %s): %s(): %pV\n", sb->s_id, function, &vaf);
|
||||||
pr_crit("error (device %s): %s(): %s\n", sb->s_id,
|
|
||||||
function,ErrorBuffer);
|
|
||||||
if (!(sb->s_flags & MS_RDONLY))
|
if (!(sb->s_flags & MS_RDONLY))
|
||||||
pr_warn("Remounting filesystem read-only\n");
|
pr_warn("Remounting filesystem read-only\n");
|
||||||
sb->s_flags |= MS_RDONLY;
|
sb->s_flags |= MS_RDONLY;
|
||||||
|
va_end(args);
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
affs_warning(struct super_block *sb, const char *function, const char *fmt, ...)
|
affs_warning(struct super_block *sb, const char *function, const char *fmt, ...)
|
||||||
{
|
{
|
||||||
va_list args;
|
struct va_format vaf;
|
||||||
|
va_list args;
|
||||||
|
|
||||||
va_start(args,fmt);
|
va_start(args, fmt);
|
||||||
vsnprintf(ErrorBuffer,sizeof(ErrorBuffer),fmt,args);
|
vaf.fmt = fmt;
|
||||||
|
vaf.va = &args;
|
||||||
|
pr_warn("(device %s): %s(): %pV\n", sb->s_id, function, &vaf);
|
||||||
va_end(args);
|
va_end(args);
|
||||||
|
|
||||||
pr_warn("(device %s): %s(): %s\n", sb->s_id,
|
|
||||||
function,ErrorBuffer);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
bool
|
bool
|
||||||
|
|
|
@ -333,7 +333,8 @@ affs_get_block(struct inode *inode, sector_t block, struct buffer_head *bh_resul
|
||||||
|
|
||||||
/* store new block */
|
/* store new block */
|
||||||
if (bh_result->b_blocknr)
|
if (bh_result->b_blocknr)
|
||||||
affs_warning(sb, "get_block", "block already set (%x)", bh_result->b_blocknr);
|
affs_warning(sb, "get_block", "block already set (%lx)",
|
||||||
|
(unsigned long)bh_result->b_blocknr);
|
||||||
AFFS_BLOCK(sb, ext_bh, block) = cpu_to_be32(blocknr);
|
AFFS_BLOCK(sb, ext_bh, block) = cpu_to_be32(blocknr);
|
||||||
AFFS_HEAD(ext_bh)->block_count = cpu_to_be32(block + 1);
|
AFFS_HEAD(ext_bh)->block_count = cpu_to_be32(block + 1);
|
||||||
affs_adjust_checksum(ext_bh, blocknr - bh_result->b_blocknr + 1);
|
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
|
||||||
return 0;
|
return 0;
|
||||||
|
|
||||||
err_big:
|
err_big:
|
||||||
affs_error(inode->i_sb,"get_block","strange block request %d", block);
|
affs_error(inode->i_sb, "get_block", "strange block request %d",
|
||||||
|
(int)block);
|
||||||
return -EIO;
|
return -EIO;
|
||||||
err_ext:
|
err_ext:
|
||||||
// unlock cache
|
// unlock cache
|
||||||
|
@ -845,8 +847,9 @@ affs_truncate(struct inode *inode)
|
||||||
// lock cache
|
// lock cache
|
||||||
ext_bh = affs_get_extblock(inode, ext);
|
ext_bh = affs_get_extblock(inode, ext);
|
||||||
if (IS_ERR(ext_bh)) {
|
if (IS_ERR(ext_bh)) {
|
||||||
affs_warning(sb, "truncate", "unexpected read error for ext block %u (%d)",
|
affs_warning(sb, "truncate",
|
||||||
ext, PTR_ERR(ext_bh));
|
"unexpected read error for ext block %u (%ld)",
|
||||||
|
(unsigned int)ext, PTR_ERR(ext_bh));
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
if (AFFS_I(inode)->i_lc) {
|
if (AFFS_I(inode)->i_lc) {
|
||||||
|
@ -892,8 +895,9 @@ affs_truncate(struct inode *inode)
|
||||||
struct buffer_head *bh = affs_bread_ino(inode, last_blk, 0);
|
struct buffer_head *bh = affs_bread_ino(inode, last_blk, 0);
|
||||||
u32 tmp;
|
u32 tmp;
|
||||||
if (IS_ERR(bh)) {
|
if (IS_ERR(bh)) {
|
||||||
affs_warning(sb, "truncate", "unexpected read error for last block %u (%d)",
|
affs_warning(sb, "truncate",
|
||||||
ext, PTR_ERR(bh));
|
"unexpected read error for last block %u (%ld)",
|
||||||
|
(unsigned int)ext, PTR_ERR(bh));
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
tmp = be32_to_cpu(AFFS_DATA_HEAD(bh)->next);
|
tmp = be32_to_cpu(AFFS_DATA_HEAD(bh)->next);
|
||||||
|
|
Loading…
Add table
Reference in a new issue