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