mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
* [PATCH] fs/fat: printk cleanup
@ 2002-04-26  6:59 Andrey Panin
  0 siblings, 0 replies; only message in thread
From: Andrey Panin @ 2002-04-26  6:59 UTC (permalink / raw)
  To: linux-kernel; +Cc: trivial


[-- Attachment #1.1: Type: text/plain, Size: 198 bytes --]


Attached patch adds proper printk levels into the FAT filesystem driver.

-- 
Andrey Panin            | Embedded systems software engineer
pazke@orbita1.ru        | PGP key: wwwkeys.eu.pgp.net

[-- Attachment #1.2: patch-printk-fat-2.5.10 --]
[-- Type: text/plain, Size: 10221 bytes --]

diff -urN -X /usr/share/dontdiff linux.vanilla/fs/fat/cache.c linux/fs/fat/cache.c
--- linux.vanilla/fs/fat/cache.c	Fri Apr 26 10:09:45 2002
+++ linux/fs/fat/cache.c	Fri Apr 26 10:13:42 2002
@@ -52,7 +52,7 @@
 	}
 	b = MSDOS_SB(sb)->fat_start + (first >> sb->s_blocksize_bits);
 	if (!(bh = fat_bread(sb, b))) {
-		printk("bread in fat_access failed\n");
+		printk(KERN_ERR "bread in fat_access failed\n");
 		return 0;
 	}
 	if ((first >> sb->s_blocksize_bits) == (last >> sb->s_blocksize_bits)) {
@@ -60,7 +60,7 @@
 	} else {
 		if (!(bh2 = fat_bread(sb, b+1))) {
 			fat_brelse(sb, bh);
-			printk("2nd bread in fat_access failed\n");
+			printk(KERN_ERR "2nd bread in fat_access failed\n");
 			return 0;
 		}
 	}
@@ -208,7 +208,7 @@
 		    && walk->start_cluster == first
 		    && walk->file_cluster == f_clu) {
 			if (walk->disk_cluster != d_clu) {
-				printk("FAT cache corruption inode=%ld\n",
+				printk(KERN_ERR "FAT cache corruption inode=%ld\n",
 					inode->i_ino);
 				spin_unlock(&fat_cache_lock);
 				fat_cache_inval_inode(inode);
@@ -327,7 +327,7 @@
 		last = nr;
 		if ((nr = fat_access(inode->i_sb,nr,-1)) == -1) return 0;
 		if (!nr) {
-			printk("fat_free: skipped EOF\n");
+			printk(KERN_ERR "fat_free: skipped EOF\n");
 			return -EIO;
 		}
 	}
diff -urN -X /usr/share/dontdiff linux.vanilla/fs/fat/inode.c linux/fs/fat/inode.c
--- linux.vanilla/fs/fat/inode.c	Fri Apr 26 10:09:45 2002
+++ linux/fs/fat/inode.c	Fri Apr 26 10:13:42 2002
@@ -298,7 +298,7 @@
 			else *debug = 1;
 		}
 		else if (!strcmp(this_char,"fat")) {
-			printk("FAT: fat option is obsolete, "
+			printk(KERN_WARNING "FAT: fat option is obsolete, "
 			       "not supported now\n");
 		}
 		else if (!strcmp(this_char,"quiet")) {
@@ -306,7 +306,7 @@
 			else opts->quiet = 1;
 		}
 		else if (!strcmp(this_char,"blocksize")) {
-			printk("FAT: blocksize option is obsolete, "
+			printk(KERN_WARNING "FAT: blocksize option is obsolete, "
 			       "not supported now\n");
 		}
 		else if (!strcmp(this_char,"sys_immutable")) {
@@ -371,7 +371,7 @@
 	do {
 		inode->i_size += 1 << MSDOS_SB(sb)->cluster_bits;
 		if (!(nr = fat_access(sb, nr, -1))) {
-			printk("FAT: Directory %ld: bad FAT\n",
+			printk(KERN_ERR "FAT: Directory %ld: bad FAT\n",
 			       inode->i_ino);
 			break;
 		}
@@ -612,32 +612,32 @@
 	sb_min_blocksize(sb, 512);
 	bh = sb_bread(sb, 0);
 	if (bh == NULL) {
-		printk("FAT: unable to read boot sector\n");
+		printk(KERN_ERR "FAT: unable to read boot sector\n");
 		goto out_fail;
 	}
 
 	b = (struct fat_boot_sector *) bh->b_data;
 	if (!b->reserved) {
 		if (!silent)
-			printk("FAT: bogus number of reserved sectors\n");
+			printk(KERN_ERR "FAT: bogus number of reserved sectors\n");
 		brelse(bh);
 		goto out_invalid;
 	}
 	if (!b->fats) {
 		if (!silent)
-			printk("FAT: bogus number of FAT structure\n");
+			printk(KERN_ERR "FAT: bogus number of FAT structure\n");
 		brelse(bh);
 		goto out_invalid;
 	}
 	if (!b->secs_track) {
 		if (!silent)
-			printk("FAT: bogus sectors-per-track value\n");
+			printk(KERN_ERR "FAT: bogus sectors-per-track value\n");
 		brelse(bh);
 		goto out_invalid;
 	}
 	if (!b->heads) {
 		if (!silent)
-			printk("FAT: bogus number-of-heads value\n");
+			printk(KERN_ERR "FAT: bogus number-of-heads value\n");
 		brelse(bh);
 		goto out_invalid;
 	}
@@ -648,7 +648,7 @@
 	    || (logical_sector_size < 512)
 	    || (PAGE_CACHE_SIZE < logical_sector_size)) {
 		if (!silent)
-			printk("FAT: bogus logical sector size %d\n",
+			printk(KERN_ERR "FAT: bogus logical sector size %d\n",
 			       logical_sector_size);
 		brelse(bh);
 		goto out_invalid;
@@ -657,14 +657,14 @@
 	if (!sbi->cluster_size
 	    || (sbi->cluster_size & (sbi->cluster_size - 1))) {
 		if (!silent)
-			printk("FAT: bogus cluster size %d\n",
+			printk(KERN_ERR "FAT: bogus cluster size %d\n",
 			       sbi->cluster_size);
 		brelse(bh);
 		goto out_invalid;
 	}
 
 	if (logical_sector_size < sb->s_blocksize) {
-		printk("FAT: logical sector size too small for device"
+		printk(KERN_ERR "FAT: logical sector size too small for device"
 		       " (logical sector size = %d)\n", logical_sector_size);
 		brelse(bh);
 		goto out_fail;
@@ -673,13 +673,13 @@
 		brelse(bh);
 
 		if (!sb_set_blocksize(sb, logical_sector_size)) {
-			printk("FAT: unable to set blocksize %d\n",
+			printk(KERN_ERR "FAT: unable to set blocksize %d\n",
 			       logical_sector_size);
 			goto out_fail;
 		}
 		bh = sb_bread(sb, 0);
 		if (bh == NULL) {
-			printk("FAT: unable to read boot sector"
+			printk(KERN_ERR "FAT: unable to read boot sector"
 			       " (logical sector size = %lu)\n",
 			       sb->s_blocksize);
 			goto out_fail;
@@ -712,7 +712,7 @@
 
 		fsinfo_bh = sb_bread(sb, sbi->fsinfo_sector);
 		if (fsinfo_bh == NULL) {
-			printk("FAT: bread failed, FSINFO block"
+			printk(KERN_ERR "FAT: bread failed, FSINFO block"
 			       " (sector = %lu)\n", sbi->fsinfo_sector);
 			brelse(bh);
 			goto out_fail;
@@ -720,7 +720,7 @@
 
 		fsinfo = (struct fat_boot_fsinfo *)fsinfo_bh->b_data;
 		if (!IS_FSINFO(fsinfo)) {
-			printk("FAT: Did not find valid FSINFO signature.\n"
+			printk(KERN_WARNING "FAT: Did not find valid FSINFO signature.\n"
 			       "     Found signature1 0x%08x signature2 0x%08x"
 			       " (sector = %lu)\n",
 			       CF_LE_L(fsinfo->signature1),
@@ -740,7 +740,7 @@
 	sbi->dir_entries =
 		CF_LE_W(get_unaligned((unsigned short *)&b->dir_entries));
 	if (sbi->dir_entries & (sbi->dir_per_block - 1)) {
-		printk("FAT: bogus directroy-entries per block\n");
+		printk(KERN_ERR "FAT: bogus directroy-entries per block\n");
 		brelse(bh);
 		goto out_invalid;
 	}
@@ -778,27 +778,27 @@
 	if (! sbi->nls_disk) {
 		/* Fail only if explicit charset specified */
 		if (sbi->options.codepage != 0) {
-			printk("FAT: codepage %s not found\n", buf);
+			printk(KERN_ERR "FAT: codepage %s not found\n", buf);
 			goto out_fail;
 		}
 		sbi->options.codepage = 0; /* already 0?? */
 		sbi->nls_disk = load_nls_default();
 	}
 	if (!silent)
-		printk("FAT: Using codepage %s\n", sbi->nls_disk->charset);
+		printk(KERN_INFO "FAT: Using codepage %s\n", sbi->nls_disk->charset);
 
 	if (sbi->options.isvfat && !sbi->options.utf8) {
 		if (sbi->options.iocharset != NULL) {
 			sbi->nls_io = load_nls(sbi->options.iocharset);
 			if (!sbi->nls_io) {
-				printk("FAT: IO charset %s not found\n",
+				printk(KERN_ERR "FAT: IO charset %s not found\n",
 				       sbi->options.iocharset);
 				goto out_fail;
 			}
 		} else
 			sbi->nls_io = load_nls_default();
 		if (!silent)
-			printk("FAT: Using IO charset %s\n",
+			printk(KERN_INFO "FAT: Using IO charset %s\n",
 			       sbi->nls_io->charset);
 	}
 
@@ -812,7 +812,7 @@
 	insert_inode_hash(root_inode);
 	sb->s_root = d_alloc_root(root_inode);
 	if (!sb->s_root) {
-		printk("FAT: get root inode failed\n");
+		printk(KERN_ERR "FAT: get root inode failed\n");
 		iput(root_inode);
 		goto out_fail;
 	}
@@ -934,7 +934,7 @@
 		    /* includes .., compensating for "self" */
 #ifdef DEBUG
 		if (!inode->i_nlink) {
-			printk("directory %d: i_nlink == 0\n",inode->i_ino);
+			printk(KERN_DEBUG "directory %d: i_nlink == 0\n",inode->i_ino);
 			inode->i_nlink = 1;
 		}
 #endif
@@ -990,7 +990,7 @@
 	}
 	lock_kernel();
 	if (!(bh = fat_bread(sb, i_pos >> MSDOS_SB(sb)->dir_per_block_bits))) {
-		printk("dev = %s, ino = %d\n", sb->s_id, i_pos);
+		printk(KERN_ERR "dev = %s, ino = %d\n", sb->s_id, i_pos);
 		fat_fs_panic(sb, "msdos_write_inode: unable to read i-node block");
 		unlock_kernel();
 		return;
diff -urN -X /usr/share/dontdiff linux.vanilla/fs/fat/misc.c linux/fs/fat/misc.c
--- linux.vanilla/fs/fat/misc.c	Fri Apr 26 10:09:45 2002
+++ linux/fs/fat/misc.c	Fri Apr 26 10:13:42 2002
@@ -48,10 +48,10 @@
 	if (not_ro)
 		s->s_flags |= MS_RDONLY;
 
-	printk("FAT: Filesystem panic (dev %s)\n"
+	printk(KERN_ERR "FAT: Filesystem panic (dev %s)\n"
 	       "    %s\n", s->s_id, panic_msg);
 	if (not_ro)
-		printk("    File system has been set read-only\n");
+		printk(KERN_ERR "    File system has been set read-only\n");
 }
 
 
@@ -74,7 +74,7 @@
 				if (!strncmp(extension,walk,3)) return 0;
 			return 1;	/* default binary conversion */
 		default:
-			printk("Invalid conversion mode - defaulting to "
+			printk(KERN_WARNING "Invalid conversion mode - defaulting to "
 			    "binary.\n");
 			return 1;
 	}
@@ -99,14 +99,14 @@
 
 	bh = fat_bread(sb, MSDOS_SB(sb)->fsinfo_sector);
 	if (bh == NULL) {
-		printk("FAT bread failed in fat_clusters_flush\n");
+		printk(KERN_ERR "FAT bread failed in fat_clusters_flush\n");
 		return;
 	}
 
 	fsinfo = (struct fat_boot_fsinfo *)bh->b_data;
 	/* Sanity check */
 	if (!IS_FSINFO(fsinfo)) {
-		printk("FAT: Did not find valid FSINFO signature.\n"
+		printk(KERN_ERR "FAT: Did not find valid FSINFO signature.\n"
 		       "     Found signature1 0x%08x signature2 0x%08x"
 		       " (sector = %lu)\n",
 		       CF_LE_L(fsinfo->signature1), CF_LE_L(fsinfo->signature2),
@@ -194,7 +194,7 @@
 		mark_inode_dirty(inode);
 	}
 	if (file_cluster != (inode->i_blocks >> (cluster_bits - 9))) {
-		printk ("file_cluster badly computed!!! %d <> %ld\n",
+		printk (KERN_ERR "file_cluster badly computed!!! %d <> %ld\n",
 			file_cluster, inode->i_blocks >> (cluster_bits - 9));
 		fat_cache_inval_inode(inode);
 	}
@@ -228,7 +228,7 @@
 	} else {
 		for ( ; sector < last_sector; sector++) {
 			if (!(bh = fat_getblk(sb, sector)))
-				printk("FAT: fat_getblk() failed\n");
+				printk(KERN_ERR "FAT: fat_getblk() failed\n");
 			else {
 				memset(bh->b_data, 0, sb->s_blocksize);
 				fat_set_uptodate(sb, bh, 1);
@@ -346,7 +346,7 @@
 			return -1; /* beyond EOF */
 		*pos += sizeof(struct msdos_dir_entry);
 		if (!(*bh = fat_bread(sb, sector))) {
-			printk("Directory sread (sector 0x%x) failed\n",sector);
+			printk(KERN_ERR "Directory sread (sector 0x%x) failed\n",sector);
 			continue;
 		}
 		PRINTK (("get_entry apres sread\n"));

[-- Attachment #2: Type: application/pgp-signature, Size: 232 bytes --]

^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2002-04-26  6:55 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2002-04-26  6:59 [PATCH] fs/fat: printk cleanup Andrey Panin

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®