Skip to content

Commit

Permalink
udf: Convert printks to pr_<level>
Browse files Browse the repository at this point in the history
Use the current logging styles.

Convert a few printks that should have been udf_warn and udf_err.
Coalesce formats.  Add #define pr_fmt.
Move an #include "udfdecls.h" above other includes in udftime.c
so pr_fmt works correctly.  Strip prefixes from conversions as appropriate.
Reorder logging definitions in udfdecl.h

Signed-off-by: Joe Perches <[email protected]>
Signed-off-by: Jan Kara <[email protected]>
  • Loading branch information
JoePerches authored and jankara committed Oct 31, 2011
1 parent a40ecd7 commit 78ace70
Show file tree
Hide file tree
Showing 7 changed files with 83 additions and 98 deletions.
4 changes: 2 additions & 2 deletions fs/udf/directory.c
Original file line number Diff line number Diff line change
Expand Up @@ -201,7 +201,7 @@ struct short_ad *udf_get_fileshortad(uint8_t *ptr, int maxoffset, uint32_t *offs
struct short_ad *sa;

if ((!ptr) || (!offset)) {
printk(KERN_ERR "udf: udf_get_fileshortad() invalidparms\n");
pr_err("%s: invalidparms\n", __func__);
return NULL;
}

Expand All @@ -223,7 +223,7 @@ struct long_ad *udf_get_filelongad(uint8_t *ptr, int maxoffset, uint32_t *offset
struct long_ad *la;

if ((!ptr) || (!offset)) {
printk(KERN_ERR "udf: udf_get_filelongad() invalidparms\n");
pr_err("%s: invalidparms\n", __func__);
return NULL;
}

Expand Down
35 changes: 15 additions & 20 deletions fs/udf/inode.c
Original file line number Diff line number Diff line change
Expand Up @@ -84,12 +84,10 @@ void udf_evict_inode(struct inode *inode)
end_writeback(inode);
if (iinfo->i_alloc_type != ICBTAG_FLAG_AD_IN_ICB &&
inode->i_size != iinfo->i_lenExtents) {
printk(KERN_WARNING "UDF-fs (%s): Inode %lu (mode %o) has "
"inode size %llu different from extent length %llu. "
"Filesystem need not be standards compliant.\n",
inode->i_sb->s_id, inode->i_ino, inode->i_mode,
(unsigned long long)inode->i_size,
(unsigned long long)iinfo->i_lenExtents);
udf_warn(inode->i_sb, "Inode %lu (mode %o) has inode size %llu different from extent length %llu. Filesystem need not be standards compliant.\n",
inode->i_ino, inode->i_mode,
(unsigned long long)inode->i_size,
(unsigned long long)iinfo->i_lenExtents);
}
kfree(iinfo->i_ext.i_data);
iinfo->i_ext.i_data = NULL;
Expand Down Expand Up @@ -1177,16 +1175,15 @@ static void __udf_read_inode(struct inode *inode)
*/
bh = udf_read_ptagged(inode->i_sb, &iinfo->i_location, 0, &ident);
if (!bh) {
printk(KERN_ERR "udf: udf_read_inode(ino %ld) failed !bh\n",
inode->i_ino);
udf_err(inode->i_sb, "(ino %ld) failed !bh\n", inode->i_ino);
make_bad_inode(inode);
return;
}

if (ident != TAG_IDENT_FE && ident != TAG_IDENT_EFE &&
ident != TAG_IDENT_USE) {
printk(KERN_ERR "udf: udf_read_inode(ino %ld) "
"failed ident=%d\n", inode->i_ino, ident);
udf_err(inode->i_sb, "(ino %ld) failed ident=%d\n",
inode->i_ino, ident);
brelse(bh);
make_bad_inode(inode);
return;
Expand Down Expand Up @@ -1226,8 +1223,8 @@ static void __udf_read_inode(struct inode *inode)
}
brelse(ibh);
} else if (fe->icbTag.strategyType != cpu_to_le16(4)) {
printk(KERN_ERR "udf: unsupported strategy type: %d\n",
le16_to_cpu(fe->icbTag.strategyType));
udf_err(inode->i_sb, "unsupported strategy type: %d\n",
le16_to_cpu(fe->icbTag.strategyType));
brelse(bh);
make_bad_inode(inode);
return;
Expand Down Expand Up @@ -1421,9 +1418,8 @@ static void udf_fill_inode(struct inode *inode, struct buffer_head *bh)
udf_debug("METADATA BITMAP FILE-----\n");
break;
default:
printk(KERN_ERR "udf: udf_fill_inode(ino %ld) failed unknown "
"file type=%d\n", inode->i_ino,
fe->icbTag.fileType);
udf_err(inode->i_sb, "(ino %ld) failed unknown file type=%d\n",
inode->i_ino, fe->icbTag.fileType);
make_bad_inode(inode);
return;
}
Expand All @@ -1446,8 +1442,8 @@ static int udf_alloc_i_data(struct inode *inode, size_t size)
iinfo->i_ext.i_data = kmalloc(size, GFP_KERNEL);

if (!iinfo->i_ext.i_data) {
printk(KERN_ERR "udf:udf_alloc_i_data (ino %ld) "
"no free memory\n", inode->i_ino);
udf_err(inode->i_sb, "(ino %ld) no free memory\n",
inode->i_ino);
return -ENOMEM;
}

Expand Down Expand Up @@ -1697,9 +1693,8 @@ static int udf_update_inode(struct inode *inode, int do_sync)
if (do_sync) {
sync_dirty_buffer(bh);
if (buffer_write_io_error(bh)) {
printk(KERN_WARNING "IO error syncing udf inode "
"[%s:%08lx]\n", inode->i_sb->s_id,
inode->i_ino);
udf_warn(inode->i_sb, "IO error syncing udf inode [%08lx]\n",
inode->i_ino);
err = -EIO;
}
}
Expand Down
73 changes: 32 additions & 41 deletions fs/udf/super.c
Original file line number Diff line number Diff line change
Expand Up @@ -547,8 +547,7 @@ static int udf_parse_options(char *options, struct udf_options *uopt,
uopt->dmode = option & 0777;
break;
default:
printk(KERN_ERR "udf: bad mount option \"%s\" "
"or missing value\n", p);
pr_err("bad mount option \"%s\" or missing value\n", p);
return 0;
}
}
Expand Down Expand Up @@ -1106,11 +1105,9 @@ static int udf_load_vat(struct super_block *sb, int p_index, int type1_index)
udf_find_vat_block(sb, p_index, type1_index, sbi->s_last_block);
if (!sbi->s_vat_inode &&
sbi->s_last_block != blocks - 1) {
printk(KERN_NOTICE "UDF-fs: Failed to read VAT inode from the"
" last recorded block (%lu), retrying with the last "
"block of the device (%lu).\n",
(unsigned long)sbi->s_last_block,
(unsigned long)blocks - 1);
pr_notice("Failed to read VAT inode from the last recorded block (%lu), retrying with the last block of the device (%lu).\n",
(unsigned long)sbi->s_last_block,
(unsigned long)blocks - 1);
udf_find_vat_block(sb, p_index, type1_index, blocks - 1);
}
if (!sbi->s_vat_inode)
Expand Down Expand Up @@ -1208,8 +1205,8 @@ static int udf_load_partdesc(struct super_block *sb, sector_t block)
if (map->s_partition_type == UDF_METADATA_MAP25) {
ret = udf_load_metadata_files(sb, i);
if (ret) {
printk(KERN_ERR "UDF-fs: error loading MetaData "
"partition map %d\n", i);
udf_err(sb, "error loading MetaData partition map %d\n",
i);
goto out_bh;
}
} else {
Expand All @@ -1222,9 +1219,7 @@ static int udf_load_partdesc(struct super_block *sb, sector_t block)
* overwrite blocks instead of relocating them).
*/
sb->s_flags |= MS_RDONLY;
printk(KERN_NOTICE "UDF-fs: Filesystem marked read-only "
"because writing to pseudooverwrite partition is "
"not implemented.\n");
pr_notice("Filesystem marked read-only because writing to pseudooverwrite partition is not implemented\n");
}
out_bh:
/* In case loading failed, we handle cleanup in udf_fill_super */
Expand Down Expand Up @@ -1466,9 +1461,9 @@ static noinline int udf_process_sequence(struct super_block *sb, long block,

bh = udf_read_tagged(sb, block, block, &ident);
if (!bh) {
printk(KERN_ERR "udf: Block %Lu of volume descriptor "
"sequence is corrupted or we could not read "
"it.\n", (unsigned long long)block);
udf_err(sb,
"Block %llu of volume descriptor sequence is corrupted or we could not read it\n",
(unsigned long long)block);
return 1;
}

Expand Down Expand Up @@ -1541,7 +1536,7 @@ static noinline int udf_process_sequence(struct super_block *sb, long block,
* in a suitable order
*/
if (!vds[VDS_POS_PRIMARY_VOL_DESC].block) {
printk(KERN_ERR "udf: Primary Volume Descriptor not found!\n");
udf_err(sb, "Primary Volume Descriptor not found!\n");
return 1;
}
if (udf_load_pvoldesc(sb, vds[VDS_POS_PRIMARY_VOL_DESC].block))
Expand Down Expand Up @@ -1728,7 +1723,7 @@ static int udf_load_vrs(struct super_block *sb, struct udf_options *uopt,

if (!sb_set_blocksize(sb, uopt->blocksize)) {
if (!silent)
printk(KERN_WARNING "UDF-fs: Bad block size\n");
udf_warn(sb, "Bad block size\n");
return 0;
}
sbi->s_last_block = uopt->lastblock;
Expand All @@ -1737,7 +1732,7 @@ static int udf_load_vrs(struct super_block *sb, struct udf_options *uopt,
nsr_off = udf_check_vsd(sb);
if (!nsr_off) {
if (!silent)
printk(KERN_WARNING "UDF-fs: No VRS found\n");
udf_warn(sb, "No VRS found\n");
return 0;
}
if (nsr_off == -1)
Expand All @@ -1753,7 +1748,7 @@ static int udf_load_vrs(struct super_block *sb, struct udf_options *uopt,
sbi->s_anchor = uopt->anchor;
if (!udf_find_anchor(sb, fileset)) {
if (!silent)
printk(KERN_WARNING "UDF-fs: No anchor found\n");
udf_warn(sb, "No anchor found\n");
return 0;
}
return 1;
Expand Down Expand Up @@ -1974,15 +1969,14 @@ static int udf_fill_super(struct super_block *sb, void *options, int silent)
ret = udf_load_vrs(sb, &uopt, silent, &fileset);
if (!ret && uopt.blocksize != UDF_DEFAULT_BLOCKSIZE) {
if (!silent)
printk(KERN_NOTICE
"UDF-fs: Rescanning with blocksize "
"%d\n", UDF_DEFAULT_BLOCKSIZE);
pr_notice("Rescanning with blocksize %d\n",
UDF_DEFAULT_BLOCKSIZE);
uopt.blocksize = UDF_DEFAULT_BLOCKSIZE;
ret = udf_load_vrs(sb, &uopt, silent, &fileset);
}
}
if (!ret) {
printk(KERN_WARNING "UDF-fs: No partition found (1)\n");
udf_warn(sb, "No partition found (1)\n");
goto error_out;
}

Expand All @@ -1997,10 +1991,9 @@ static int udf_fill_super(struct super_block *sb, void *options, int silent)
le16_to_cpu(lvidiu->maxUDFWriteRev); */

if (minUDFReadRev > UDF_MAX_READ_VERSION) {
printk(KERN_ERR "UDF-fs: minUDFReadRev=%x "
"(max is %x)\n",
le16_to_cpu(lvidiu->minUDFReadRev),
UDF_MAX_READ_VERSION);
udf_err(sb, "minUDFReadRev=%x (max is %x)\n",
le16_to_cpu(lvidiu->minUDFReadRev),
UDF_MAX_READ_VERSION);
goto error_out;
} else if (minUDFWriteRev > UDF_MAX_WRITE_VERSION)
sb->s_flags |= MS_RDONLY;
Expand All @@ -2014,28 +2007,27 @@ static int udf_fill_super(struct super_block *sb, void *options, int silent)
}

if (!sbi->s_partitions) {
printk(KERN_WARNING "UDF-fs: No partition found (2)\n");
udf_warn(sb, "No partition found (2)\n");
goto error_out;
}

if (sbi->s_partmaps[sbi->s_partition].s_partition_flags &
UDF_PART_FLAG_READ_ONLY) {
printk(KERN_NOTICE "UDF-fs: Partition marked readonly; "
"forcing readonly mount\n");
pr_notice("Partition marked readonly; forcing readonly mount\n");
sb->s_flags |= MS_RDONLY;
}

if (udf_find_fileset(sb, &fileset, &rootdir)) {
printk(KERN_WARNING "UDF-fs: No fileset found\n");
udf_warn(sb, "No fileset found\n");
goto error_out;
}

if (!silent) {
struct timestamp ts;
udf_time_to_disk_stamp(&ts, sbi->s_record_time);
udf_info("UDF: Mounting volume '%s', "
"timestamp %04u/%02u/%02u %02u:%02u (%x)\n",
sbi->s_volume_ident, le16_to_cpu(ts.year), ts.month, ts.day,
udf_info("Mounting volume '%s', timestamp %04u/%02u/%02u %02u:%02u (%x)\n",
sbi->s_volume_ident,
le16_to_cpu(ts.year), ts.month, ts.day,
ts.hour, ts.minute, le16_to_cpu(ts.typeAndTimezone));
}
if (!(sb->s_flags & MS_RDONLY))
Expand All @@ -2046,16 +2038,15 @@ static int udf_fill_super(struct super_block *sb, void *options, int silent)
/* perhaps it's not extensible enough, but for now ... */
inode = udf_iget(sb, &rootdir);
if (!inode) {
printk(KERN_ERR "UDF-fs: Error in udf_iget, block=%d, "
"partition=%d\n",
udf_err(sb, "Error in udf_iget, block=%d, partition=%d\n",
rootdir.logicalBlockNum, rootdir.partitionReferenceNum);
goto error_out;
}

/* Allocate a dentry for the root inode */
sb->s_root = d_alloc_root(inode);
if (!sb->s_root) {
printk(KERN_ERR "UDF-fs: Couldn't allocate root dentry\n");
udf_err(sb, "Couldn't allocate root dentry\n");
iput(inode);
goto error_out;
}
Expand Down Expand Up @@ -2095,7 +2086,7 @@ void _udf_err(struct super_block *sb, const char *function,
va_start(args, fmt);
vsnprintf(error_buf, sizeof(error_buf), fmt, args);
va_end(args);
printk(KERN_CRIT "UDF-fs error (device %s): %s: %s",
pr_crit("error (device %s): %s: %s",
sb->s_id, function, error_buf);
}

Expand All @@ -2107,7 +2098,7 @@ void _udf_warn(struct super_block *sb, const char *function,
va_start(args, fmt);
vsnprintf(error_buf, sizeof(error_buf), fmt, args);
va_end(args);
printk(KERN_WARNING "UDF-fs warning (device %s): %s: %s",
pr_warn("warning (device %s): %s: %s",
sb->s_id, function, error_buf);
}

Expand Down Expand Up @@ -2200,11 +2191,11 @@ static unsigned int udf_count_free_bitmap(struct super_block *sb,
bh = udf_read_ptagged(sb, &loc, 0, &ident);

if (!bh) {
printk(KERN_ERR "udf: udf_count_free failed\n");
udf_err(sb, "udf_count_free failed\n");
goto out;
} else if (ident != TAG_IDENT_SBD) {
brelse(bh);
printk(KERN_ERR "udf: udf_count_free failed\n");
udf_err(sb, "udf_count_free failed\n");
goto out;
}

Expand Down
22 changes: 10 additions & 12 deletions fs/udf/truncate.c
Original file line number Diff line number Diff line change
Expand Up @@ -95,23 +95,21 @@ void udf_truncate_tail_extent(struct inode *inode)
lbcount += elen;
if (lbcount > inode->i_size) {
if (lbcount - inode->i_size >= inode->i_sb->s_blocksize)
printk(KERN_WARNING
"udf_truncate_tail_extent(): Too long "
"extent after EOF in inode %u: i_size: "
"%Ld lbcount: %Ld extent %u+%u\n",
(unsigned)inode->i_ino,
(long long)inode->i_size,
(long long)lbcount,
(unsigned)eloc.logicalBlockNum,
(unsigned)elen);
udf_warn(inode->i_sb,
"Too long extent after EOF in inode %u: i_size: %lld lbcount: %lld extent %u+%u\n",
(unsigned)inode->i_ino,
(long long)inode->i_size,
(long long)lbcount,
(unsigned)eloc.logicalBlockNum,
(unsigned)elen);
nelen = elen - (lbcount - inode->i_size);
epos.offset -= adsize;
extent_trunc(inode, &epos, &eloc, etype, elen, nelen);
epos.offset += adsize;
if (udf_next_aext(inode, &epos, &eloc, &elen, 1) != -1)
printk(KERN_ERR "udf_truncate_tail_extent(): "
"Extent after EOF in inode %u.\n",
(unsigned)inode->i_ino);
udf_err(inode->i_sb,
"Extent after EOF in inode %u\n",
(unsigned)inode->i_ino);
break;
}
}
Expand Down
Loading

0 comments on commit 78ace70

Please sign in to comment.