From 7cf3cc3036cb7b1147350bf7c3f1ab98c160eb7b Mon Sep 17 00:00:00 2001 From: Roman Zippel Date: Wed, 18 Jan 2006 17:43:07 -0800 Subject: [PATCH] hfs: cleanup HFS prints Add the log level and a "hfs: " prefix to all kernel prints. Signed-off-by: Roman Zippel Signed-off-by: Andrew Morton Signed-off-by: Linus Torvalds --- fs/hfs/bfind.c | 3 +-- fs/hfs/bnode.c | 6 +++--- fs/hfs/brec.c | 2 +- fs/hfs/btree.c | 10 +++++----- fs/hfs/catalog.c | 2 +- fs/hfs/dir.c | 12 ++++++------ fs/hfs/hfs_fs.h | 3 --- fs/hfs/inode.c | 1 - fs/hfs/mdb.c | 22 +++++++++++----------- fs/hfs/super.c | 40 ++++++++++++++++++++-------------------- 10 files changed, 48 insertions(+), 53 deletions(-) (limited to 'fs/hfs') diff --git a/fs/hfs/bfind.c b/fs/hfs/bfind.c index 89450ae3222..f13f1494d4f 100644 --- a/fs/hfs/bfind.c +++ b/fs/hfs/bfind.c @@ -64,7 +64,6 @@ int __hfs_brec_find(struct hfs_bnode *bnode, struct hfs_find_data *fd) else e = rec - 1; } while (b <= e); - //printk("%d: %d,%d,%d\n", bnode->this, b, e, rec); if (rec != e && e >= 0) { len = hfs_brec_lenoff(bnode, e, &off); keylen = hfs_brec_keylen(bnode, e); @@ -127,7 +126,7 @@ int hfs_brec_find(struct hfs_find_data *fd) return res; invalid: - printk("HFS: inconsistency in B*Tree (%d,%d,%d,%u,%u)\n", + printk(KERN_ERR "hfs: inconsistency in B*Tree (%d,%d,%d,%u,%u)\n", height, bnode->height, bnode->type, nidx, parent); res = -EIO; release: diff --git a/fs/hfs/bnode.c b/fs/hfs/bnode.c index 3d5cdc6847c..a7a7d77f3fd 100644 --- a/fs/hfs/bnode.c +++ b/fs/hfs/bnode.c @@ -198,7 +198,7 @@ void hfs_bnode_unlink(struct hfs_bnode *node) // move down? if (!node->prev && !node->next) { - printk("hfs_btree_del_level\n"); + printk(KERN_DEBUG "hfs_btree_del_level\n"); } if (!node->parent) { tree->root = 0; @@ -219,7 +219,7 @@ struct hfs_bnode *hfs_bnode_findhash(struct hfs_btree *tree, u32 cnid) struct hfs_bnode *node; if (cnid >= tree->node_count) { - printk("HFS: request for non-existent node %d in B*Tree\n", cnid); + printk(KERN_ERR "hfs: request for non-existent node %d in B*Tree\n", cnid); return NULL; } @@ -242,7 +242,7 @@ static struct hfs_bnode *__hfs_bnode_create(struct hfs_btree *tree, u32 cnid) loff_t off; if (cnid >= tree->node_count) { - printk("HFS: request for non-existent node %d in B*Tree\n", cnid); + printk(KERN_ERR "hfs: request for non-existent node %d in B*Tree\n", cnid); return NULL; } diff --git a/fs/hfs/brec.c b/fs/hfs/brec.c index 7d8fff2c25f..5c87cf4801f 100644 --- a/fs/hfs/brec.c +++ b/fs/hfs/brec.c @@ -362,7 +362,7 @@ again: end_off = hfs_bnode_read_u16(parent, end_rec_off); if (end_rec_off - end_off < diff) { - printk("splitting index node...\n"); + printk(KERN_DEBUG "hfs: splitting index node...\n"); fd->bnode = parent; new_node = hfs_bnode_split(fd); if (IS_ERR(new_node)) diff --git a/fs/hfs/btree.c b/fs/hfs/btree.c index 394725efa1c..7bb11edd148 100644 --- a/fs/hfs/btree.c +++ b/fs/hfs/btree.c @@ -111,7 +111,7 @@ void hfs_btree_close(struct hfs_btree *tree) while ((node = tree->node_hash[i])) { tree->node_hash[i] = node->next_hash; if (atomic_read(&node->refcnt)) - printk("HFS: node %d:%d still has %d user(s)!\n", + printk(KERN_ERR "hfs: node %d:%d still has %d user(s)!\n", node->tree->cnid, node->this, atomic_read(&node->refcnt)); hfs_bnode_free(node); tree->node_hash_cnt--; @@ -252,7 +252,7 @@ struct hfs_bnode *hfs_bmap_alloc(struct hfs_btree *tree) kunmap(*pagep); nidx = node->next; if (!nidx) { - printk("create new bmap node...\n"); + printk(KERN_DEBUG "hfs: create new bmap node...\n"); next_node = hfs_bmap_new_bmap(node, idx); } else next_node = hfs_bnode_find(tree, nidx); @@ -292,7 +292,7 @@ void hfs_bmap_free(struct hfs_bnode *node) hfs_bnode_put(node); if (!i) { /* panic */; - printk("HFS: unable to free bnode %u. bmap not found!\n", node->this); + printk(KERN_CRIT "hfs: unable to free bnode %u. bmap not found!\n", node->this); return; } node = hfs_bnode_find(tree, i); @@ -300,7 +300,7 @@ void hfs_bmap_free(struct hfs_bnode *node) return; if (node->type != HFS_NODE_MAP) { /* panic */; - printk("HFS: invalid bmap found! (%u,%d)\n", node->this, node->type); + printk(KERN_CRIT "hfs: invalid bmap found! (%u,%d)\n", node->this, node->type); hfs_bnode_put(node); return; } @@ -313,7 +313,7 @@ void hfs_bmap_free(struct hfs_bnode *node) m = 1 << (~nidx & 7); byte = data[off]; if (!(byte & m)) { - printk("HFS: trying to free free bnode %u(%d)\n", node->this, node->type); + printk(KERN_CRIT "hfs: trying to free free bnode %u(%d)\n", node->this, node->type); kunmap(page); hfs_bnode_put(node); return; diff --git a/fs/hfs/catalog.c b/fs/hfs/catalog.c index 2fcd679f023..ba851576ebb 100644 --- a/fs/hfs/catalog.c +++ b/fs/hfs/catalog.c @@ -184,7 +184,7 @@ int hfs_cat_find_brec(struct super_block *sb, u32 cnid, type = rec.type; if (type != HFS_CDR_THD && type != HFS_CDR_FTH) { - printk("HFS-fs: Found bad thread record in catalog\n"); + printk(KERN_ERR "hfs: found bad thread record in catalog\n"); return -EIO; } diff --git a/fs/hfs/dir.c b/fs/hfs/dir.c index e1f24befba5..534e5a7480e 100644 --- a/fs/hfs/dir.c +++ b/fs/hfs/dir.c @@ -81,12 +81,12 @@ static int hfs_readdir(struct file *filp, void *dirent, filldir_t filldir) case 1: hfs_bnode_read(fd.bnode, &entry, fd.entryoffset, fd.entrylength); if (entry.type != HFS_CDR_THD) { - printk("HFS: bad catalog folder thread\n"); + printk(KERN_ERR "hfs: bad catalog folder thread\n"); err = -EIO; goto out; } //if (fd.entrylength < HFS_MIN_THREAD_SZ) { - // printk("HFS: truncated catalog thread\n"); + // printk(KERN_ERR "hfs: truncated catalog thread\n"); // err = -EIO; // goto out; //} @@ -105,7 +105,7 @@ static int hfs_readdir(struct file *filp, void *dirent, filldir_t filldir) for (;;) { if (be32_to_cpu(fd.key->cat.ParID) != inode->i_ino) { - printk("HFS: walked past end of dir\n"); + printk(KERN_ERR "hfs: walked past end of dir\n"); err = -EIO; goto out; } @@ -114,7 +114,7 @@ static int hfs_readdir(struct file *filp, void *dirent, filldir_t filldir) len = hfs_mac2asc(sb, strbuf, &fd.key->cat.CName); if (type == HFS_CDR_DIR) { if (fd.entrylength < sizeof(struct hfs_cat_dir)) { - printk("HFS: small dir entry\n"); + printk(KERN_ERR "hfs: small dir entry\n"); err = -EIO; goto out; } @@ -123,7 +123,7 @@ static int hfs_readdir(struct file *filp, void *dirent, filldir_t filldir) break; } else if (type == HFS_CDR_FIL) { if (fd.entrylength < sizeof(struct hfs_cat_file)) { - printk("HFS: small file entry\n"); + printk(KERN_ERR "hfs: small file entry\n"); err = -EIO; goto out; } @@ -131,7 +131,7 @@ static int hfs_readdir(struct file *filp, void *dirent, filldir_t filldir) be32_to_cpu(entry.file.FlNum), DT_REG)) break; } else { - printk("HFS: bad catalog entry type %d\n", type); + printk(KERN_ERR "hfs: bad catalog entry type %d\n", type); err = -EIO; goto out; } diff --git a/fs/hfs/hfs_fs.h b/fs/hfs/hfs_fs.h index cc5dcd52e23..18ce47ab1b7 100644 --- a/fs/hfs/hfs_fs.h +++ b/fs/hfs/hfs_fs.h @@ -35,9 +35,6 @@ #define dprint(flg, fmt, args...) \ if (flg & DBG_MASK) printk(fmt , ## args) -#define hfs_warn(format, args...) printk(KERN_WARNING format , ## args) -#define hfs_error(format, args...) printk(KERN_ERR format , ## args) - /* * struct hfs_inode_info * diff --git a/fs/hfs/inode.c b/fs/hfs/inode.c index 050a4927649..39fd85b9b91 100644 --- a/fs/hfs/inode.c +++ b/fs/hfs/inode.c @@ -95,7 +95,6 @@ static int hfs_releasepage(struct page *page, gfp_t mask) } while (--i && nidx < tree->node_count); spin_unlock(&tree->hash_lock); } - //printk("releasepage: %lu,%x = %d\n", page->index, mask, res); return res ? try_to_free_buffers(page) : 0; } diff --git a/fs/hfs/mdb.c b/fs/hfs/mdb.c index 0a473f79c89..b4651e128d7 100644 --- a/fs/hfs/mdb.c +++ b/fs/hfs/mdb.c @@ -47,7 +47,7 @@ static int hfs_get_last_session(struct super_block *sb, *start = (sector_t)te.cdte_addr.lba << 2; return 0; } - printk(KERN_ERR "HFS: Invalid session number or type of track\n"); + printk(KERN_ERR "hfs: invalid session number or type of track\n"); return -EINVAL; } ms_info.addr_format = CDROM_LBA; @@ -100,7 +100,7 @@ int hfs_mdb_get(struct super_block *sb) HFS_SB(sb)->alloc_blksz = size = be32_to_cpu(mdb->drAlBlkSiz); if (!size || (size & (HFS_SECTOR_SIZE - 1))) { - hfs_warn("hfs_fs: bad allocation block size %d\n", size); + printk(KERN_ERR "hfs: bad allocation block size %d\n", size); goto out_bh; } @@ -117,7 +117,7 @@ int hfs_mdb_get(struct super_block *sb) size >>= 1; brelse(bh); if (!sb_set_blocksize(sb, size)) { - printk("hfs_fs: unable to set blocksize to %u\n", size); + printk(KERN_ERR "hfs: unable to set blocksize to %u\n", size); goto out; } @@ -161,8 +161,8 @@ int hfs_mdb_get(struct super_block *sb) } if (!HFS_SB(sb)->alt_mdb) { - hfs_warn("hfs_fs: unable to locate alternate MDB\n"); - hfs_warn("hfs_fs: continuing without an alternate MDB\n"); + printk(KERN_WARNING "hfs: unable to locate alternate MDB\n"); + printk(KERN_WARNING "hfs: continuing without an alternate MDB\n"); } HFS_SB(sb)->bitmap = (__be32 *)__get_free_pages(GFP_KERNEL, PAGE_SIZE < 8192 ? 1 : 0); @@ -177,7 +177,7 @@ int hfs_mdb_get(struct super_block *sb) while (size) { bh = sb_bread(sb, off >> sb->s_blocksize_bits); if (!bh) { - hfs_warn("hfs_fs: unable to read volume bitmap\n"); + printk(KERN_ERR "hfs: unable to read volume bitmap\n"); goto out; } off2 = off & (sb->s_blocksize - 1); @@ -191,23 +191,23 @@ int hfs_mdb_get(struct super_block *sb) HFS_SB(sb)->ext_tree = hfs_btree_open(sb, HFS_EXT_CNID, hfs_ext_keycmp); if (!HFS_SB(sb)->ext_tree) { - hfs_warn("hfs_fs: unable to open extent tree\n"); + printk(KERN_ERR "hfs: unable to open extent tree\n"); goto out; } HFS_SB(sb)->cat_tree = hfs_btree_open(sb, HFS_CAT_CNID, hfs_cat_keycmp); if (!HFS_SB(sb)->cat_tree) { - hfs_warn("hfs_fs: unable to open catalog tree\n"); + printk(KERN_ERR "hfs: unable to open catalog tree\n"); goto out; } attrib = mdb->drAtrb; if (!(attrib & cpu_to_be16(HFS_SB_ATTRIB_UNMNT))) { - hfs_warn("HFS-fs warning: Filesystem was not cleanly unmounted, " + printk(KERN_WARNING "hfs: filesystem was not cleanly unmounted, " "running fsck.hfs is recommended. mounting read-only.\n"); sb->s_flags |= MS_RDONLY; } if ((attrib & cpu_to_be16(HFS_SB_ATTRIB_SLOCK))) { - hfs_warn("HFS-fs: Filesystem is marked locked, mounting read-only.\n"); + printk(KERN_WARNING "hfs: filesystem is marked locked, mounting read-only.\n"); sb->s_flags |= MS_RDONLY; } if (!(sb->s_flags & MS_RDONLY)) { @@ -303,7 +303,7 @@ void hfs_mdb_commit(struct super_block *sb) while (size) { bh = sb_bread(sb, block); if (!bh) { - hfs_warn("hfs_fs: unable to read volume bitmap\n"); + printk(KERN_ERR "hfs: unable to read volume bitmap\n"); break; } len = min((int)sb->s_blocksize - off, size); diff --git a/fs/hfs/super.c b/fs/hfs/super.c index c5074aeafca..1181d116117 100644 --- a/fs/hfs/super.c +++ b/fs/hfs/super.c @@ -101,12 +101,12 @@ static int hfs_remount(struct super_block *sb, int *flags, char *data) return 0; if (!(*flags & MS_RDONLY)) { if (!(HFS_SB(sb)->mdb->drAtrb & cpu_to_be16(HFS_SB_ATTRIB_UNMNT))) { - printk("HFS-fs warning: Filesystem was not cleanly unmounted, " + printk(KERN_WARNING "hfs: filesystem was not cleanly unmounted, " "running fsck.hfs is recommended. leaving read-only.\n"); sb->s_flags |= MS_RDONLY; *flags |= MS_RDONLY; } else if (HFS_SB(sb)->mdb->drAtrb & cpu_to_be16(HFS_SB_ATTRIB_SLOCK)) { - printk("HFS-fs: Filesystem is marked locked, leaving read-only.\n"); + printk(KERN_WARNING "hfs: filesystem is marked locked, leaving read-only.\n"); sb->s_flags |= MS_RDONLY; *flags |= MS_RDONLY; } @@ -229,21 +229,21 @@ static int parse_options(char *options, struct hfs_sb_info *hsb) switch (token) { case opt_uid: if (match_int(&args[0], &tmp)) { - printk("HFS: uid requires an argument\n"); + printk(KERN_ERR "hfs: uid requires an argument\n"); return 0; } hsb->s_uid = (uid_t)tmp; break; case opt_gid: if (match_int(&args[0], &tmp)) { - printk("HFS: gid requires an argument\n"); + printk(KERN_ERR "hfs: gid requires an argument\n"); return 0; } hsb->s_gid = (gid_t)tmp; break; case opt_umask: if (match_octal(&args[0], &tmp)) { - printk("HFS: umask requires a value\n"); + printk(KERN_ERR "hfs: umask requires a value\n"); return 0; } hsb->s_file_umask = (umode_t)tmp; @@ -251,39 +251,39 @@ static int parse_options(char *options, struct hfs_sb_info *hsb) break; case opt_file_umask: if (match_octal(&args[0], &tmp)) { - printk("HFS: file_umask requires a value\n"); + printk(KERN_ERR "hfs: file_umask requires a value\n"); return 0; } hsb->s_file_umask = (umode_t)tmp; break; case opt_dir_umask: if (match_octal(&args[0], &tmp)) { - printk("HFS: dir_umask requires a value\n"); + printk(KERN_ERR "hfs: dir_umask requires a value\n"); return 0; } hsb->s_dir_umask = (umode_t)tmp; break; case opt_part: if (match_int(&args[0], &hsb->part)) { - printk("HFS: part requires an argument\n"); + printk(KERN_ERR "hfs: part requires an argument\n"); return 0; } break; case opt_session: if (match_int(&args[0], &hsb->session)) { - printk("HFS: session requires an argument\n"); + printk(KERN_ERR "hfs: session requires an argument\n"); return 0; } break; case opt_type: if (match_fourchar(&args[0], &hsb->s_type)) { - printk("HFS+-fs: type requires a 4 character value\n"); + printk(KERN_ERR "hfs: type requires a 4 character value\n"); return 0; } break; case opt_creator: if (match_fourchar(&args[0], &hsb->s_creator)) { - printk("HFS+-fs: creator requires a 4 character value\n"); + printk(KERN_ERR "hfs: creator requires a 4 character value\n"); return 0; } break; @@ -292,13 +292,13 @@ static int parse_options(char *options, struct hfs_sb_info *hsb) break; case opt_codepage: if (hsb->nls_disk) { - printk("HFS+-fs: unable to change codepage\n"); + printk(KERN_ERR "hfs: unable to change codepage\n"); return 0; } p = match_strdup(&args[0]); hsb->nls_disk = load_nls(p); if (!hsb->nls_disk) { - printk("HFS+-fs: unable to load codepage \"%s\"\n", p); + printk(KERN_ERR "hfs: unable to load codepage \"%s\"\n", p); kfree(p); return 0; } @@ -306,13 +306,13 @@ static int parse_options(char *options, struct hfs_sb_info *hsb) break; case opt_iocharset: if (hsb->nls_io) { - printk("HFS: unable to change iocharset\n"); + printk(KERN_ERR "hfs: unable to change iocharset\n"); return 0; } p = match_strdup(&args[0]); hsb->nls_io = load_nls(p); if (!hsb->nls_io) { - printk("HFS: unable to load iocharset \"%s\"\n", p); + printk(KERN_ERR "hfs: unable to load iocharset \"%s\"\n", p); kfree(p); return 0; } @@ -326,7 +326,7 @@ static int parse_options(char *options, struct hfs_sb_info *hsb) if (hsb->nls_disk && !hsb->nls_io) { hsb->nls_io = load_nls_default(); if (!hsb->nls_io) { - printk("HFS: unable to load default iocharset\n"); + printk(KERN_ERR "hfs: unable to load default iocharset\n"); return 0; } } @@ -364,7 +364,7 @@ static int hfs_fill_super(struct super_block *sb, void *data, int silent) res = -EINVAL; if (!parse_options((char *)data, sbi)) { - hfs_warn("hfs_fs: unable to parse mount options.\n"); + printk(KERN_ERR "hfs: unable to parse mount options.\n"); goto bail; } @@ -375,7 +375,7 @@ static int hfs_fill_super(struct super_block *sb, void *data, int silent) res = hfs_mdb_get(sb); if (res) { if (!silent) - hfs_warn("VFS: Can't find a HFS filesystem on dev %s.\n", + printk(KERN_WARNING "hfs: can't find a HFS filesystem on dev %s.\n", hfs_mdb_name(sb)); res = -EINVAL; goto bail; @@ -407,7 +407,7 @@ static int hfs_fill_super(struct super_block *sb, void *data, int silent) bail_iput: iput(root_inode); bail_no_root: - hfs_warn("hfs_fs: get root inode failed.\n"); + printk(KERN_ERR "hfs: get root inode failed.\n"); bail: hfs_mdb_put(sb); return res; @@ -454,7 +454,7 @@ static void __exit exit_hfs_fs(void) { unregister_filesystem(&hfs_fs_type); if (kmem_cache_destroy(hfs_inode_cachep)) - printk(KERN_INFO "hfs_inode_cache: not all structures were freed\n"); + printk(KERN_ERR "hfs_inode_cache: not all structures were freed\n"); } module_init(init_hfs_fs) -- cgit v1.2.3