提交 634725a9 编写于 作者: R Roman Zippel 提交者: Linus Torvalds

[PATCH] hfs: cleanup HFS+ prints

Add the log level and a "hfs: " prefix to all kernel prints.  (HFS and HFS+
will use the same prefix, as they share some code and could be merged at some
point.)
Signed-off-by: NRoman Zippel <zippel@linux-m68k.org>
Signed-off-by: NAndrew Morton <akpm@osdl.org>
Signed-off-by: NLinus Torvalds <torvalds@osdl.org>
上级 5131cf15
......@@ -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+-fs: 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:
......
......@@ -358,7 +358,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;
......@@ -379,7 +379,7 @@ struct hfs_bnode *hfs_bnode_findhash(struct hfs_btree *tree, u32 cnid)
struct hfs_bnode *node;
if (cnid >= tree->node_count) {
printk("HFS+-fs: 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;
}
......@@ -402,7 +402,7 @@ static struct hfs_bnode *__hfs_bnode_create(struct hfs_btree *tree, u32 cnid)
loff_t off;
if (cnid >= tree->node_count) {
printk("HFS+-fs: 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;
}
......@@ -576,8 +576,9 @@ struct hfs_bnode *hfs_bnode_create(struct hfs_btree *tree, u32 num)
node = hfs_bnode_findhash(tree, num);
spin_unlock(&tree->hash_lock);
if (node) {
printk("new node %u already hashed?\n", num);
BUG();
printk(KERN_CRIT "new node %u already hashed?\n", num);
WARN_ON(1);
return node;
}
node = __hfs_bnode_create(tree, num);
if (!node)
......
......@@ -360,7 +360,7 @@ static int hfs_brec_update_parent(struct hfs_find_data *fd)
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))
......
......@@ -39,7 +39,7 @@ struct hfs_btree *hfs_btree_open(struct super_block *sb, u32 id)
} else if (id == HFSPLUS_CAT_CNID) {
tree->keycmp = hfsplus_cat_cmp_key;
} else {
printk("HFS+-fs: unknown B*Tree requested\n");
printk(KERN_ERR "hfs: unknown B*Tree requested\n");
goto free_tree;
}
tree->inode = iget(sb, id);
......@@ -99,7 +99,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_CRIT "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--;
......@@ -223,10 +223,6 @@ struct hfs_bnode *hfs_bmap_alloc(struct hfs_btree *tree)
tree->free_nodes--;
mark_inode_dirty(tree->inode);
hfs_bnode_put(node);
if (!idx) {
printk("unexpected idx %u (%u)\n", idx, node->this);
BUG();
}
return hfs_bnode_create(tree, idx);
}
}
......@@ -242,7 +238,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);
......@@ -284,7 +280,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);
......@@ -292,7 +288,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;
}
......@@ -305,7 +301,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;
......
......@@ -139,7 +139,7 @@ int hfsplus_find_cat(struct super_block *sb, u32 cnid,
type = be16_to_cpu(tmp.type);
if (type != HFSPLUS_FOLDER_THREAD && type != HFSPLUS_FILE_THREAD) {
printk("HFS+-fs: Found bad thread record in catalog\n");
printk(KERN_ERR "hfs: found bad thread record in catalog\n");
return -EIO;
}
......
......@@ -84,7 +84,7 @@ static struct dentry *hfsplus_lookup(struct inode *dir, struct dentry *dentry,
} else if (!dentry->d_fsdata)
dentry->d_fsdata = (void *)(unsigned long)cnid;
} else {
printk("HFS+-fs: Illegal catalog entry type in lookup\n");
printk(KERN_ERR "hfs: invalid catalog entry type in lookup\n");
err = -EIO;
goto fail;
}
......@@ -132,12 +132,12 @@ static int hfsplus_readdir(struct file *filp, void *dirent, filldir_t filldir)
case 1:
hfs_bnode_read(fd.bnode, &entry, fd.entryoffset, fd.entrylength);
if (be16_to_cpu(entry.type) != HFSPLUS_FOLDER_THREAD) {
printk("HFS+-fs: bad catalog folder thread\n");
printk(KERN_ERR "hfs: bad catalog folder thread\n");
err = -EIO;
goto out;
}
if (fd.entrylength < HFSPLUS_MIN_THREAD_SZ) {
printk("HFS+-fs: truncated catalog thread\n");
printk(KERN_ERR "hfs: truncated catalog thread\n");
err = -EIO;
goto out;
}
......@@ -156,7 +156,7 @@ static int hfsplus_readdir(struct file *filp, void *dirent, filldir_t filldir)
for (;;) {
if (be32_to_cpu(fd.key->cat.parent) != inode->i_ino) {
printk("HFS+-fs: walked past end of dir\n");
printk(KERN_ERR "hfs: walked past end of dir\n");
err = -EIO;
goto out;
}
......@@ -168,7 +168,7 @@ static int hfsplus_readdir(struct file *filp, void *dirent, filldir_t filldir)
goto out;
if (type == HFSPLUS_FOLDER) {
if (fd.entrylength < sizeof(struct hfsplus_cat_folder)) {
printk("HFS+-fs: small dir entry\n");
printk(KERN_ERR "hfs: small dir entry\n");
err = -EIO;
goto out;
}
......@@ -180,7 +180,7 @@ static int hfsplus_readdir(struct file *filp, void *dirent, filldir_t filldir)
break;
} else if (type == HFSPLUS_FILE) {
if (fd.entrylength < sizeof(struct hfsplus_cat_file)) {
printk("HFS+-fs: small file entry\n");
printk(KERN_ERR "hfs: small file entry\n");
err = -EIO;
goto out;
}
......@@ -188,7 +188,7 @@ static int hfsplus_readdir(struct file *filp, void *dirent, filldir_t filldir)
be32_to_cpu(entry.file.id), DT_REG))
break;
} else {
printk("HFS+-fs: bad catalog entry type\n");
printk(KERN_ERR "hfs: bad catalog entry type\n");
err = -EIO;
goto out;
}
......
......@@ -349,10 +349,9 @@ int hfsplus_file_extend(struct inode *inode)
if (HFSPLUS_SB(sb).alloc_file->i_size * 8 < HFSPLUS_SB(sb).total_blocks - HFSPLUS_SB(sb).free_blocks + 8) {
// extend alloc file
printk("extend alloc file! (%Lu,%u,%u)\n", HFSPLUS_SB(sb).alloc_file->i_size * 8,
printk(KERN_ERR "hfs: extend alloc file! (%Lu,%u,%u)\n", HFSPLUS_SB(sb).alloc_file->i_size * 8,
HFSPLUS_SB(sb).total_blocks, HFSPLUS_SB(sb).free_blocks);
return -ENOSPC;
//BUG();
}
down(&HFSPLUS_I(inode).extents_lock);
......
......@@ -18,13 +18,11 @@
static int hfsplus_readpage(struct file *file, struct page *page)
{
//printk("readpage: %lu\n", page->index);
return block_read_full_page(page, hfsplus_get_block);
}
static int hfsplus_writepage(struct page *page, struct writeback_control *wbc)
{
//printk("writepage: %lu\n", page->index);
return block_write_full_page(page, hfsplus_get_block, wbc);
}
......@@ -92,7 +90,6 @@ static int hfsplus_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;
}
......@@ -467,7 +464,7 @@ int hfsplus_cat_read_inode(struct inode *inode, struct hfs_find_data *fd)
inode->i_mtime = hfsp_mt2ut(file->content_mod_date);
inode->i_ctime = inode->i_mtime;
} else {
printk("HFS+-fs: bad catalog entry used to create inode\n");
printk(KERN_ERR "hfs: bad catalog entry used to create inode\n");
res = -EIO;
}
return res;
......
......@@ -83,58 +83,58 @@ int hfsplus_parse_options(char *input, struct hfsplus_sb_info *sbi)
switch (token) {
case opt_creator:
if (match_fourchar(&args[0], &sbi->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;
case opt_type:
if (match_fourchar(&args[0], &sbi->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_umask:
if (match_octal(&args[0], &tmp)) {
printk("HFS+-fs: umask requires a value\n");
printk(KERN_ERR "hfs: umask requires a value\n");
return 0;
}
sbi->umask = (umode_t)tmp;
break;
case opt_uid:
if (match_int(&args[0], &tmp)) {
printk("HFS+-fs: uid requires an argument\n");
printk(KERN_ERR "hfs: uid requires an argument\n");
return 0;
}
sbi->uid = (uid_t)tmp;
break;
case opt_gid:
if (match_int(&args[0], &tmp)) {
printk("HFS+-fs: gid requires an argument\n");
printk(KERN_ERR "hfs: gid requires an argument\n");
return 0;
}
sbi->gid = (gid_t)tmp;
break;
case opt_part:
if (match_int(&args[0], &sbi->part)) {
printk("HFS+-fs: 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], &sbi->session)) {
printk("HFS+-fs: session requires an argument\n");
printk(KERN_ERR "hfs: session requires an argument\n");
return 0;
}
break;
case opt_nls:
if (sbi->nls) {
printk("HFS+-fs: unable to change nls mapping\n");
printk(KERN_ERR "hfs: unable to change nls mapping\n");
return 0;
}
p = match_strdup(&args[0]);
sbi->nls = load_nls(p);
if (!sbi->nls) {
printk("HFS+-fs: unable to load nls mapping \"%s\"\n", p);
printk(KERN_ERR "hfs: unable to load nls mapping \"%s\"\n", p);
kfree(p);
return 0;
}
......
......@@ -169,7 +169,7 @@ static void hfsplus_write_super(struct super_block *sb)
block = HFSPLUS_SB(sb).blockoffset;
block += (HFSPLUS_SB(sb).sect_count - 2) >> (sb->s_blocksize_bits - 9);
offset = ((HFSPLUS_SB(sb).sect_count - 2) << 9) & (sb->s_blocksize - 1);
printk("backup: %u,%u,%u,%u\n", HFSPLUS_SB(sb).blockoffset,
printk(KERN_DEBUG "hfs: backup: %u,%u,%u,%u\n", HFSPLUS_SB(sb).blockoffset,
HFSPLUS_SB(sb).sect_count, block, offset);
bh = sb_bread(sb, block);
if (bh) {
......@@ -179,7 +179,7 @@ static void hfsplus_write_super(struct super_block *sb)
mark_buffer_dirty(bh);
brelse(bh);
} else
printk("backup not found!\n");
printk(KERN_WARNING "hfs: backup not found!\n");
}
}
HFSPLUS_SB(sb).flags &= ~HFSPLUS_SB_WRITEBACKUP;
......@@ -240,18 +240,18 @@ static int hfsplus_remount(struct super_block *sb, int *flags, char *data)
return -EINVAL;
if (!(vhdr->attributes & cpu_to_be32(HFSPLUS_VOL_UNMNT))) {
printk("HFS+-fs warning: Filesystem was not cleanly unmounted, "
printk(KERN_WARNING "hfs: filesystem was not cleanly unmounted, "
"running fsck.hfsplus is recommended. leaving read-only.\n");
sb->s_flags |= MS_RDONLY;
*flags |= MS_RDONLY;
} else if (sbi.flags & HFSPLUS_SB_FORCE) {
/* nothing */
} else if (vhdr->attributes & cpu_to_be32(HFSPLUS_VOL_SOFTLOCK)) {
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;
} else if (vhdr->attributes & cpu_to_be32(HFSPLUS_VOL_JOURNALED)) {
printk("HFS+-fs: Filesystem is marked journaled, leaving read-only.\n");
printk(KERN_WARNING "hfs: filesystem is marked journaled, leaving read-only.\n");
sb->s_flags |= MS_RDONLY;
*flags |= MS_RDONLY;
}
......@@ -292,8 +292,7 @@ static int hfsplus_fill_super(struct super_block *sb, void *data, int silent)
INIT_HLIST_HEAD(&sbi->rsrc_inodes);
hfsplus_fill_defaults(sbi);
if (!hfsplus_parse_options(data, sbi)) {
if (!silent)
printk("HFS+-fs: unable to parse mount options\n");
printk(KERN_ERR "hfs: unable to parse mount options\n");
err = -EINVAL;
goto cleanup;
}
......@@ -302,7 +301,7 @@ static int hfsplus_fill_super(struct super_block *sb, void *data, int silent)
nls = sbi->nls;
sbi->nls = load_nls("utf8");
if (!sbi->nls) {
printk("HFS+: unable to load nls for utf8\n");
printk(KERN_ERR "hfs: unable to load nls for utf8\n");
err = -EINVAL;
goto cleanup;
}
......@@ -310,7 +309,7 @@ static int hfsplus_fill_super(struct super_block *sb, void *data, int silent)
/* Grab the volume header */
if (hfsplus_read_wrapper(sb)) {
if (!silent)
printk("HFS+-fs: unable to find HFS+ superblock\n");
printk(KERN_WARNING "hfs: unable to find HFS+ superblock\n");
err = -EINVAL;
goto cleanup;
}
......@@ -319,8 +318,7 @@ static int hfsplus_fill_super(struct super_block *sb, void *data, int silent)
/* Copy parts of the volume header into the superblock */
sb->s_magic = be16_to_cpu(vhdr->signature);
if (be16_to_cpu(vhdr->version) != HFSPLUS_CURRENT_VERSION) {
if (!silent)
printk("HFS+-fs: wrong filesystem version\n");
printk(KERN_ERR "hfs: wrong filesystem version\n");
goto cleanup;
}
HFSPLUS_SB(sb).total_blocks = be32_to_cpu(vhdr->total_blocks);
......@@ -341,20 +339,17 @@ static int hfsplus_fill_super(struct super_block *sb, void *data, int silent)
sb->s_maxbytes = MAX_LFS_FILESIZE;
if (!(vhdr->attributes & cpu_to_be32(HFSPLUS_VOL_UNMNT))) {
if (!silent)
printk("HFS+-fs warning: Filesystem was not cleanly unmounted, "
"running fsck.hfsplus is recommended. mounting read-only.\n");
printk(KERN_WARNING "hfs: Filesystem was not cleanly unmounted, "
"running fsck.hfsplus is recommended. mounting read-only.\n");
sb->s_flags |= MS_RDONLY;
} else if (sbi->flags & HFSPLUS_SB_FORCE) {
/* nothing */
} else if (vhdr->attributes & cpu_to_be32(HFSPLUS_VOL_SOFTLOCK)) {
if (!silent)
printk("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;
} else if (vhdr->attributes & cpu_to_be32(HFSPLUS_VOL_JOURNALED)) {
if (!silent)
printk("HFS+-fs: write access to a jounaled filesystem is not supported, "
"use the force option at your own risk, mounting read-only.\n");
printk(KERN_WARNING "hfs: write access to a jounaled filesystem is not supported, "
"use the force option at your own risk, mounting read-only.\n");
sb->s_flags |= MS_RDONLY;
}
sbi->flags &= ~HFSPLUS_SB_FORCE;
......@@ -362,21 +357,18 @@ static int hfsplus_fill_super(struct super_block *sb, void *data, int silent)
/* Load metadata objects (B*Trees) */
HFSPLUS_SB(sb).ext_tree = hfs_btree_open(sb, HFSPLUS_EXT_CNID);
if (!HFSPLUS_SB(sb).ext_tree) {
if (!silent)
printk("HFS+-fs: failed to load extents file\n");
printk(KERN_ERR "hfs: failed to load extents file\n");
goto cleanup;
}
HFSPLUS_SB(sb).cat_tree = hfs_btree_open(sb, HFSPLUS_CAT_CNID);
if (!HFSPLUS_SB(sb).cat_tree) {
if (!silent)
printk("HFS+-fs: failed to load catalog file\n");
printk(KERN_ERR "hfs: failed to load catalog file\n");
goto cleanup;
}
HFSPLUS_SB(sb).alloc_file = iget(sb, HFSPLUS_ALLOC_CNID);
if (!HFSPLUS_SB(sb).alloc_file) {
if (!silent)
printk("HFS+-fs: failed to load allocation file\n");
printk(KERN_ERR "hfs: failed to load allocation file\n");
goto cleanup;
}
......@@ -384,8 +376,7 @@ static int hfsplus_fill_super(struct super_block *sb, void *data, int silent)
root = iget(sb, HFSPLUS_ROOT_CNID);
sb->s_root = d_alloc_root(root);
if (!sb->s_root) {
if (!silent)
printk("HFS+-fs: failed to load root directory\n");
printk(KERN_ERR "hfs: failed to load root directory\n");
iput(root);
goto cleanup;
}
......@@ -419,7 +410,7 @@ static int hfsplus_fill_super(struct super_block *sb, void *data, int silent)
sync_dirty_buffer(HFSPLUS_SB(sb).s_vhbh);
if (!HFSPLUS_SB(sb).hidden_dir) {
printk("HFS+: create hidden dir...\n");
printk(KERN_DEBUG "hfs: create hidden dir...\n");
HFSPLUS_SB(sb).hidden_dir = hfsplus_new_inode(sb, S_IFDIR);
hfsplus_create_cat(HFSPLUS_SB(sb).hidden_dir->i_ino, sb->s_root->d_inode,
&str, HFSPLUS_SB(sb).hidden_dir);
......@@ -499,7 +490,7 @@ static void __exit exit_hfsplus_fs(void)
{
unregister_filesystem(&hfsplus_fs_type);
if (kmem_cache_destroy(hfsplus_inode_cachep))
printk(KERN_INFO "hfsplus_inode_cache: not all structures were freed\n");
printk(KERN_ERR "hfsplus_inode_cache: not all structures were freed\n");
}
module_init(init_hfsplus_fs)
......
......@@ -70,7 +70,7 @@ static int hfsplus_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;
......@@ -143,7 +143,7 @@ int hfsplus_read_wrapper(struct super_block *sb)
blocksize >>= 1;
if (sb_set_blocksize(sb, blocksize) != blocksize) {
printk("HFS+: unable to blocksize to %u!\n", blocksize);
printk(KERN_ERR "hfs: unable to set blocksize to %u!\n", blocksize);
return -EINVAL;
}
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册