diff options
author | Alexey Dobriyan <adobriyan@gmail.com> | 2006-12-06 23:37:04 -0500 |
---|---|---|
committer | Linus Torvalds <torvalds@woody.osdl.org> | 2006-12-07 11:39:35 -0500 |
commit | 352d94d040053d93bf1cf4acb4be9635e69d9200 (patch) | |
tree | 85fd048b504dfc375bb9515f8d938353e168ce04 /fs/hpfs | |
parent | 4a6e617a4bec9fb2ee4a16cf59565b2af5049e12 (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')
-rw-r--r-- | fs/hpfs/hpfs_fn.h | 3 | ||||
-rw-r--r-- | fs/hpfs/super.c | 23 |
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 | ||
320 | void hpfs_error(struct super_block *, char *, ...); | 320 | void hpfs_error(struct super_block *, const char *, ...) |
321 | __attribute__((format (printf, 2, 3))); | ||
321 | int hpfs_stop_cycles(struct super_block *, int, int *, int *, char *); | 322 | int hpfs_stop_cycles(struct super_block *, int, int *, int *, char *); |
322 | unsigned hpfs_count_one_bitmap(struct super_block *, secno); | 323 | unsigned 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... */ |
49 | static char err_buf[1024]; | ||
49 | 50 | ||
50 | #define ERR_BUF_SIZE 1024 | 51 | void hpfs_error(struct super_block *s, const char *fmt, ...) |
51 | |||
52 | void 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 | ||