Skip to content

Commit f403d1d

Browse files
Fabian Fredericktorvalds
authored andcommitted
fs/efs: add pr_fmt / use __func__
Also uniformize function arguments. Signed-off-by: Fabian Frederick <fabf@skynet.be> Cc: Joe Perches <joe@perches.com> Signed-off-by: Andrew Morton <akpm@linux-foundation.org> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
1 parent 179b87f commit f403d1d

6 files changed

Lines changed: 49 additions & 35 deletions

File tree

‎fs/efs/dir.c‎

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,8 @@ static int efs_readdir(struct file *file, struct dir_context *ctx)
2626
int slot;
2727

2828
if (inode->i_size & (EFS_DIRBSIZE-1))
29-
pr_warn("EFS: WARNING: readdir(): directory size not a multiple of EFS_DIRBSIZE\n");
29+
pr_warn("%s(): directory size not a multiple of EFS_DIRBSIZE\n",
30+
__func__);
3031

3132
/* work out where this entry can be found */
3233
block = ctx->pos >> EFS_DIRBSIZE_BITS;
@@ -43,14 +44,15 @@ static int efs_readdir(struct file *file, struct dir_context *ctx)
4344
bh = sb_bread(inode->i_sb, efs_bmap(inode, block));
4445

4546
if (!bh) {
46-
pr_err("EFS: readdir(): failed to read dir block %d\n", block);
47+
pr_err("%s(): failed to read dir block %d\n",
48+
__func__, block);
4749
break;
4850
}
4951

5052
dirblock = (struct efs_dir *) bh->b_data;
5153

5254
if (be16_to_cpu(dirblock->magic) != EFS_DIRBLK_MAGIC) {
53-
pr_err("EFS: readdir(): invalid directory block\n");
55+
pr_err("%s(): invalid directory block\n", __func__);
5456
brelse(bh);
5557
break;
5658
}
@@ -80,7 +82,8 @@ static int efs_readdir(struct file *file, struct dir_context *ctx)
8082

8183
/* sanity check */
8284
if (nameptr - (char *) dirblock + namelen > EFS_DIRBSIZE) {
83-
pr_warn("EFS: directory entry %d exceeds directory block\n", slot);
85+
pr_warn("directory entry %d exceeds directory block\n",
86+
slot);
8487
continue;
8588
}
8689

‎fs/efs/efs.h‎

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,12 @@
77
#ifndef _EFS_EFS_H_
88
#define _EFS_EFS_H_
99

10+
#ifdef pr_fmt
11+
#undef pr_fmt
12+
#endif
13+
14+
#define pr_fmt(fmt) KBUILD_MODNAME ": " fmt
15+
1016
#include <linux/fs.h>
1117
#include <asm/uaccess.h>
1218

‎fs/efs/file.c‎

Lines changed: 5 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -22,10 +22,8 @@ int efs_get_block(struct inode *inode, sector_t iblock,
2222
/*
2323
* i have no idea why this happens as often as it does
2424
*/
25-
pr_warn("EFS: bmap(): block %d >= %ld (filesize %ld)\n",
26-
block,
27-
inode->i_blocks,
28-
inode->i_size);
25+
pr_warn("%s(): block %d >= %ld (filesize %ld)\n",
26+
__func__, block, inode->i_blocks, inode->i_size);
2927
#endif
3028
return 0;
3129
}
@@ -38,7 +36,7 @@ int efs_get_block(struct inode *inode, sector_t iblock,
3836
int efs_bmap(struct inode *inode, efs_block_t block) {
3937

4038
if (block < 0) {
41-
pr_warn("EFS: bmap(): block < 0\n");
39+
pr_warn("%s(): block < 0\n", __func__);
4240
return 0;
4341
}
4442

@@ -48,8 +46,8 @@ int efs_bmap(struct inode *inode, efs_block_t block) {
4846
/*
4947
* i have no idea why this happens as often as it does
5048
*/
51-
pr_warn("EFS: bmap(): block %d >= %ld (filesize %ld)\n",
52-
block, inode->i_blocks, inode->i_size);
49+
pr_warn("%s(): block %d >= %ld (filesize %ld)\n",
50+
__func__, block, inode->i_blocks, inode->i_size);
5351
#endif
5452
return 0;
5553
}

‎fs/efs/inode.c‎

Lines changed: 14 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -89,7 +89,7 @@ struct inode *efs_iget(struct super_block *super, unsigned long ino)
8989

9090
bh = sb_bread(inode->i_sb, block);
9191
if (!bh) {
92-
pr_warn("EFS: bread() failed at block %d\n", block);
92+
pr_warn("%s() failed at block %d\n", __func__, block);
9393
goto read_inode_error;
9494
}
9595

@@ -130,7 +130,8 @@ struct inode *efs_iget(struct super_block *super, unsigned long ino)
130130
for(i = 0; i < EFS_DIRECTEXTENTS; i++) {
131131
extent_copy(&(efs_inode->di_u.di_extents[i]), &(in->extents[i]));
132132
if (i < in->numextents && in->extents[i].cooked.ex_magic != 0) {
133-
pr_warn("EFS: extent %d has bad magic number in inode %lu\n", i, inode->i_ino);
133+
pr_warn("extent %d has bad magic number in inode %lu\n",
134+
i, inode->i_ino);
134135
brelse(bh);
135136
goto read_inode_error;
136137
}
@@ -162,7 +163,7 @@ struct inode *efs_iget(struct super_block *super, unsigned long ino)
162163
init_special_inode(inode, inode->i_mode, device);
163164
break;
164165
default:
165-
pr_warn("EFS: unsupported inode mode %o\n", inode->i_mode);
166+
pr_warn("unsupported inode mode %o\n", inode->i_mode);
166167
goto read_inode_error;
167168
break;
168169
}
@@ -171,7 +172,7 @@ struct inode *efs_iget(struct super_block *super, unsigned long ino)
171172
return inode;
172173

173174
read_inode_error:
174-
pr_warn("EFS: failed to read inode %lu\n", inode->i_ino);
175+
pr_warn("failed to read inode %lu\n", inode->i_ino);
175176
iget_failed(inode);
176177
return ERR_PTR(-EIO);
177178
}
@@ -216,7 +217,7 @@ efs_block_t efs_map_block(struct inode *inode, efs_block_t block) {
216217

217218
/* if we only have one extent then nothing can be found */
218219
if (in->numextents == 1) {
219-
pr_err("EFS: map_block() failed to map (1 extent)\n");
220+
pr_err("%s() failed to map (1 extent)\n", __func__);
220221
return 0;
221222
}
222223

@@ -234,7 +235,7 @@ efs_block_t efs_map_block(struct inode *inode, efs_block_t block) {
234235
}
235236
}
236237

237-
pr_err("EFS: map_block() failed to map block %u (dir)\n", block);
238+
pr_err("%s() failed to map block %u (dir)\n", __func__, block);
238239
return 0;
239240
}
240241

@@ -262,7 +263,8 @@ efs_block_t efs_map_block(struct inode *inode, efs_block_t block) {
262263

263264
if (dirext == direxts) {
264265
/* should never happen */
265-
pr_err("EFS: couldn't find direct extent for indirect extent %d (block %u)\n", cur, block);
266+
pr_err("couldn't find direct extent for indirect extent %d (block %u)\n",
267+
cur, block);
266268
if (bh) brelse(bh);
267269
return 0;
268270
}
@@ -279,7 +281,8 @@ efs_block_t efs_map_block(struct inode *inode, efs_block_t block) {
279281

280282
bh = sb_bread(inode->i_sb, iblock);
281283
if (!bh) {
282-
pr_err("EFS: bread() failed at block %d\n", iblock);
284+
pr_err("%s() failed at block %d\n",
285+
__func__, iblock);
283286
return 0;
284287
}
285288
#ifdef DEBUG
@@ -294,7 +297,8 @@ efs_block_t efs_map_block(struct inode *inode, efs_block_t block) {
294297
extent_copy(&(exts[ioffset]), &ext);
295298

296299
if (ext.cooked.ex_magic != 0) {
297-
pr_err("EFS: extent %d has bad magic number in block %d\n", cur, iblock);
300+
pr_err("extent %d has bad magic number in block %d\n",
301+
cur, iblock);
298302
if (bh) brelse(bh);
299303
return 0;
300304
}
@@ -306,7 +310,7 @@ efs_block_t efs_map_block(struct inode *inode, efs_block_t block) {
306310
}
307311
}
308312
if (bh) brelse(bh);
309-
pr_err("EFS: map_block() failed to map block %u (indir)\n", block);
313+
pr_err("%s() failed to map block %u (indir)\n", __func__, block);
310314
return 0;
311315
}
312316

‎fs/efs/namei.c‎

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -23,20 +23,22 @@ static efs_ino_t efs_find_entry(struct inode *inode, const char *name, int len)
2323
efs_block_t block;
2424

2525
if (inode->i_size & (EFS_DIRBSIZE-1))
26-
pr_warn("EFS: WARNING: find_entry(): directory size not a multiple of EFS_DIRBSIZE\n");
26+
pr_warn("%s(): directory size not a multiple of EFS_DIRBSIZE\n",
27+
__func__);
2728

2829
for(block = 0; block < inode->i_blocks; block++) {
2930

3031
bh = sb_bread(inode->i_sb, efs_bmap(inode, block));
3132
if (!bh) {
32-
pr_err("EFS: find_entry(): failed to read dir block %d\n", block);
33+
pr_err("%s(): failed to read dir block %d\n",
34+
__func__, block);
3335
return 0;
3436
}
3537

3638
dirblock = (struct efs_dir *) bh->b_data;
3739

3840
if (be16_to_cpu(dirblock->magic) != EFS_DIRBLK_MAGIC) {
39-
pr_err("EFS: find_entry(): invalid directory block\n");
41+
pr_err("%s(): invalid directory block\n", __func__);
4042
brelse(bh);
4143
return(0);
4244
}

‎fs/efs/super.c‎

Lines changed: 12 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -134,7 +134,7 @@ static const struct export_operations efs_export_ops = {
134134

135135
static int __init init_efs_fs(void) {
136136
int err;
137-
pr_info("EFS: "EFS_VERSION" - http://aeschi.ch.eu.org/efs/\n");
137+
pr_info(EFS_VERSION" - http://aeschi.ch.eu.org/efs/\n");
138138
err = init_inodecache();
139139
if (err)
140140
goto out1;
@@ -179,7 +179,7 @@ static efs_block_t efs_validate_vh(struct volume_header *vh) {
179179
csum += be32_to_cpu(cs);
180180
}
181181
if (csum) {
182-
pr_warn("EFS: SGI disklabel: checksum bad, label corrupted\n");
182+
pr_warn("SGI disklabel: checksum bad, label corrupted\n");
183183
return 0;
184184
}
185185

@@ -226,10 +226,10 @@ static efs_block_t efs_validate_vh(struct volume_header *vh) {
226226
}
227227

228228
if (slice == -1) {
229-
pr_notice("EFS: partition table contained no EFS partitions\n");
229+
pr_notice("partition table contained no EFS partitions\n");
230230
#ifdef DEBUG
231231
} else {
232-
pr_info("EFS: using slice %d (type %s, offset 0x%x)\n", slice,
232+
pr_info("using slice %d (type %s, offset 0x%x)\n", slice,
233233
(pt_entry->pt_name) ? pt_entry->pt_name : "unknown",
234234
sblock);
235235
#endif
@@ -267,7 +267,7 @@ static int efs_fill_super(struct super_block *s, void *d, int silent)
267267

268268
s->s_magic = EFS_SUPER_MAGIC;
269269
if (!sb_set_blocksize(s, EFS_BLOCKSIZE)) {
270-
pr_err("EFS: device does not support %d byte blocks\n",
270+
pr_err("device does not support %d byte blocks\n",
271271
EFS_BLOCKSIZE);
272272
return -EINVAL;
273273
}
@@ -276,7 +276,7 @@ static int efs_fill_super(struct super_block *s, void *d, int silent)
276276
bh = sb_bread(s, 0);
277277

278278
if (!bh) {
279-
pr_err("EFS: cannot read volume header\n");
279+
pr_err("cannot read volume header\n");
280280
return -EINVAL;
281281
}
282282

@@ -294,13 +294,14 @@ static int efs_fill_super(struct super_block *s, void *d, int silent)
294294

295295
bh = sb_bread(s, sb->fs_start + EFS_SUPER);
296296
if (!bh) {
297-
pr_err("EFS: cannot read superblock\n");
297+
pr_err("cannot read superblock\n");
298298
return -EINVAL;
299299
}
300300

301301
if (efs_validate_super(sb, (struct efs_super *) bh->b_data)) {
302302
#ifdef DEBUG
303-
pr_warn("EFS: invalid superblock at block %u\n", sb->fs_start + EFS_SUPER);
303+
pr_warn("invalid superblock at block %u\n",
304+
sb->fs_start + EFS_SUPER);
304305
#endif
305306
brelse(bh);
306307
return -EINVAL;
@@ -309,21 +310,21 @@ static int efs_fill_super(struct super_block *s, void *d, int silent)
309310

310311
if (!(s->s_flags & MS_RDONLY)) {
311312
#ifdef DEBUG
312-
pr_info("EFS: forcing read-only mode\n");
313+
pr_info("forcing read-only mode\n");
313314
#endif
314315
s->s_flags |= MS_RDONLY;
315316
}
316317
s->s_op = &efs_superblock_operations;
317318
s->s_export_op = &efs_export_ops;
318319
root = efs_iget(s, EFS_ROOTINODE);
319320
if (IS_ERR(root)) {
320-
pr_err("EFS: get root inode failed\n");
321+
pr_err("get root inode failed\n");
321322
return PTR_ERR(root);
322323
}
323324

324325
s->s_root = d_make_root(root);
325326
if (!(s->s_root)) {
326-
pr_err("EFS: get root dentry failed\n");
327+
pr_err("get root dentry failed\n");
327328
return -ENOMEM;
328329
}
329330

0 commit comments

Comments
 (0)