Skip to content

Commit b7cb1ce

Browse files
Fabian Fredericktorvalds
authored andcommitted
fs/hpfs: convert printk to pr_foo()
No level printk in hptfs_error converted to pr_err (others to pr_warn or pr_info) This patch also fixes if/then/else checkpatch warnings Signed-off-by: Fabian Frederick <fabf@skynet.be> Cc: Mikulas Patocka <mikulas@artax.karlin.mff.cuni.cz> Signed-off-by: Andrew Morton <akpm@linux-foundation.org> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
1 parent 45641c8 commit b7cb1ce

10 files changed

Lines changed: 89 additions & 67 deletions

File tree

‎fs/hpfs/alloc.c‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -316,7 +316,7 @@ void hpfs_free_sectors(struct super_block *s, secno sec, unsigned n)
316316
struct quad_buffer_head qbh;
317317
__le32 *bmp;
318318
struct hpfs_sb_info *sbi = hpfs_sb(s);
319-
/*printk("2 - ");*/
319+
/*pr_info("2 - ");*/
320320
if (!n) return;
321321
if (sec < 0x12) {
322322
hpfs_error(s, "Trying to free reserved sector %08x", sec);

‎fs/hpfs/buffer.c‎

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,7 @@ void *hpfs_map_sector(struct super_block *s, unsigned secno, struct buffer_head
5555
if (bh != NULL)
5656
return bh->b_data;
5757
else {
58-
printk("HPFS: hpfs_map_sector: read error\n");
58+
pr_warn("HPFS: hpfs_map_sector: read error\n");
5959
return NULL;
6060
}
6161
}
@@ -76,7 +76,7 @@ void *hpfs_get_sector(struct super_block *s, unsigned secno, struct buffer_head
7676
set_buffer_uptodate(bh);
7777
return bh->b_data;
7878
} else {
79-
printk("HPFS: hpfs_get_sector: getblk failed\n");
79+
pr_warn("HPFS: hpfs_get_sector: getblk failed\n");
8080
return NULL;
8181
}
8282
}
@@ -93,7 +93,7 @@ void *hpfs_map_4sectors(struct super_block *s, unsigned secno, struct quad_buffe
9393
cond_resched();
9494

9595
if (secno & 3) {
96-
printk("HPFS: hpfs_map_4sectors: unaligned read\n");
96+
pr_warn("HPFS: hpfs_map_4sectors: unaligned read\n");
9797
return NULL;
9898
}
9999

@@ -112,7 +112,7 @@ void *hpfs_map_4sectors(struct super_block *s, unsigned secno, struct quad_buffe
112112

113113
qbh->data = data = kmalloc(2048, GFP_NOFS);
114114
if (!data) {
115-
printk("HPFS: hpfs_map_4sectors: out of memory\n");
115+
pr_warn("HPFS: hpfs_map_4sectors: out of memory\n");
116116
goto bail4;
117117
}
118118

@@ -145,7 +145,7 @@ void *hpfs_get_4sectors(struct super_block *s, unsigned secno,
145145
hpfs_lock_assert(s);
146146

147147
if (secno & 3) {
148-
printk("HPFS: hpfs_get_4sectors: unaligned read\n");
148+
pr_warn("HPFS: hpfs_get_4sectors: unaligned read\n");
149149
return NULL;
150150
}
151151

@@ -161,7 +161,7 @@ void *hpfs_get_4sectors(struct super_block *s, unsigned secno,
161161
}
162162

163163
if (!(qbh->data = kmalloc(2048, GFP_NOFS))) {
164-
printk("HPFS: hpfs_get_4sectors: out of memory\n");
164+
pr_warn("HPFS: hpfs_get_4sectors: out of memory\n");
165165
goto bail4;
166166
}
167167
return qbh->data;

‎fs/hpfs/dir.c‎

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@ static loff_t hpfs_dir_lseek(struct file *filp, loff_t off, int whence)
3636
mutex_lock(&i->i_mutex);
3737
hpfs_lock(s);
3838

39-
/*printk("dir lseek\n");*/
39+
/*pr_info("dir lseek\n");*/
4040
if (new_off == 0 || new_off == 1 || new_off == 11 || new_off == 12 || new_off == 13) goto ok;
4141
pos = ((loff_t) hpfs_de_as_down_as_possible(s, hpfs_inode->i_dno) << 4) + 1;
4242
while (pos != new_off) {
@@ -51,7 +51,7 @@ static loff_t hpfs_dir_lseek(struct file *filp, loff_t off, int whence)
5151
mutex_unlock(&i->i_mutex);
5252
return new_off;
5353
fail:
54-
/*printk("illegal lseek: %016llx\n", new_off);*/
54+
/*pr_warn("illegal lseek: %016llx\n", new_off);*/
5555
hpfs_unlock(s);
5656
mutex_unlock(&i->i_mutex);
5757
return -ESPIPE;
@@ -127,7 +127,7 @@ static int hpfs_readdir(struct file *file, struct dir_context *ctx)
127127
if (ctx->pos == 12)
128128
goto out;
129129
if (ctx->pos == 3 || ctx->pos == 4 || ctx->pos == 5) {
130-
printk("HPFS: warning: pos==%d\n",(int)ctx->pos);
130+
pr_warn("HPFS: warning: pos==%d\n", (int)ctx->pos);
131131
goto out;
132132
}
133133
if (ctx->pos == 0) {

‎fs/hpfs/dnode.c‎

Lines changed: 25 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ static loff_t get_pos(struct dnode *d, struct hpfs_dirent *fde)
1717
if (de == fde) return ((loff_t) le32_to_cpu(d->self) << 4) | (loff_t)i;
1818
i++;
1919
}
20-
printk("HPFS: get_pos: not_found\n");
20+
pr_info("HPFS: get_pos: not_found\n");
2121
return ((loff_t)le32_to_cpu(d->self) << 4) | (loff_t)1;
2222
}
2323

@@ -32,7 +32,7 @@ void hpfs_add_pos(struct inode *inode, loff_t *pos)
3232
if (hpfs_inode->i_rddir_off[i] == pos) return;
3333
if (!(i&0x0f)) {
3434
if (!(ppos = kmalloc((i+0x11) * sizeof(loff_t*), GFP_NOFS))) {
35-
printk("HPFS: out of memory for position list\n");
35+
pr_warn("HPFS: out of memory for position list\n");
3636
return;
3737
}
3838
if (hpfs_inode->i_rddir_off) {
@@ -63,7 +63,8 @@ void hpfs_del_pos(struct inode *inode, loff_t *pos)
6363
}
6464
return;
6565
not_f:
66-
/*printk("HPFS: warning: position pointer %p->%08x not found\n", pos, (int)*pos);*/
66+
/*pr_info("HPFS: warning: position pointer %p->%08x not found\n",
67+
pos, (int)*pos);*/
6768
return;
6869
}
6970

@@ -92,17 +93,23 @@ static void hpfs_pos_ins(loff_t *p, loff_t d, loff_t c)
9293
{
9394
if ((*p & ~0x3f) == (d & ~0x3f) && (*p & 0x3f) >= (d & 0x3f)) {
9495
int n = (*p & 0x3f) + c;
95-
if (n > 0x3f) printk("HPFS: hpfs_pos_ins: %08x + %d\n", (int)*p, (int)c >> 8);
96-
else *p = (*p & ~0x3f) | n;
96+
if (n > 0x3f)
97+
pr_warn("HPFS: hpfs_pos_ins: %08x + %d\n",
98+
(int)*p, (int)c >> 8);
99+
else
100+
*p = (*p & ~0x3f) | n;
97101
}
98102
}
99103

100104
static void hpfs_pos_del(loff_t *p, loff_t d, loff_t c)
101105
{
102106
if ((*p & ~0x3f) == (d & ~0x3f) && (*p & 0x3f) >= (d & 0x3f)) {
103107
int n = (*p & 0x3f) - c;
104-
if (n < 1) printk("HPFS: hpfs_pos_ins: %08x - %d\n", (int)*p, (int)c >> 8);
105-
else *p = (*p & ~0x3f) | n;
108+
if (n < 1)
109+
pr_warn("HPFS: hpfs_pos_ins: %08x - %d\n",
110+
(int)*p, (int)c >> 8);
111+
else
112+
*p = (*p & ~0x3f) | n;
106113
}
107114
}
108115

@@ -239,7 +246,7 @@ static int hpfs_add_to_dnode(struct inode *i, dnode_secno dno,
239246
struct fnode *fnode;
240247
int c1, c2 = 0;
241248
if (!(nname = kmalloc(256, GFP_NOFS))) {
242-
printk("HPFS: out of memory, can't add to dnode\n");
249+
pr_warn("HPFS: out of memory, can't add to dnode\n");
243250
return 1;
244251
}
245252
go_up:
@@ -281,7 +288,7 @@ static int hpfs_add_to_dnode(struct inode *i, dnode_secno dno,
281288
not be any error while splitting dnodes, otherwise the
282289
whole directory, not only file we're adding, would
283290
be lost. */
284-
printk("HPFS: out of memory for dnode splitting\n");
291+
pr_warn("HPFS: out of memory for dnode splitting\n");
285292
hpfs_brelse4(&qbh);
286293
kfree(nname);
287294
return 1;
@@ -597,7 +604,7 @@ static void delete_empty_dnode(struct inode *i, dnode_secno dno)
597604
if (!de_next->down) goto endm;
598605
ndown = de_down_pointer(de_next);
599606
if (!(de_cp = kmalloc(le16_to_cpu(de->length), GFP_NOFS))) {
600-
printk("HPFS: out of memory for dtree balancing\n");
607+
pr_warn("HPFS: out of memory for dtree balancing\n");
601608
goto endm;
602609
}
603610
memcpy(de_cp, de, le16_to_cpu(de->length));
@@ -612,7 +619,8 @@ static void delete_empty_dnode(struct inode *i, dnode_secno dno)
612619
hpfs_brelse4(&qbh1);
613620
}
614621
hpfs_add_to_dnode(i, ndown, de_cp->name, de_cp->namelen, de_cp, de_cp->down ? de_down_pointer(de_cp) : 0);
615-
/*printk("UP-TO-DNODE: %08x (ndown = %08x, down = %08x, dno = %08x)\n", up, ndown, down, dno);*/
622+
/*pr_info("UP-TO-DNODE: %08x (ndown = %08x, down = %08x, dno = %08x)\n",
623+
up, ndown, down, dno);*/
616624
dno = up;
617625
kfree(de_cp);
618626
goto try_it_again;
@@ -637,15 +645,15 @@ static void delete_empty_dnode(struct inode *i, dnode_secno dno)
637645
if (!dlp && down) {
638646
if (le32_to_cpu(d1->first_free) > 2044) {
639647
if (hpfs_sb(i->i_sb)->sb_chk >= 2) {
640-
printk("HPFS: warning: unbalanced dnode tree, see hpfs.txt 4 more info\n");
641-
printk("HPFS: warning: terminating balancing operation\n");
648+
pr_warn("HPFS: warning: unbalanced dnode tree, see hpfs.txt 4 more info\n");
649+
pr_warn("HPFS: warning: terminating balancing operation\n");
642650
}
643651
hpfs_brelse4(&qbh1);
644652
goto endm;
645653
}
646654
if (hpfs_sb(i->i_sb)->sb_chk >= 2) {
647-
printk("HPFS: warning: unbalanced dnode tree, see hpfs.txt 4 more info\n");
648-
printk("HPFS: warning: goin'on\n");
655+
pr_warn("HPFS: warning: unbalanced dnode tree, see hpfs.txt 4 more info\n");
656+
pr_warn("HPFS: warning: goin'on\n");
649657
}
650658
le16_add_cpu(&del->length, 4);
651659
del->down = 1;
@@ -659,7 +667,7 @@ static void delete_empty_dnode(struct inode *i, dnode_secno dno)
659667
*(__le32 *) ((void *) del + le16_to_cpu(del->length) - 4) = cpu_to_le32(down);
660668
} else goto endm;
661669
if (!(de_cp = kmalloc(le16_to_cpu(de_prev->length), GFP_NOFS))) {
662-
printk("HPFS: out of memory for dtree balancing\n");
670+
pr_warn("HPFS: out of memory for dtree balancing\n");
663671
hpfs_brelse4(&qbh1);
664672
goto endm;
665673
}
@@ -1000,7 +1008,7 @@ struct hpfs_dirent *map_fnode_dirent(struct super_block *s, fnode_secno fno,
10001008
int d1, d2 = 0;
10011009
name1 = f->name;
10021010
if (!(name2 = kmalloc(256, GFP_NOFS))) {
1003-
printk("HPFS: out of memory, can't map dirent\n");
1011+
pr_warn("HPFS: out of memory, can't map dirent\n");
10041012
return NULL;
10051013
}
10061014
if (f->len <= 15)

‎fs/hpfs/ea.c‎

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,7 @@ static char *get_indirect_ea(struct super_block *s, int ano, secno a, int size)
5151
{
5252
char *ret;
5353
if (!(ret = kmalloc(size + 1, GFP_NOFS))) {
54-
printk("HPFS: out of memory for EA\n");
54+
pr_warn("HPFS: out of memory for EA\n");
5555
return NULL;
5656
}
5757
if (hpfs_ea_read(s, a, ano, 0, size, ret)) {
@@ -139,7 +139,7 @@ char *hpfs_get_ea(struct super_block *s, struct fnode *fnode, char *key, int *si
139139
if (ea_indirect(ea))
140140
return get_indirect_ea(s, ea_in_anode(ea), ea_sec(ea), *size = ea_len(ea));
141141
if (!(ret = kmalloc((*size = ea_valuelen(ea)) + 1, GFP_NOFS))) {
142-
printk("HPFS: out of memory for EA\n");
142+
pr_warn("HPFS: out of memory for EA\n");
143143
return NULL;
144144
}
145145
memcpy(ret, ea_data(ea), ea_valuelen(ea));
@@ -165,7 +165,7 @@ char *hpfs_get_ea(struct super_block *s, struct fnode *fnode, char *key, int *si
165165
if (ea_indirect(ea))
166166
return get_indirect_ea(s, ea_in_anode(ea), ea_sec(ea), *size = ea_len(ea));
167167
if (!(ret = kmalloc((*size = ea_valuelen(ea)) + 1, GFP_NOFS))) {
168-
printk("HPFS: out of memory for EA\n");
168+
pr_warn("HPFS: out of memory for EA\n");
169169
return NULL;
170170
}
171171
if (hpfs_ea_read(s, a, ano, pos + 4 + ea->namelen + 1, ea_valuelen(ea), ret)) {

‎fs/hpfs/inode.c‎

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -183,7 +183,8 @@ void hpfs_write_inode(struct inode *i)
183183
struct inode *parent;
184184
if (i->i_ino == hpfs_sb(i->i_sb)->sb_root) return;
185185
if (hpfs_inode->i_rddir_off && !atomic_read(&i->i_count)) {
186-
if (*hpfs_inode->i_rddir_off) printk("HPFS: write_inode: some position still there\n");
186+
if (*hpfs_inode->i_rddir_off)
187+
pr_warn("HPFS: write_inode: some position still there\n");
187188
kfree(hpfs_inode->i_rddir_off);
188189
hpfs_inode->i_rddir_off = NULL;
189190
}

‎fs/hpfs/map.c‎

Lines changed: 10 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -65,12 +65,13 @@ unsigned char *hpfs_load_code_page(struct super_block *s, secno cps)
6565
struct code_page_directory *cp = hpfs_map_sector(s, cps, &bh, 0);
6666
if (!cp) return NULL;
6767
if (le32_to_cpu(cp->magic) != CP_DIR_MAGIC) {
68-
printk("HPFS: Code page directory magic doesn't match (magic = %08x)\n", le32_to_cpu(cp->magic));
68+
pr_warn("HPFS: Code page directory magic doesn't match (magic = %08x)\n",
69+
le32_to_cpu(cp->magic));
6970
brelse(bh);
7071
return NULL;
7172
}
7273
if (!le32_to_cpu(cp->n_code_pages)) {
73-
printk("HPFS: n_code_pages == 0\n");
74+
pr_warn("HPFS: n_code_pages == 0\n");
7475
brelse(bh);
7576
return NULL;
7677
}
@@ -79,19 +80,19 @@ unsigned char *hpfs_load_code_page(struct super_block *s, secno cps)
7980
brelse(bh);
8081

8182
if (cpi >= 3) {
82-
printk("HPFS: Code page index out of array\n");
83+
pr_warn("HPFS: Code page index out of array\n");
8384
return NULL;
8485
}
8586

8687
if (!(cpd = hpfs_map_sector(s, cpds, &bh, 0))) return NULL;
8788
if (le16_to_cpu(cpd->offs[cpi]) > 0x178) {
88-
printk("HPFS: Code page index out of sector\n");
89+
pr_warn("HPFS: Code page index out of sector\n");
8990
brelse(bh);
9091
return NULL;
9192
}
9293
ptr = (unsigned char *)cpd + le16_to_cpu(cpd->offs[cpi]) + 6;
9394
if (!(cp_table = kmalloc(256, GFP_KERNEL))) {
94-
printk("HPFS: out of memory for code page table\n");
95+
pr_warn("HPFS: out of memory for code page table\n");
9596
brelse(bh);
9697
return NULL;
9798
}
@@ -114,7 +115,7 @@ __le32 *hpfs_load_bitmap_directory(struct super_block *s, secno bmp)
114115
int i;
115116
__le32 *b;
116117
if (!(b = kmalloc(n * 512, GFP_KERNEL))) {
117-
printk("HPFS: can't allocate memory for bitmap directory\n");
118+
pr_warn("HPFS: can't allocate memory for bitmap directory\n");
118119
return NULL;
119120
}
120121
for (i=0;i<n;i++) {
@@ -281,7 +282,9 @@ struct dnode *hpfs_map_dnode(struct super_block *s, unsigned secno,
281282
hpfs_error(s, "dnode %08x does not end with \\377 entry", secno);
282283
goto bail;
283284
}
284-
if (b == 3) printk("HPFS: warning: unbalanced dnode tree, dnode %08x; see hpfs.txt 4 more info\n", secno);
285+
if (b == 3)
286+
pr_warn("HPFS: warning: unbalanced dnode tree, dnode %08x; see hpfs.txt 4 more info\n",
287+
secno);
285288
}
286289
return dnode;
287290
bail:

‎fs/hpfs/name.c‎

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -56,14 +56,15 @@ unsigned char *hpfs_translate_name(struct super_block *s, unsigned char *from,
5656
unsigned char *to;
5757
int i;
5858
if (hpfs_sb(s)->sb_chk >= 2) if (hpfs_is_name_long(from, len) != lng) {
59-
printk("HPFS: Long name flag mismatch - name ");
60-
for (i=0; i<len; i++) printk("%c", from[i]);
61-
printk(" misidentified as %s.\n", lng ? "short" : "long");
62-
printk("HPFS: It's nothing serious. It could happen because of bug in OS/2.\nHPFS: Set checks=normal to disable this message.\n");
59+
pr_warn("HPFS: Long name flag mismatch - name ");
60+
for (i = 0; i < len; i++)
61+
pr_cont("%c", from[i]);
62+
pr_cont(" misidentified as %s.\n", lng ? "short" : "long");
63+
pr_warn("HPFS: It's nothing serious. It could happen because of bug in OS/2.\nHPFS: Set checks=normal to disable this message.\n");
6364
}
6465
if (!lc) return from;
6566
if (!(to = kmalloc(len, GFP_KERNEL))) {
66-
printk("HPFS: can't allocate memory for name conversion buffer\n");
67+
pr_warn("HPFS: can't allocate memory for name conversion buffer\n");
6768
return from;
6869
}
6970
for (i = 0; i < len; i++) to[i] = locase(hpfs_sb(s)->sb_cp_table,from[i]);

‎fs/hpfs/namei.c‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -404,7 +404,7 @@ static int hpfs_unlink(struct inode *dir, struct dentry *dentry)
404404
d_rehash(dentry);
405405
} else {
406406
struct iattr newattrs;
407-
/*printk("HPFS: truncating file before delete.\n");*/
407+
/*pr_info("HPFS: truncating file before delete.\n");*/
408408
newattrs.ia_size = 0;
409409
newattrs.ia_valid = ATTR_SIZE | ATTR_CTIME;
410410
err = notify_change(dentry, &newattrs, NULL);

0 commit comments

Comments
 (0)