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.

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 634725a commit 7cf3cc3
Show file tree
Hide file tree
Showing 10 changed files with 48 additions and 53 deletions.
3 changes: 1 addition & 2 deletions fs/hfs/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: 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
6 changes: 3 additions & 3 deletions fs/hfs/bnode.c
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand All @@ -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;
}

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

Expand Down
2 changes: 1 addition & 1 deletion fs/hfs/brec.c
Original file line number Diff line number Diff line change
Expand Up @@ -362,7 +362,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
10 changes: 5 additions & 5 deletions fs/hfs/btree.c
Original file line number Diff line number Diff line change
Expand Up @@ -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--;
Expand Down Expand Up @@ -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);
Expand Down Expand Up @@ -292,15 +292,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 @@ -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;
Expand Down
2 changes: 1 addition & 1 deletion fs/hfs/catalog.c
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}

Expand Down
12 changes: 6 additions & 6 deletions fs/hfs/dir.c
Original file line number Diff line number Diff line change
Expand Up @@ -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;
//}
Expand All @@ -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;
}
Expand All @@ -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;
}
Expand All @@ -123,15 +123,15 @@ 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;
}
if (filldir(dirent, strbuf, len, filp->f_pos,
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;
}
Expand Down
3 changes: 0 additions & 3 deletions fs/hfs/hfs_fs.h
Original file line number Diff line number Diff line change
Expand Up @@ -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
*
Expand Down
1 change: 0 additions & 1 deletion fs/hfs/inode.c
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}

Expand Down
22 changes: 11 additions & 11 deletions fs/hfs/mdb.c
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -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;
}

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

Expand Down Expand Up @@ -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);
Expand All @@ -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);
Expand All @@ -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)) {
Expand Down Expand Up @@ -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);
Expand Down
Loading

0 comments on commit 7cf3cc3

Please sign in to comment.