Skip to content

Commit

Permalink
[PATCH] hfs: cleanup HFS+ prints
Browse files Browse the repository at this point in the history
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: Roman Zippel <[email protected]>
Signed-off-by: Andrew Morton <[email protected]>
Signed-off-by: Linus Torvalds <[email protected]>
  • Loading branch information
Roman Zippel authored and Linus Torvalds committed Jan 19, 2006
1 parent 5131cf1 commit 634725a
Show file tree
Hide file tree
Showing 11 changed files with 55 additions and 72 deletions.
3 changes: 1 addition & 2 deletions fs/hfsplus/bfind.c
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down Expand Up @@ -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:
Expand Down
11 changes: 6 additions & 5 deletions fs/hfsplus/bnode.c
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand All @@ -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;
}

Expand All @@ -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;
}

Expand Down Expand Up @@ -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)
Expand Down
2 changes: 1 addition & 1 deletion fs/hfsplus/brec.c
Original file line number Diff line number Diff line change
Expand Up @@ -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))
Expand Down
16 changes: 6 additions & 10 deletions fs/hfsplus/btree.c
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down Expand Up @@ -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--;
Expand Down Expand Up @@ -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);
}
}
Expand All @@ -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);
Expand Down Expand Up @@ -284,15 +280,15 @@ 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);
if (IS_ERR(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;
}
Expand All @@ -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;
Expand Down
2 changes: 1 addition & 1 deletion fs/hfsplus/catalog.c
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}

Expand Down
14 changes: 7 additions & 7 deletions fs/hfsplus/dir.c
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}
Expand Down Expand Up @@ -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;
}
Expand All @@ -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;
}
Expand All @@ -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;
}
Expand All @@ -180,15 +180,15 @@ 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;
}
if (filldir(dirent, strbuf, len, filp->f_pos,
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;
}
Expand Down
3 changes: 1 addition & 2 deletions fs/hfsplus/extents.c
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down
5 changes: 1 addition & 4 deletions fs/hfsplus/inode.c
Original file line number Diff line number Diff line change
Expand Up @@ -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);
}

Expand Down Expand Up @@ -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;
}

Expand Down Expand Up @@ -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;
Expand Down
18 changes: 9 additions & 9 deletions fs/hfsplus/options.c
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}
Expand Down
Loading

0 comments on commit 634725a

Please sign in to comment.