aboutsummaryrefslogtreecommitdiffstats
path: root/fs/hpfs/super.c
diff options
context:
space:
mode:
authorAlexey Dobriyan <adobriyan@gmail.com>2006-12-06 23:37:04 -0500
committerLinus Torvalds <torvalds@woody.osdl.org>2006-12-07 11:39:35 -0500
commit352d94d040053d93bf1cf4acb4be9635e69d9200 (patch)
tree85fd048b504dfc375bb9515f8d938353e168ce04 /fs/hpfs/super.c
parent4a6e617a4bec9fb2ee4a16cf59565b2af5049e12 (diff)
[PATCH] hpfs: bring hpfs_error() into shape
- switch to error message buffer in .bss - missing va_end() (htf it worked before?) - use vsnprintf() - rename variables to understandable "fmt", "args". - "const char *fmt", yes. - add __attribute__((format ... Still, put that coffee down before reading more. Signed-off-by: Alexey Dobriyan <adobriyan@gmail.com> Signed-off-by: Andrew Morton <akpm@osdl.org> Signed-off-by: Linus Torvalds <torvalds@osdl.org>
Diffstat (limited to 'fs/hpfs/super.c')
-rw-r--r--fs/hpfs/super.c23
1 files changed, 9 insertions, 14 deletions
diff --git a/fs/hpfs/super.c b/fs/hpfs/super.c
index 34d68e211714..d4abc1a1d566 100644
--- a/fs/hpfs/super.c
+++ b/fs/hpfs/super.c
@@ -46,21 +46,17 @@ static void unmark_dirty(struct super_block *s)
46} 46}
47 47
48/* Filesystem error... */ 48/* Filesystem error... */
49static char err_buf[1024];
49 50
50#define ERR_BUF_SIZE 1024 51void hpfs_error(struct super_block *s, const char *fmt, ...)
51
52void hpfs_error(struct super_block *s, char *m,...)
53{ 52{
54 char *buf; 53 va_list args;
55 va_list l; 54
56 va_start(l, m); 55 va_start(args, fmt);
57 if (!(buf = kmalloc(ERR_BUF_SIZE, GFP_KERNEL))) 56 vsnprintf(err_buf, sizeof(err_buf), fmt, args);
58 printk("HPFS: No memory for error message '%s'\n",m); 57 va_end(args);
59 else if (vsprintf(buf, m, l) >= ERR_BUF_SIZE) 58
60 printk("HPFS: Grrrr... Kernel memory corrupted ... going on, but it'll crash very soon :-(\n"); 59 printk("HPFS: filesystem error: %s", err_buf);
61 printk("HPFS: filesystem error: ");
62 if (buf) printk("%s", buf);
63 else printk("%s\n",m);
64 if (!hpfs_sb(s)->sb_was_error) { 60 if (!hpfs_sb(s)->sb_was_error) {
65 if (hpfs_sb(s)->sb_err == 2) { 61 if (hpfs_sb(s)->sb_err == 2) {
66 printk("; crashing the system because you wanted it\n"); 62 printk("; crashing the system because you wanted it\n");
@@ -76,7 +72,6 @@ void hpfs_error(struct super_block *s, char *m,...)
76 } else if (s->s_flags & MS_RDONLY) printk("; going on - but anything won't be destroyed because it's read-only\n"); 72 } else if (s->s_flags & MS_RDONLY) printk("; going on - but anything won't be destroyed because it's read-only\n");
77 else printk("; corrupted filesystem mounted read/write - your computer will explode within 20 seconds ... but you wanted it so!\n"); 73 else printk("; corrupted filesystem mounted read/write - your computer will explode within 20 seconds ... but you wanted it so!\n");
78 } else printk("\n"); 74 } else printk("\n");
79 kfree(buf);
80 hpfs_sb(s)->sb_was_error = 1; 75 hpfs_sb(s)->sb_was_error = 1;
81} 76}
82 77