Skip to content

Commit 634725a

Browse files
Roman ZippelLinus Torvalds
authored andcommitted
[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: Roman Zippel <zippel@linux-m68k.org> Signed-off-by: Andrew Morton <akpm@osdl.org> Signed-off-by: Linus Torvalds <torvalds@osdl.org>
1 parent 5131cf1 commit 634725a

11 files changed

Lines changed: 55 additions & 72 deletions

File tree

‎fs/hfsplus/bfind.c‎

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -64,7 +64,6 @@ int __hfs_brec_find(struct hfs_bnode *bnode, struct hfs_find_data *fd)
6464
else
6565
e = rec - 1;
6666
} while (b <= e);
67-
//printk("%d: %d,%d,%d\n", bnode->this, b, e, rec);
6867
if (rec != e && e >= 0) {
6968
len = hfs_brec_lenoff(bnode, e, &off);
7069
keylen = hfs_brec_keylen(bnode, e);
@@ -127,7 +126,7 @@ int hfs_brec_find(struct hfs_find_data *fd)
127126
return res;
128127

129128
invalid:
130-
printk("HFS+-fs: inconsistency in B*Tree (%d,%d,%d,%u,%u)\n",
129+
printk(KERN_ERR "hfs: inconsistency in B*Tree (%d,%d,%d,%u,%u)\n",
131130
height, bnode->height, bnode->type, nidx, parent);
132131
res = -EIO;
133132
release:

‎fs/hfsplus/bnode.c‎

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -358,7 +358,7 @@ void hfs_bnode_unlink(struct hfs_bnode *node)
358358

359359
// move down?
360360
if (!node->prev && !node->next) {
361-
printk("hfs_btree_del_level\n");
361+
printk(KERN_DEBUG "hfs_btree_del_level\n");
362362
}
363363
if (!node->parent) {
364364
tree->root = 0;
@@ -379,7 +379,7 @@ struct hfs_bnode *hfs_bnode_findhash(struct hfs_btree *tree, u32 cnid)
379379
struct hfs_bnode *node;
380380

381381
if (cnid >= tree->node_count) {
382-
printk("HFS+-fs: request for non-existent node %d in B*Tree\n", cnid);
382+
printk(KERN_ERR "hfs: request for non-existent node %d in B*Tree\n", cnid);
383383
return NULL;
384384
}
385385

@@ -402,7 +402,7 @@ static struct hfs_bnode *__hfs_bnode_create(struct hfs_btree *tree, u32 cnid)
402402
loff_t off;
403403

404404
if (cnid >= tree->node_count) {
405-
printk("HFS+-fs: request for non-existent node %d in B*Tree\n", cnid);
405+
printk(KERN_ERR "hfs: request for non-existent node %d in B*Tree\n", cnid);
406406
return NULL;
407407
}
408408

@@ -576,8 +576,9 @@ struct hfs_bnode *hfs_bnode_create(struct hfs_btree *tree, u32 num)
576576
node = hfs_bnode_findhash(tree, num);
577577
spin_unlock(&tree->hash_lock);
578578
if (node) {
579-
printk("new node %u already hashed?\n", num);
580-
BUG();
579+
printk(KERN_CRIT "new node %u already hashed?\n", num);
580+
WARN_ON(1);
581+
return node;
581582
}
582583
node = __hfs_bnode_create(tree, num);
583584
if (!node)

‎fs/hfsplus/brec.c‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -360,7 +360,7 @@ static int hfs_brec_update_parent(struct hfs_find_data *fd)
360360
end_off = hfs_bnode_read_u16(parent, end_rec_off);
361361
if (end_rec_off - end_off < diff) {
362362

363-
printk("splitting index node...\n");
363+
printk(KERN_DEBUG "hfs: splitting index node...\n");
364364
fd->bnode = parent;
365365
new_node = hfs_bnode_split(fd);
366366
if (IS_ERR(new_node))

‎fs/hfsplus/btree.c‎

Lines changed: 6 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@ struct hfs_btree *hfs_btree_open(struct super_block *sb, u32 id)
3939
} else if (id == HFSPLUS_CAT_CNID) {
4040
tree->keycmp = hfsplus_cat_cmp_key;
4141
} else {
42-
printk("HFS+-fs: unknown B*Tree requested\n");
42+
printk(KERN_ERR "hfs: unknown B*Tree requested\n");
4343
goto free_tree;
4444
}
4545
tree->inode = iget(sb, id);
@@ -99,7 +99,7 @@ void hfs_btree_close(struct hfs_btree *tree)
9999
while ((node = tree->node_hash[i])) {
100100
tree->node_hash[i] = node->next_hash;
101101
if (atomic_read(&node->refcnt))
102-
printk("HFS+: node %d:%d still has %d user(s)!\n",
102+
printk(KERN_CRIT "hfs: node %d:%d still has %d user(s)!\n",
103103
node->tree->cnid, node->this, atomic_read(&node->refcnt));
104104
hfs_bnode_free(node);
105105
tree->node_hash_cnt--;
@@ -223,10 +223,6 @@ struct hfs_bnode *hfs_bmap_alloc(struct hfs_btree *tree)
223223
tree->free_nodes--;
224224
mark_inode_dirty(tree->inode);
225225
hfs_bnode_put(node);
226-
if (!idx) {
227-
printk("unexpected idx %u (%u)\n", idx, node->this);
228-
BUG();
229-
}
230226
return hfs_bnode_create(tree, idx);
231227
}
232228
}
@@ -242,7 +238,7 @@ struct hfs_bnode *hfs_bmap_alloc(struct hfs_btree *tree)
242238
kunmap(*pagep);
243239
nidx = node->next;
244240
if (!nidx) {
245-
printk("create new bmap node...\n");
241+
printk(KERN_DEBUG "hfs: create new bmap node...\n");
246242
next_node = hfs_bmap_new_bmap(node, idx);
247243
} else
248244
next_node = hfs_bnode_find(tree, nidx);
@@ -284,15 +280,15 @@ void hfs_bmap_free(struct hfs_bnode *node)
284280
hfs_bnode_put(node);
285281
if (!i) {
286282
/* panic */;
287-
printk("HFS: unable to free bnode %u. bmap not found!\n", node->this);
283+
printk(KERN_CRIT "hfs: unable to free bnode %u. bmap not found!\n", node->this);
288284
return;
289285
}
290286
node = hfs_bnode_find(tree, i);
291287
if (IS_ERR(node))
292288
return;
293289
if (node->type != HFS_NODE_MAP) {
294290
/* panic */;
295-
printk("HFS: invalid bmap found! (%u,%d)\n", node->this, node->type);
291+
printk(KERN_CRIT "hfs: invalid bmap found! (%u,%d)\n", node->this, node->type);
296292
hfs_bnode_put(node);
297293
return;
298294
}
@@ -305,7 +301,7 @@ void hfs_bmap_free(struct hfs_bnode *node)
305301
m = 1 << (~nidx & 7);
306302
byte = data[off];
307303
if (!(byte & m)) {
308-
printk("HFS: trying to free free bnode %u(%d)\n", node->this, node->type);
304+
printk(KERN_CRIT "hfs: trying to free free bnode %u(%d)\n", node->this, node->type);
309305
kunmap(page);
310306
hfs_bnode_put(node);
311307
return;

‎fs/hfsplus/catalog.c‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -139,7 +139,7 @@ int hfsplus_find_cat(struct super_block *sb, u32 cnid,
139139

140140
type = be16_to_cpu(tmp.type);
141141
if (type != HFSPLUS_FOLDER_THREAD && type != HFSPLUS_FILE_THREAD) {
142-
printk("HFS+-fs: Found bad thread record in catalog\n");
142+
printk(KERN_ERR "hfs: found bad thread record in catalog\n");
143143
return -EIO;
144144
}
145145

‎fs/hfsplus/dir.c‎

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -84,7 +84,7 @@ static struct dentry *hfsplus_lookup(struct inode *dir, struct dentry *dentry,
8484
} else if (!dentry->d_fsdata)
8585
dentry->d_fsdata = (void *)(unsigned long)cnid;
8686
} else {
87-
printk("HFS+-fs: Illegal catalog entry type in lookup\n");
87+
printk(KERN_ERR "hfs: invalid catalog entry type in lookup\n");
8888
err = -EIO;
8989
goto fail;
9090
}
@@ -132,12 +132,12 @@ static int hfsplus_readdir(struct file *filp, void *dirent, filldir_t filldir)
132132
case 1:
133133
hfs_bnode_read(fd.bnode, &entry, fd.entryoffset, fd.entrylength);
134134
if (be16_to_cpu(entry.type) != HFSPLUS_FOLDER_THREAD) {
135-
printk("HFS+-fs: bad catalog folder thread\n");
135+
printk(KERN_ERR "hfs: bad catalog folder thread\n");
136136
err = -EIO;
137137
goto out;
138138
}
139139
if (fd.entrylength < HFSPLUS_MIN_THREAD_SZ) {
140-
printk("HFS+-fs: truncated catalog thread\n");
140+
printk(KERN_ERR "hfs: truncated catalog thread\n");
141141
err = -EIO;
142142
goto out;
143143
}
@@ -156,7 +156,7 @@ static int hfsplus_readdir(struct file *filp, void *dirent, filldir_t filldir)
156156

157157
for (;;) {
158158
if (be32_to_cpu(fd.key->cat.parent) != inode->i_ino) {
159-
printk("HFS+-fs: walked past end of dir\n");
159+
printk(KERN_ERR "hfs: walked past end of dir\n");
160160
err = -EIO;
161161
goto out;
162162
}
@@ -168,7 +168,7 @@ static int hfsplus_readdir(struct file *filp, void *dirent, filldir_t filldir)
168168
goto out;
169169
if (type == HFSPLUS_FOLDER) {
170170
if (fd.entrylength < sizeof(struct hfsplus_cat_folder)) {
171-
printk("HFS+-fs: small dir entry\n");
171+
printk(KERN_ERR "hfs: small dir entry\n");
172172
err = -EIO;
173173
goto out;
174174
}
@@ -180,15 +180,15 @@ static int hfsplus_readdir(struct file *filp, void *dirent, filldir_t filldir)
180180
break;
181181
} else if (type == HFSPLUS_FILE) {
182182
if (fd.entrylength < sizeof(struct hfsplus_cat_file)) {
183-
printk("HFS+-fs: small file entry\n");
183+
printk(KERN_ERR "hfs: small file entry\n");
184184
err = -EIO;
185185
goto out;
186186
}
187187
if (filldir(dirent, strbuf, len, filp->f_pos,
188188
be32_to_cpu(entry.file.id), DT_REG))
189189
break;
190190
} else {
191-
printk("HFS+-fs: bad catalog entry type\n");
191+
printk(KERN_ERR "hfs: bad catalog entry type\n");
192192
err = -EIO;
193193
goto out;
194194
}

‎fs/hfsplus/extents.c‎

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -349,10 +349,9 @@ int hfsplus_file_extend(struct inode *inode)
349349

350350
if (HFSPLUS_SB(sb).alloc_file->i_size * 8 < HFSPLUS_SB(sb).total_blocks - HFSPLUS_SB(sb).free_blocks + 8) {
351351
// extend alloc file
352-
printk("extend alloc file! (%Lu,%u,%u)\n", HFSPLUS_SB(sb).alloc_file->i_size * 8,
352+
printk(KERN_ERR "hfs: extend alloc file! (%Lu,%u,%u)\n", HFSPLUS_SB(sb).alloc_file->i_size * 8,
353353
HFSPLUS_SB(sb).total_blocks, HFSPLUS_SB(sb).free_blocks);
354354
return -ENOSPC;
355-
//BUG();
356355
}
357356

358357
down(&HFSPLUS_I(inode).extents_lock);

‎fs/hfsplus/inode.c‎

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -18,13 +18,11 @@
1818

1919
static int hfsplus_readpage(struct file *file, struct page *page)
2020
{
21-
//printk("readpage: %lu\n", page->index);
2221
return block_read_full_page(page, hfsplus_get_block);
2322
}
2423

2524
static int hfsplus_writepage(struct page *page, struct writeback_control *wbc)
2625
{
27-
//printk("writepage: %lu\n", page->index);
2826
return block_write_full_page(page, hfsplus_get_block, wbc);
2927
}
3028

@@ -92,7 +90,6 @@ static int hfsplus_releasepage(struct page *page, gfp_t mask)
9290
} while (--i && nidx < tree->node_count);
9391
spin_unlock(&tree->hash_lock);
9492
}
95-
//printk("releasepage: %lu,%x = %d\n", page->index, mask, res);
9693
return res ? try_to_free_buffers(page) : 0;
9794
}
9895

@@ -467,7 +464,7 @@ int hfsplus_cat_read_inode(struct inode *inode, struct hfs_find_data *fd)
467464
inode->i_mtime = hfsp_mt2ut(file->content_mod_date);
468465
inode->i_ctime = inode->i_mtime;
469466
} else {
470-
printk("HFS+-fs: bad catalog entry used to create inode\n");
467+
printk(KERN_ERR "hfs: bad catalog entry used to create inode\n");
471468
res = -EIO;
472469
}
473470
return res;

‎fs/hfsplus/options.c‎

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -83,58 +83,58 @@ int hfsplus_parse_options(char *input, struct hfsplus_sb_info *sbi)
8383
switch (token) {
8484
case opt_creator:
8585
if (match_fourchar(&args[0], &sbi->creator)) {
86-
printk("HFS+-fs: creator requires a 4 character value\n");
86+
printk(KERN_ERR "hfs: creator requires a 4 character value\n");
8787
return 0;
8888
}
8989
break;
9090
case opt_type:
9191
if (match_fourchar(&args[0], &sbi->type)) {
92-
printk("HFS+-fs: type requires a 4 character value\n");
92+
printk(KERN_ERR "hfs: type requires a 4 character value\n");
9393
return 0;
9494
}
9595
break;
9696
case opt_umask:
9797
if (match_octal(&args[0], &tmp)) {
98-
printk("HFS+-fs: umask requires a value\n");
98+
printk(KERN_ERR "hfs: umask requires a value\n");
9999
return 0;
100100
}
101101
sbi->umask = (umode_t)tmp;
102102
break;
103103
case opt_uid:
104104
if (match_int(&args[0], &tmp)) {
105-
printk("HFS+-fs: uid requires an argument\n");
105+
printk(KERN_ERR "hfs: uid requires an argument\n");
106106
return 0;
107107
}
108108
sbi->uid = (uid_t)tmp;
109109
break;
110110
case opt_gid:
111111
if (match_int(&args[0], &tmp)) {
112-
printk("HFS+-fs: gid requires an argument\n");
112+
printk(KERN_ERR "hfs: gid requires an argument\n");
113113
return 0;
114114
}
115115
sbi->gid = (gid_t)tmp;
116116
break;
117117
case opt_part:
118118
if (match_int(&args[0], &sbi->part)) {
119-
printk("HFS+-fs: part requires an argument\n");
119+
printk(KERN_ERR "hfs: part requires an argument\n");
120120
return 0;
121121
}
122122
break;
123123
case opt_session:
124124
if (match_int(&args[0], &sbi->session)) {
125-
printk("HFS+-fs: session requires an argument\n");
125+
printk(KERN_ERR "hfs: session requires an argument\n");
126126
return 0;
127127
}
128128
break;
129129
case opt_nls:
130130
if (sbi->nls) {
131-
printk("HFS+-fs: unable to change nls mapping\n");
131+
printk(KERN_ERR "hfs: unable to change nls mapping\n");
132132
return 0;
133133
}
134134
p = match_strdup(&args[0]);
135135
sbi->nls = load_nls(p);
136136
if (!sbi->nls) {
137-
printk("HFS+-fs: unable to load nls mapping \"%s\"\n", p);
137+
printk(KERN_ERR "hfs: unable to load nls mapping \"%s\"\n", p);
138138
kfree(p);
139139
return 0;
140140
}

0 commit comments

Comments
 (0)