aboutsummaryrefslogtreecommitdiffstats
path: root/fs/adfs/super.c
diff options
context:
space:
mode:
authorRussell King <rmk+kernel@armlinux.org.uk>2019-06-04 09:49:52 -0400
committerAl Viro <viro@zeniv.linux.org.uk>2019-06-26 20:14:14 -0400
commitceb3b10613eba86ddf043345338e32673a27f87a (patch)
tree092253e6dcbe03fb4d46eefbdee1290da3fc88d9 /fs/adfs/super.c
parent2e67080d87087fdba88059b1f63e4301ea0fad3a (diff)
fs/adfs: clean up error message printing
Overhaul our message printing: - provide a consistent way to print messages: - filesystem corruption should be reported via adfs_error() - everything else should use adfs_msg() - clean up the error message printing when mounting a filesystem - fix the messages printed by the big directory format code to only use adfs_error() when there is filesystem corruption, otherwise use adfs_msg(). Signed-off-by: Russell King <rmk+kernel@armlinux.org.uk> Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
Diffstat (limited to 'fs/adfs/super.c')
-rw-r--r--fs/adfs/super.c45
1 files changed, 29 insertions, 16 deletions
diff --git a/fs/adfs/super.c b/fs/adfs/super.c
index 315657a3bac7..6910a9afa9fd 100644
--- a/fs/adfs/super.c
+++ b/fs/adfs/super.c
@@ -38,6 +38,18 @@ void __adfs_error(struct super_block *sb, const char *function, const char *fmt,
38 va_end(args); 38 va_end(args);
39} 39}
40 40
41void adfs_msg(struct super_block *sb, const char *pfx, const char *fmt, ...)
42{
43 struct va_format vaf;
44 va_list args;
45
46 va_start(args, fmt);
47 vaf.fmt = fmt;
48 vaf.va = &args;
49 printk("%sADFS-fs (%s): %pV\n", pfx, sb->s_id, &vaf);
50 va_end(args);
51}
52
41static int adfs_checkdiscrecord(struct adfs_discrecord *dr) 53static int adfs_checkdiscrecord(struct adfs_discrecord *dr)
42{ 54{
43 int i; 55 int i;
@@ -203,8 +215,9 @@ static int parse_options(struct super_block *sb, char *options)
203 asb->s_ftsuffix = option; 215 asb->s_ftsuffix = option;
204 break; 216 break;
205 default: 217 default:
206 printk("ADFS-fs: unrecognised mount option \"%s\" " 218 adfs_msg(sb, KERN_ERR,
207 "or missing value\n", p); 219 "unrecognised mount option \"%s\" or missing value",
220 p);
208 return -EINVAL; 221 return -EINVAL;
209 } 222 }
210 } 223 }
@@ -377,7 +390,7 @@ static int adfs_fill_super(struct super_block *sb, void *data, int silent)
377 390
378 sb_set_blocksize(sb, BLOCK_SIZE); 391 sb_set_blocksize(sb, BLOCK_SIZE);
379 if (!(bh = sb_bread(sb, ADFS_DISCRECORD / BLOCK_SIZE))) { 392 if (!(bh = sb_bread(sb, ADFS_DISCRECORD / BLOCK_SIZE))) {
380 adfs_error(sb, "unable to read superblock"); 393 adfs_msg(sb, KERN_ERR, "error: unable to read superblock");
381 ret = -EIO; 394 ret = -EIO;
382 goto error; 395 goto error;
383 } 396 }
@@ -385,11 +398,8 @@ static int adfs_fill_super(struct super_block *sb, void *data, int silent)
385 b_data = bh->b_data + (ADFS_DISCRECORD % BLOCK_SIZE); 398 b_data = bh->b_data + (ADFS_DISCRECORD % BLOCK_SIZE);
386 399
387 if (adfs_checkbblk(b_data)) { 400 if (adfs_checkbblk(b_data)) {
388 if (!silent)
389 printk("VFS: Can't find an adfs filesystem on dev "
390 "%s.\n", sb->s_id);
391 ret = -EINVAL; 401 ret = -EINVAL;
392 goto error_free_bh; 402 goto error_badfs;
393 } 403 }
394 404
395 dr = (struct adfs_discrecord *)(b_data + ADFS_DR_OFFSET); 405 dr = (struct adfs_discrecord *)(b_data + ADFS_DR_OFFSET);
@@ -398,33 +408,31 @@ static int adfs_fill_super(struct super_block *sb, void *data, int silent)
398 * Do some sanity checks on the ADFS disc record 408 * Do some sanity checks on the ADFS disc record
399 */ 409 */
400 if (adfs_checkdiscrecord(dr)) { 410 if (adfs_checkdiscrecord(dr)) {
401 if (!silent)
402 printk("VPS: Can't find an adfs filesystem on dev "
403 "%s.\n", sb->s_id);
404 ret = -EINVAL; 411 ret = -EINVAL;
405 goto error_free_bh; 412 goto error_badfs;
406 } 413 }
407 414
408 brelse(bh); 415 brelse(bh);
409 if (sb_set_blocksize(sb, 1 << dr->log2secsize)) { 416 if (sb_set_blocksize(sb, 1 << dr->log2secsize)) {
410 bh = sb_bread(sb, ADFS_DISCRECORD / sb->s_blocksize); 417 bh = sb_bread(sb, ADFS_DISCRECORD / sb->s_blocksize);
411 if (!bh) { 418 if (!bh) {
412 adfs_error(sb, "couldn't read superblock on " 419 adfs_msg(sb, KERN_ERR,
413 "2nd try."); 420 "error: couldn't read superblock on 2nd try.");
414 ret = -EIO; 421 ret = -EIO;
415 goto error; 422 goto error;
416 } 423 }
417 b_data = bh->b_data + (ADFS_DISCRECORD % sb->s_blocksize); 424 b_data = bh->b_data + (ADFS_DISCRECORD % sb->s_blocksize);
418 if (adfs_checkbblk(b_data)) { 425 if (adfs_checkbblk(b_data)) {
419 adfs_error(sb, "disc record mismatch, very weird!"); 426 adfs_msg(sb, KERN_ERR,
427 "error: disc record mismatch, very weird!");
420 ret = -EINVAL; 428 ret = -EINVAL;
421 goto error_free_bh; 429 goto error_free_bh;
422 } 430 }
423 dr = (struct adfs_discrecord *)(b_data + ADFS_DR_OFFSET); 431 dr = (struct adfs_discrecord *)(b_data + ADFS_DR_OFFSET);
424 } else { 432 } else {
425 if (!silent) 433 if (!silent)
426 printk(KERN_ERR "VFS: Unsupported blocksize on dev " 434 adfs_msg(sb, KERN_ERR,
427 "%s.\n", sb->s_id); 435 "error: unsupported blocksize");
428 ret = -EINVAL; 436 ret = -EINVAL;
429 goto error; 437 goto error;
430 } 438 }
@@ -497,6 +505,11 @@ static int adfs_fill_super(struct super_block *sb, void *data, int silent)
497 } 505 }
498 return 0; 506 return 0;
499 507
508error_badfs:
509 if (!silent)
510 adfs_msg(sb, KERN_ERR,
511 "error: can't find an ADFS filesystem on dev %s.",
512 sb->s_id);
500error_free_bh: 513error_free_bh:
501 brelse(bh); 514 brelse(bh);
502error: 515error: