Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 78ace70c authored by Joe Perches's avatar Joe Perches Committed by Jan Kara
Browse files

udf: Convert printks to pr_<level>



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: default avatarJoe Perches <joe@perches.com>
Signed-off-by: default avatarJan Kara <jack@suse.cz>
parent a40ecd7b
Loading
Loading
Loading
Loading
+2 −2
Original line number Diff line number Diff line
@@ -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;
	}

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

+15 −20
Original line number Diff line number Diff line
@@ -84,10 +84,8 @@ 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,
		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);
	}
@@ -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;
@@ -1226,7 +1223,7 @@ 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",
		udf_err(inode->i_sb, "unsupported strategy type: %d\n",
			le16_to_cpu(fe->icbTag.strategyType));
		brelse(bh);
		make_bad_inode(inode);
@@ -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;
	}
@@ -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;
	}

@@ -1697,8 +1693,7 @@ 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,
			udf_warn(inode->i_sb, "IO error syncing udf inode [%08lx]\n",
				 inode->i_ino);
			err = -EIO;
		}
+32 −41
Original line number Diff line number Diff line
@@ -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;
		}
	}
@@ -1106,9 +1105,7 @@ 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",
		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);
@@ -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 {
@@ -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 */
@@ -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;
		}

@@ -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))
@@ -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;
@@ -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)
@@ -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;
@@ -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;
	}

@@ -1997,8 +1991,7 @@ 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",
			udf_err(sb, "minUDFReadRev=%x (max is %x)\n",
				le16_to_cpu(lvidiu->minUDFReadRev),
				UDF_MAX_READ_VERSION);
			goto error_out;
@@ -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))
@@ -2046,8 +2038,7 @@ 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;
	}
@@ -2055,7 +2046,7 @@ static int udf_fill_super(struct super_block *sb, void *options, int silent)
	/* 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;
	}
@@ -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);
}

@@ -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);
}

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

+10 −12
Original line number Diff line number Diff line
@@ -95,10 +95,8 @@ 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",
				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,
@@ -109,8 +107,8 @@ void udf_truncate_tail_extent(struct inode *inode)
			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",
				udf_err(inode->i_sb,
					"Extent after EOF in inode %u\n",
					(unsigned)inode->i_ino);
			break;
		}
+19 −19
Original line number Diff line number Diff line
#ifndef __UDF_DECL_H
#define __UDF_DECL_H

#define pr_fmt(fmt) "UDF-fs: " fmt

#include "ecma_167.h"
#include "osta_udf.h"

@@ -16,18 +18,11 @@
#define UDF_PREALLOCATE
#define UDF_DEFAULT_PREALLOC_BLOCKS	8

#undef UDFFS_DEBUG

#ifdef UDFFS_DEBUG
#define udf_debug(f, a...) \
do { \
	printk(KERN_DEBUG "UDF-fs DEBUG %s:%d:%s: ", \
		__FILE__, __LINE__, __func__); \
	printk(f, ##a); \
} while (0)
#else
#define udf_debug(f, a...) /**/
#endif
__attribute__((format(printf, 3, 4)))
extern void _udf_err(struct super_block *sb, const char *function,
		     const char *fmt, ...);
#define udf_err(sb, fmt, ...)					\
	_udf_err(sb, __func__, fmt, ##__VA_ARGS__)

__attribute__((format(printf, 3, 4)))
extern void _udf_warn(struct super_block *sb, const char *function,
@@ -35,14 +30,19 @@ extern void _udf_warn(struct super_block *sb, const char *function,
#define udf_warn(sb, fmt, ...)					\
	_udf_warn(sb, __func__, fmt, ##__VA_ARGS__)

__attribute__((format(printf, 3, 4)))
extern void _udf_err(struct super_block *sb, const char *function,
		     const char *fmt, ...);
#define udf_err(sb, fmt, ...)					\
	_udf_err(sb, __func__, fmt, ##__VA_ARGS__)
#define udf_info(fmt, ...)					\
	pr_info("INFO " fmt, ##__VA_ARGS__)

#define udf_info(f, a...) \
	printk(KERN_INFO "UDF-fs INFO " f, ##a);
#undef UDFFS_DEBUG

#ifdef UDFFS_DEBUG
#define udf_debug(fmt, ...)					\
	printk(KERN_DEBUG pr_fmt("%s:%d:%s: " fmt),		\
	       __FILE__, __LINE__, __func__, ##__VA_ARGS__)
#else
#define udf_debug(fmt, ...)					\
	no_printk(fmt, ##__VA_ARGS__)
#endif

#define udf_fixed_to_variable(x) ( ( ( (x) >> 5 ) * 39 ) + ( (x) & 0x0000001F ) )
#define udf_variable_to_fixed(x) ( ( ( (x) / 39 ) << 5 ) + ( (x) % 39 ) )
Loading