Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

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: Joe Perches <joe@perches.com>
Signed-off-by: Jan Kara <jack@suse.cz>

authored by

Joe Perches and committed by
Jan Kara
78ace70c a40ecd7b

+83 -98
+2 -2
fs/udf/directory.c
··· 201 201 struct short_ad *sa; 202 202 203 203 if ((!ptr) || (!offset)) { 204 - printk(KERN_ERR "udf: udf_get_fileshortad() invalidparms\n"); 204 + pr_err("%s: invalidparms\n", __func__); 205 205 return NULL; 206 206 } 207 207 ··· 223 223 struct long_ad *la; 224 224 225 225 if ((!ptr) || (!offset)) { 226 - printk(KERN_ERR "udf: udf_get_filelongad() invalidparms\n"); 226 + pr_err("%s: invalidparms\n", __func__); 227 227 return NULL; 228 228 } 229 229
+15 -20
fs/udf/inode.c
··· 84 84 end_writeback(inode); 85 85 if (iinfo->i_alloc_type != ICBTAG_FLAG_AD_IN_ICB && 86 86 inode->i_size != iinfo->i_lenExtents) { 87 - printk(KERN_WARNING "UDF-fs (%s): Inode %lu (mode %o) has " 88 - "inode size %llu different from extent length %llu. " 89 - "Filesystem need not be standards compliant.\n", 90 - inode->i_sb->s_id, inode->i_ino, inode->i_mode, 91 - (unsigned long long)inode->i_size, 92 - (unsigned long long)iinfo->i_lenExtents); 87 + 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", 88 + inode->i_ino, inode->i_mode, 89 + (unsigned long long)inode->i_size, 90 + (unsigned long long)iinfo->i_lenExtents); 93 91 } 94 92 kfree(iinfo->i_ext.i_data); 95 93 iinfo->i_ext.i_data = NULL; ··· 1175 1177 */ 1176 1178 bh = udf_read_ptagged(inode->i_sb, &iinfo->i_location, 0, &ident); 1177 1179 if (!bh) { 1178 - printk(KERN_ERR "udf: udf_read_inode(ino %ld) failed !bh\n", 1179 - inode->i_ino); 1180 + udf_err(inode->i_sb, "(ino %ld) failed !bh\n", inode->i_ino); 1180 1181 make_bad_inode(inode); 1181 1182 return; 1182 1183 } 1183 1184 1184 1185 if (ident != TAG_IDENT_FE && ident != TAG_IDENT_EFE && 1185 1186 ident != TAG_IDENT_USE) { 1186 - printk(KERN_ERR "udf: udf_read_inode(ino %ld) " 1187 - "failed ident=%d\n", inode->i_ino, ident); 1187 + udf_err(inode->i_sb, "(ino %ld) failed ident=%d\n", 1188 + inode->i_ino, ident); 1188 1189 brelse(bh); 1189 1190 make_bad_inode(inode); 1190 1191 return; ··· 1223 1226 } 1224 1227 brelse(ibh); 1225 1228 } else if (fe->icbTag.strategyType != cpu_to_le16(4)) { 1226 - printk(KERN_ERR "udf: unsupported strategy type: %d\n", 1227 - le16_to_cpu(fe->icbTag.strategyType)); 1229 + udf_err(inode->i_sb, "unsupported strategy type: %d\n", 1230 + le16_to_cpu(fe->icbTag.strategyType)); 1228 1231 brelse(bh); 1229 1232 make_bad_inode(inode); 1230 1233 return; ··· 1418 1421 udf_debug("METADATA BITMAP FILE-----\n"); 1419 1422 break; 1420 1423 default: 1421 - printk(KERN_ERR "udf: udf_fill_inode(ino %ld) failed unknown " 1422 - "file type=%d\n", inode->i_ino, 1423 - fe->icbTag.fileType); 1424 + udf_err(inode->i_sb, "(ino %ld) failed unknown file type=%d\n", 1425 + inode->i_ino, fe->icbTag.fileType); 1424 1426 make_bad_inode(inode); 1425 1427 return; 1426 1428 } ··· 1442 1446 iinfo->i_ext.i_data = kmalloc(size, GFP_KERNEL); 1443 1447 1444 1448 if (!iinfo->i_ext.i_data) { 1445 - printk(KERN_ERR "udf:udf_alloc_i_data (ino %ld) " 1446 - "no free memory\n", inode->i_ino); 1449 + udf_err(inode->i_sb, "(ino %ld) no free memory\n", 1450 + inode->i_ino); 1447 1451 return -ENOMEM; 1448 1452 } 1449 1453 ··· 1693 1697 if (do_sync) { 1694 1698 sync_dirty_buffer(bh); 1695 1699 if (buffer_write_io_error(bh)) { 1696 - printk(KERN_WARNING "IO error syncing udf inode " 1697 - "[%s:%08lx]\n", inode->i_sb->s_id, 1698 - inode->i_ino); 1700 + udf_warn(inode->i_sb, "IO error syncing udf inode [%08lx]\n", 1701 + inode->i_ino); 1699 1702 err = -EIO; 1700 1703 } 1701 1704 }
+32 -41
fs/udf/super.c
··· 547 547 uopt->dmode = option & 0777; 548 548 break; 549 549 default: 550 - printk(KERN_ERR "udf: bad mount option \"%s\" " 551 - "or missing value\n", p); 550 + pr_err("bad mount option \"%s\" or missing value\n", p); 552 551 return 0; 553 552 } 554 553 } ··· 1105 1106 udf_find_vat_block(sb, p_index, type1_index, sbi->s_last_block); 1106 1107 if (!sbi->s_vat_inode && 1107 1108 sbi->s_last_block != blocks - 1) { 1108 - printk(KERN_NOTICE "UDF-fs: Failed to read VAT inode from the" 1109 - " last recorded block (%lu), retrying with the last " 1110 - "block of the device (%lu).\n", 1111 - (unsigned long)sbi->s_last_block, 1112 - (unsigned long)blocks - 1); 1109 + pr_notice("Failed to read VAT inode from the last recorded block (%lu), retrying with the last block of the device (%lu).\n", 1110 + (unsigned long)sbi->s_last_block, 1111 + (unsigned long)blocks - 1); 1113 1112 udf_find_vat_block(sb, p_index, type1_index, blocks - 1); 1114 1113 } 1115 1114 if (!sbi->s_vat_inode) ··· 1205 1208 if (map->s_partition_type == UDF_METADATA_MAP25) { 1206 1209 ret = udf_load_metadata_files(sb, i); 1207 1210 if (ret) { 1208 - printk(KERN_ERR "UDF-fs: error loading MetaData " 1209 - "partition map %d\n", i); 1211 + udf_err(sb, "error loading MetaData partition map %d\n", 1212 + i); 1210 1213 goto out_bh; 1211 1214 } 1212 1215 } else { ··· 1219 1222 * overwrite blocks instead of relocating them). 1220 1223 */ 1221 1224 sb->s_flags |= MS_RDONLY; 1222 - printk(KERN_NOTICE "UDF-fs: Filesystem marked read-only " 1223 - "because writing to pseudooverwrite partition is " 1224 - "not implemented.\n"); 1225 + pr_notice("Filesystem marked read-only because writing to pseudooverwrite partition is not implemented\n"); 1225 1226 } 1226 1227 out_bh: 1227 1228 /* In case loading failed, we handle cleanup in udf_fill_super */ ··· 1461 1466 1462 1467 bh = udf_read_tagged(sb, block, block, &ident); 1463 1468 if (!bh) { 1464 - printk(KERN_ERR "udf: Block %Lu of volume descriptor " 1465 - "sequence is corrupted or we could not read " 1466 - "it.\n", (unsigned long long)block); 1469 + udf_err(sb, 1470 + "Block %llu of volume descriptor sequence is corrupted or we could not read it\n", 1471 + (unsigned long long)block); 1467 1472 return 1; 1468 1473 } 1469 1474 ··· 1536 1541 * in a suitable order 1537 1542 */ 1538 1543 if (!vds[VDS_POS_PRIMARY_VOL_DESC].block) { 1539 - printk(KERN_ERR "udf: Primary Volume Descriptor not found!\n"); 1544 + udf_err(sb, "Primary Volume Descriptor not found!\n"); 1540 1545 return 1; 1541 1546 } 1542 1547 if (udf_load_pvoldesc(sb, vds[VDS_POS_PRIMARY_VOL_DESC].block)) ··· 1723 1728 1724 1729 if (!sb_set_blocksize(sb, uopt->blocksize)) { 1725 1730 if (!silent) 1726 - printk(KERN_WARNING "UDF-fs: Bad block size\n"); 1731 + udf_warn(sb, "Bad block size\n"); 1727 1732 return 0; 1728 1733 } 1729 1734 sbi->s_last_block = uopt->lastblock; ··· 1732 1737 nsr_off = udf_check_vsd(sb); 1733 1738 if (!nsr_off) { 1734 1739 if (!silent) 1735 - printk(KERN_WARNING "UDF-fs: No VRS found\n"); 1740 + udf_warn(sb, "No VRS found\n"); 1736 1741 return 0; 1737 1742 } 1738 1743 if (nsr_off == -1) ··· 1748 1753 sbi->s_anchor = uopt->anchor; 1749 1754 if (!udf_find_anchor(sb, fileset)) { 1750 1755 if (!silent) 1751 - printk(KERN_WARNING "UDF-fs: No anchor found\n"); 1756 + udf_warn(sb, "No anchor found\n"); 1752 1757 return 0; 1753 1758 } 1754 1759 return 1; ··· 1969 1974 ret = udf_load_vrs(sb, &uopt, silent, &fileset); 1970 1975 if (!ret && uopt.blocksize != UDF_DEFAULT_BLOCKSIZE) { 1971 1976 if (!silent) 1972 - printk(KERN_NOTICE 1973 - "UDF-fs: Rescanning with blocksize " 1974 - "%d\n", UDF_DEFAULT_BLOCKSIZE); 1977 + pr_notice("Rescanning with blocksize %d\n", 1978 + UDF_DEFAULT_BLOCKSIZE); 1975 1979 uopt.blocksize = UDF_DEFAULT_BLOCKSIZE; 1976 1980 ret = udf_load_vrs(sb, &uopt, silent, &fileset); 1977 1981 } 1978 1982 } 1979 1983 if (!ret) { 1980 - printk(KERN_WARNING "UDF-fs: No partition found (1)\n"); 1984 + udf_warn(sb, "No partition found (1)\n"); 1981 1985 goto error_out; 1982 1986 } 1983 1987 ··· 1991 1997 le16_to_cpu(lvidiu->maxUDFWriteRev); */ 1992 1998 1993 1999 if (minUDFReadRev > UDF_MAX_READ_VERSION) { 1994 - printk(KERN_ERR "UDF-fs: minUDFReadRev=%x " 1995 - "(max is %x)\n", 1996 - le16_to_cpu(lvidiu->minUDFReadRev), 1997 - UDF_MAX_READ_VERSION); 2000 + udf_err(sb, "minUDFReadRev=%x (max is %x)\n", 2001 + le16_to_cpu(lvidiu->minUDFReadRev), 2002 + UDF_MAX_READ_VERSION); 1998 2003 goto error_out; 1999 2004 } else if (minUDFWriteRev > UDF_MAX_WRITE_VERSION) 2000 2005 sb->s_flags |= MS_RDONLY; ··· 2007 2014 } 2008 2015 2009 2016 if (!sbi->s_partitions) { 2010 - printk(KERN_WARNING "UDF-fs: No partition found (2)\n"); 2017 + udf_warn(sb, "No partition found (2)\n"); 2011 2018 goto error_out; 2012 2019 } 2013 2020 2014 2021 if (sbi->s_partmaps[sbi->s_partition].s_partition_flags & 2015 2022 UDF_PART_FLAG_READ_ONLY) { 2016 - printk(KERN_NOTICE "UDF-fs: Partition marked readonly; " 2017 - "forcing readonly mount\n"); 2023 + pr_notice("Partition marked readonly; forcing readonly mount\n"); 2018 2024 sb->s_flags |= MS_RDONLY; 2019 2025 } 2020 2026 2021 2027 if (udf_find_fileset(sb, &fileset, &rootdir)) { 2022 - printk(KERN_WARNING "UDF-fs: No fileset found\n"); 2028 + udf_warn(sb, "No fileset found\n"); 2023 2029 goto error_out; 2024 2030 } 2025 2031 2026 2032 if (!silent) { 2027 2033 struct timestamp ts; 2028 2034 udf_time_to_disk_stamp(&ts, sbi->s_record_time); 2029 - udf_info("UDF: Mounting volume '%s', " 2030 - "timestamp %04u/%02u/%02u %02u:%02u (%x)\n", 2031 - sbi->s_volume_ident, le16_to_cpu(ts.year), ts.month, ts.day, 2035 + udf_info("Mounting volume '%s', timestamp %04u/%02u/%02u %02u:%02u (%x)\n", 2036 + sbi->s_volume_ident, 2037 + le16_to_cpu(ts.year), ts.month, ts.day, 2032 2038 ts.hour, ts.minute, le16_to_cpu(ts.typeAndTimezone)); 2033 2039 } 2034 2040 if (!(sb->s_flags & MS_RDONLY)) ··· 2038 2046 /* perhaps it's not extensible enough, but for now ... */ 2039 2047 inode = udf_iget(sb, &rootdir); 2040 2048 if (!inode) { 2041 - printk(KERN_ERR "UDF-fs: Error in udf_iget, block=%d, " 2042 - "partition=%d\n", 2049 + udf_err(sb, "Error in udf_iget, block=%d, partition=%d\n", 2043 2050 rootdir.logicalBlockNum, rootdir.partitionReferenceNum); 2044 2051 goto error_out; 2045 2052 } ··· 2046 2055 /* Allocate a dentry for the root inode */ 2047 2056 sb->s_root = d_alloc_root(inode); 2048 2057 if (!sb->s_root) { 2049 - printk(KERN_ERR "UDF-fs: Couldn't allocate root dentry\n"); 2058 + udf_err(sb, "Couldn't allocate root dentry\n"); 2050 2059 iput(inode); 2051 2060 goto error_out; 2052 2061 } ··· 2086 2095 va_start(args, fmt); 2087 2096 vsnprintf(error_buf, sizeof(error_buf), fmt, args); 2088 2097 va_end(args); 2089 - printk(KERN_CRIT "UDF-fs error (device %s): %s: %s", 2098 + pr_crit("error (device %s): %s: %s", 2090 2099 sb->s_id, function, error_buf); 2091 2100 } 2092 2101 ··· 2098 2107 va_start(args, fmt); 2099 2108 vsnprintf(error_buf, sizeof(error_buf), fmt, args); 2100 2109 va_end(args); 2101 - printk(KERN_WARNING "UDF-fs warning (device %s): %s: %s", 2110 + pr_warn("warning (device %s): %s: %s", 2102 2111 sb->s_id, function, error_buf); 2103 2112 } 2104 2113 ··· 2191 2200 bh = udf_read_ptagged(sb, &loc, 0, &ident); 2192 2201 2193 2202 if (!bh) { 2194 - printk(KERN_ERR "udf: udf_count_free failed\n"); 2203 + udf_err(sb, "udf_count_free failed\n"); 2195 2204 goto out; 2196 2205 } else if (ident != TAG_IDENT_SBD) { 2197 2206 brelse(bh); 2198 - printk(KERN_ERR "udf: udf_count_free failed\n"); 2207 + udf_err(sb, "udf_count_free failed\n"); 2199 2208 goto out; 2200 2209 } 2201 2210
+10 -12
fs/udf/truncate.c
··· 95 95 lbcount += elen; 96 96 if (lbcount > inode->i_size) { 97 97 if (lbcount - inode->i_size >= inode->i_sb->s_blocksize) 98 - printk(KERN_WARNING 99 - "udf_truncate_tail_extent(): Too long " 100 - "extent after EOF in inode %u: i_size: " 101 - "%Ld lbcount: %Ld extent %u+%u\n", 102 - (unsigned)inode->i_ino, 103 - (long long)inode->i_size, 104 - (long long)lbcount, 105 - (unsigned)eloc.logicalBlockNum, 106 - (unsigned)elen); 98 + udf_warn(inode->i_sb, 99 + "Too long extent after EOF in inode %u: i_size: %lld lbcount: %lld extent %u+%u\n", 100 + (unsigned)inode->i_ino, 101 + (long long)inode->i_size, 102 + (long long)lbcount, 103 + (unsigned)eloc.logicalBlockNum, 104 + (unsigned)elen); 107 105 nelen = elen - (lbcount - inode->i_size); 108 106 epos.offset -= adsize; 109 107 extent_trunc(inode, &epos, &eloc, etype, elen, nelen); 110 108 epos.offset += adsize; 111 109 if (udf_next_aext(inode, &epos, &eloc, &elen, 1) != -1) 112 - printk(KERN_ERR "udf_truncate_tail_extent(): " 113 - "Extent after EOF in inode %u.\n", 114 - (unsigned)inode->i_ino); 110 + udf_err(inode->i_sb, 111 + "Extent after EOF in inode %u\n", 112 + (unsigned)inode->i_ino); 115 113 break; 116 114 } 117 115 }
+19 -19
fs/udf/udfdecl.h
··· 1 1 #ifndef __UDF_DECL_H 2 2 #define __UDF_DECL_H 3 3 4 + #define pr_fmt(fmt) "UDF-fs: " fmt 5 + 4 6 #include "ecma_167.h" 5 7 #include "osta_udf.h" 6 8 ··· 18 16 #define UDF_PREALLOCATE 19 17 #define UDF_DEFAULT_PREALLOC_BLOCKS 8 20 18 21 - #undef UDFFS_DEBUG 22 - 23 - #ifdef UDFFS_DEBUG 24 - #define udf_debug(f, a...) \ 25 - do { \ 26 - printk(KERN_DEBUG "UDF-fs DEBUG %s:%d:%s: ", \ 27 - __FILE__, __LINE__, __func__); \ 28 - printk(f, ##a); \ 29 - } while (0) 30 - #else 31 - #define udf_debug(f, a...) /**/ 32 - #endif 19 + __attribute__((format(printf, 3, 4))) 20 + extern void _udf_err(struct super_block *sb, const char *function, 21 + const char *fmt, ...); 22 + #define udf_err(sb, fmt, ...) \ 23 + _udf_err(sb, __func__, fmt, ##__VA_ARGS__) 33 24 34 25 __attribute__((format(printf, 3, 4))) 35 26 extern void _udf_warn(struct super_block *sb, const char *function, ··· 30 35 #define udf_warn(sb, fmt, ...) \ 31 36 _udf_warn(sb, __func__, fmt, ##__VA_ARGS__) 32 37 33 - __attribute__((format(printf, 3, 4))) 34 - extern void _udf_err(struct super_block *sb, const char *function, 35 - const char *fmt, ...); 36 - #define udf_err(sb, fmt, ...) \ 37 - _udf_err(sb, __func__, fmt, ##__VA_ARGS__) 38 + #define udf_info(fmt, ...) \ 39 + pr_info("INFO " fmt, ##__VA_ARGS__) 38 40 39 - #define udf_info(f, a...) \ 40 - printk(KERN_INFO "UDF-fs INFO " f, ##a); 41 + #undef UDFFS_DEBUG 42 + 43 + #ifdef UDFFS_DEBUG 44 + #define udf_debug(fmt, ...) \ 45 + printk(KERN_DEBUG pr_fmt("%s:%d:%s: " fmt), \ 46 + __FILE__, __LINE__, __func__, ##__VA_ARGS__) 47 + #else 48 + #define udf_debug(fmt, ...) \ 49 + no_printk(fmt, ##__VA_ARGS__) 50 + #endif 41 51 42 52 #define udf_fixed_to_variable(x) ( ( ( (x) >> 5 ) * 39 ) + ( (x) & 0x0000001F ) ) 43 53 #define udf_variable_to_fixed(x) ( ( ( (x) / 39 ) << 5 ) + ( (x) % 39 ) )
+2 -1
fs/udf/udftime.c
··· 34 34 * http://www.boulder.nist.gov/timefreq/pubs/bulletin/leapsecond.htm 35 35 */ 36 36 37 + #include "udfdecl.h" 38 + 37 39 #include <linux/types.h> 38 40 #include <linux/kernel.h> 39 - #include "udfdecl.h" 40 41 41 42 #define EPOCH_YEAR 1970 42 43
+3 -3
fs/udf/unicode.c
··· 114 114 cmp_id = ocu_i->u_cmpID; 115 115 if (cmp_id != 8 && cmp_id != 16) { 116 116 memset(utf_o, 0, sizeof(struct ustr)); 117 - printk(KERN_ERR "udf: unknown compression code (%d) stri=%s\n", 117 + pr_err("unknown compression code (%d) stri=%s\n", 118 118 cmp_id, ocu_i->u_name); 119 119 return 0; 120 120 } ··· 242 242 if (utf_cnt) { 243 243 error_out: 244 244 ocu[++u_len] = '?'; 245 - printk(KERN_DEBUG "udf: bad UTF-8 character\n"); 245 + printk(KERN_DEBUG pr_fmt("bad UTF-8 character\n")); 246 246 } 247 247 248 248 ocu[length - 1] = (uint8_t)u_len + 1; ··· 267 267 cmp_id = ocu_i->u_cmpID; 268 268 if (cmp_id != 8 && cmp_id != 16) { 269 269 memset(utf_o, 0, sizeof(struct ustr)); 270 - printk(KERN_ERR "udf: unknown compression code (%d) stri=%s\n", 270 + pr_err("unknown compression code (%d) stri=%s\n", 271 271 cmp_id, ocu_i->u_name); 272 272 return 0; 273 273 }