aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--fs/hpfs/hpfs_fn.h3
-rw-r--r--fs/hpfs/super.c23
2 files changed, 11 insertions, 15 deletions
diff --git a/fs/hpfs/hpfs_fn.h b/fs/hpfs/hpfs_fn.h
index 32ab51e42b96..1c07aa82d327 100644
--- a/fs/hpfs/hpfs_fn.h
+++ b/fs/hpfs/hpfs_fn.h
@@ -317,7 +317,8 @@ static inline struct hpfs_sb_info *hpfs_sb(struct super_block *sb)
317 317
318/* super.c */ 318/* super.c */
319 319
320void hpfs_error(struct super_block *, char *, ...); 320void hpfs_error(struct super_block *, const char *, ...)
321 __attribute__((format (printf, 2, 3)));
321int hpfs_stop_cycles(struct super_block *, int, int *, int *, char *); 322int hpfs_stop_cycles(struct super_block *, int, int *, int *, char *);
322unsigned hpfs_count_one_bitmap(struct super_block *, secno); 323unsigned hpfs_count_one_bitmap(struct super_block *, secno);
323 324
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