aboutsummaryrefslogtreecommitdiffstats
path: root/fs/fat/inode.c
diff options
context:
space:
mode:
Diffstat (limited to 'fs/fat/inode.c')
-rw-r--r--fs/fat/inode.c67
1 files changed, 33 insertions, 34 deletions
diff --git a/fs/fat/inode.c b/fs/fat/inode.c
index c27704dc485e..7a6c819893f2 100644
--- a/fs/fat/inode.c
+++ b/fs/fat/inode.c
@@ -619,8 +619,8 @@ retry:
619 619
620 bh = sb_bread(sb, i_pos >> sbi->dir_per_block_bits); 620 bh = sb_bread(sb, i_pos >> sbi->dir_per_block_bits);
621 if (!bh) { 621 if (!bh) {
622 printk(KERN_ERR "FAT: unable to read inode block " 622 fat_msg(sb, KERN_ERR, "unable to read inode block "
623 "for updating (i_pos %lld)\n", i_pos); 623 "for updating (i_pos %lld)", i_pos);
624 return -EIO; 624 return -EIO;
625 } 625 }
626 spin_lock(&sbi->inode_hash_lock); 626 spin_lock(&sbi->inode_hash_lock);
@@ -976,8 +976,8 @@ static const match_table_t vfat_tokens = {
976 {Opt_err, NULL} 976 {Opt_err, NULL}
977}; 977};
978 978
979static int parse_options(char *options, int is_vfat, int silent, int *debug, 979static int parse_options(struct super_block *sb, char *options, int is_vfat,
980 struct fat_mount_options *opts) 980 int silent, int *debug, struct fat_mount_options *opts)
981{ 981{
982 char *p; 982 char *p;
983 substring_t args[MAX_OPT_ARGS]; 983 substring_t args[MAX_OPT_ARGS];
@@ -1168,15 +1168,15 @@ static int parse_options(char *options, int is_vfat, int silent, int *debug,
1168 1168
1169 /* obsolete mount options */ 1169 /* obsolete mount options */
1170 case Opt_obsolate: 1170 case Opt_obsolate:
1171 printk(KERN_INFO "FAT: \"%s\" option is obsolete, " 1171 fat_msg(sb, KERN_INFO, "\"%s\" option is obsolete, "
1172 "not supported now\n", p); 1172 "not supported now", p);
1173 break; 1173 break;
1174 /* unknown option */ 1174 /* unknown option */
1175 default: 1175 default:
1176 if (!silent) { 1176 if (!silent) {
1177 printk(KERN_ERR 1177 fat_msg(sb, KERN_ERR,
1178 "FAT: Unrecognized mount option \"%s\" " 1178 "Unrecognized mount option \"%s\" "
1179 "or missing value\n", p); 1179 "or missing value", p);
1180 } 1180 }
1181 return -EINVAL; 1181 return -EINVAL;
1182 } 1182 }
@@ -1185,7 +1185,7 @@ static int parse_options(char *options, int is_vfat, int silent, int *debug,
1185out: 1185out:
1186 /* UTF-8 doesn't provide FAT semantics */ 1186 /* UTF-8 doesn't provide FAT semantics */
1187 if (!strcmp(opts->iocharset, "utf8")) { 1187 if (!strcmp(opts->iocharset, "utf8")) {
1188 printk(KERN_ERR "FAT: utf8 is not a recommended IO charset" 1188 fat_msg(sb, KERN_ERR, "utf8 is not a recommended IO charset"
1189 " for FAT filesystems, filesystem will be " 1189 " for FAT filesystems, filesystem will be "
1190 "case sensitive!\n"); 1190 "case sensitive!\n");
1191 } 1191 }
@@ -1270,7 +1270,7 @@ int fat_fill_super(struct super_block *sb, void *data, int silent, int isvfat,
1270 ratelimit_state_init(&sbi->ratelimit, DEFAULT_RATELIMIT_INTERVAL, 1270 ratelimit_state_init(&sbi->ratelimit, DEFAULT_RATELIMIT_INTERVAL,
1271 DEFAULT_RATELIMIT_BURST); 1271 DEFAULT_RATELIMIT_BURST);
1272 1272
1273 error = parse_options(data, isvfat, silent, &debug, &sbi->options); 1273 error = parse_options(sb, data, isvfat, silent, &debug, &sbi->options);
1274 if (error) 1274 if (error)
1275 goto out_fail; 1275 goto out_fail;
1276 1276
@@ -1280,20 +1280,20 @@ int fat_fill_super(struct super_block *sb, void *data, int silent, int isvfat,
1280 sb_min_blocksize(sb, 512); 1280 sb_min_blocksize(sb, 512);
1281 bh = sb_bread(sb, 0); 1281 bh = sb_bread(sb, 0);
1282 if (bh == NULL) { 1282 if (bh == NULL) {
1283 printk(KERN_ERR "FAT: unable to read boot sector\n"); 1283 fat_msg(sb, KERN_ERR, "unable to read boot sector");
1284 goto out_fail; 1284 goto out_fail;
1285 } 1285 }
1286 1286
1287 b = (struct fat_boot_sector *) bh->b_data; 1287 b = (struct fat_boot_sector *) bh->b_data;
1288 if (!b->reserved) { 1288 if (!b->reserved) {
1289 if (!silent) 1289 if (!silent)
1290 printk(KERN_ERR "FAT: bogus number of reserved sectors\n"); 1290 fat_msg(sb, KERN_ERR, "bogus number of reserved sectors");
1291 brelse(bh); 1291 brelse(bh);
1292 goto out_invalid; 1292 goto out_invalid;
1293 } 1293 }
1294 if (!b->fats) { 1294 if (!b->fats) {
1295 if (!silent) 1295 if (!silent)
1296 printk(KERN_ERR "FAT: bogus number of FAT structure\n"); 1296 fat_msg(sb, KERN_ERR, "bogus number of FAT structure");
1297 brelse(bh); 1297 brelse(bh);
1298 goto out_invalid; 1298 goto out_invalid;
1299 } 1299 }
@@ -1306,7 +1306,7 @@ int fat_fill_super(struct super_block *sb, void *data, int silent, int isvfat,
1306 media = b->media; 1306 media = b->media;
1307 if (!fat_valid_media(media)) { 1307 if (!fat_valid_media(media)) {
1308 if (!silent) 1308 if (!silent)
1309 printk(KERN_ERR "FAT: invalid media value (0x%02x)\n", 1309 fat_msg(sb, KERN_ERR, "invalid media value (0x%02x)",
1310 media); 1310 media);
1311 brelse(bh); 1311 brelse(bh);
1312 goto out_invalid; 1312 goto out_invalid;
@@ -1316,7 +1316,7 @@ int fat_fill_super(struct super_block *sb, void *data, int silent, int isvfat,
1316 || (logical_sector_size < 512) 1316 || (logical_sector_size < 512)
1317 || (logical_sector_size > 4096)) { 1317 || (logical_sector_size > 4096)) {
1318 if (!silent) 1318 if (!silent)
1319 printk(KERN_ERR "FAT: bogus logical sector size %u\n", 1319 fat_msg(sb, KERN_ERR, "bogus logical sector size %u",
1320 logical_sector_size); 1320 logical_sector_size);
1321 brelse(bh); 1321 brelse(bh);
1322 goto out_invalid; 1322 goto out_invalid;
@@ -1324,15 +1324,15 @@ int fat_fill_super(struct super_block *sb, void *data, int silent, int isvfat,
1324 sbi->sec_per_clus = b->sec_per_clus; 1324 sbi->sec_per_clus = b->sec_per_clus;
1325 if (!is_power_of_2(sbi->sec_per_clus)) { 1325 if (!is_power_of_2(sbi->sec_per_clus)) {
1326 if (!silent) 1326 if (!silent)
1327 printk(KERN_ERR "FAT: bogus sectors per cluster %u\n", 1327 fat_msg(sb, KERN_ERR, "bogus sectors per cluster %u",
1328 sbi->sec_per_clus); 1328 sbi->sec_per_clus);
1329 brelse(bh); 1329 brelse(bh);
1330 goto out_invalid; 1330 goto out_invalid;
1331 } 1331 }
1332 1332
1333 if (logical_sector_size < sb->s_blocksize) { 1333 if (logical_sector_size < sb->s_blocksize) {
1334 printk(KERN_ERR "FAT: logical sector size too small for device" 1334 fat_msg(sb, KERN_ERR, "logical sector size too small for device"
1335 " (logical sector size = %u)\n", logical_sector_size); 1335 " (logical sector size = %u)", logical_sector_size);
1336 brelse(bh); 1336 brelse(bh);
1337 goto out_fail; 1337 goto out_fail;
1338 } 1338 }
@@ -1340,14 +1340,14 @@ int fat_fill_super(struct super_block *sb, void *data, int silent, int isvfat,
1340 brelse(bh); 1340 brelse(bh);
1341 1341
1342 if (!sb_set_blocksize(sb, logical_sector_size)) { 1342 if (!sb_set_blocksize(sb, logical_sector_size)) {
1343 printk(KERN_ERR "FAT: unable to set blocksize %u\n", 1343 fat_msg(sb, KERN_ERR, "unable to set blocksize %u",
1344 logical_sector_size); 1344 logical_sector_size);
1345 goto out_fail; 1345 goto out_fail;
1346 } 1346 }
1347 bh = sb_bread(sb, 0); 1347 bh = sb_bread(sb, 0);
1348 if (bh == NULL) { 1348 if (bh == NULL) {
1349 printk(KERN_ERR "FAT: unable to read boot sector" 1349 fat_msg(sb, KERN_ERR, "unable to read boot sector"
1350 " (logical sector size = %lu)\n", 1350 " (logical sector size = %lu)",
1351 sb->s_blocksize); 1351 sb->s_blocksize);
1352 goto out_fail; 1352 goto out_fail;
1353 } 1353 }
@@ -1383,16 +1383,16 @@ int fat_fill_super(struct super_block *sb, void *data, int silent, int isvfat,
1383 1383
1384 fsinfo_bh = sb_bread(sb, sbi->fsinfo_sector); 1384 fsinfo_bh = sb_bread(sb, sbi->fsinfo_sector);
1385 if (fsinfo_bh == NULL) { 1385 if (fsinfo_bh == NULL) {
1386 printk(KERN_ERR "FAT: bread failed, FSINFO block" 1386 fat_msg(sb, KERN_ERR, "bread failed, FSINFO block"
1387 " (sector = %lu)\n", sbi->fsinfo_sector); 1387 " (sector = %lu)", sbi->fsinfo_sector);
1388 brelse(bh); 1388 brelse(bh);
1389 goto out_fail; 1389 goto out_fail;
1390 } 1390 }
1391 1391
1392 fsinfo = (struct fat_boot_fsinfo *)fsinfo_bh->b_data; 1392 fsinfo = (struct fat_boot_fsinfo *)fsinfo_bh->b_data;
1393 if (!IS_FSINFO(fsinfo)) { 1393 if (!IS_FSINFO(fsinfo)) {
1394 printk(KERN_WARNING "FAT: Invalid FSINFO signature: " 1394 fat_msg(sb, KERN_WARNING, "Invalid FSINFO signature: "
1395 "0x%08x, 0x%08x (sector = %lu)\n", 1395 "0x%08x, 0x%08x (sector = %lu)",
1396 le32_to_cpu(fsinfo->signature1), 1396 le32_to_cpu(fsinfo->signature1),
1397 le32_to_cpu(fsinfo->signature2), 1397 le32_to_cpu(fsinfo->signature2),
1398 sbi->fsinfo_sector); 1398 sbi->fsinfo_sector);
@@ -1413,8 +1413,8 @@ int fat_fill_super(struct super_block *sb, void *data, int silent, int isvfat,
1413 sbi->dir_entries = get_unaligned_le16(&b->dir_entries); 1413 sbi->dir_entries = get_unaligned_le16(&b->dir_entries);
1414 if (sbi->dir_entries & (sbi->dir_per_block - 1)) { 1414 if (sbi->dir_entries & (sbi->dir_per_block - 1)) {
1415 if (!silent) 1415 if (!silent)
1416 printk(KERN_ERR "FAT: bogus directroy-entries per block" 1416 fat_msg(sb, KERN_ERR, "bogus directroy-entries per block"
1417 " (%u)\n", sbi->dir_entries); 1417 " (%u)", sbi->dir_entries);
1418 brelse(bh); 1418 brelse(bh);
1419 goto out_invalid; 1419 goto out_invalid;
1420 } 1420 }
@@ -1436,7 +1436,7 @@ int fat_fill_super(struct super_block *sb, void *data, int silent, int isvfat,
1436 total_clusters = min(total_clusters, fat_clusters - FAT_START_ENT); 1436 total_clusters = min(total_clusters, fat_clusters - FAT_START_ENT);
1437 if (total_clusters > MAX_FAT(sb)) { 1437 if (total_clusters > MAX_FAT(sb)) {
1438 if (!silent) 1438 if (!silent)
1439 printk(KERN_ERR "FAT: count of clusters too big (%u)\n", 1439 fat_msg(sb, KERN_ERR, "count of clusters too big (%u)",
1440 total_clusters); 1440 total_clusters);
1441 brelse(bh); 1441 brelse(bh);
1442 goto out_invalid; 1442 goto out_invalid;
@@ -1469,7 +1469,7 @@ int fat_fill_super(struct super_block *sb, void *data, int silent, int isvfat,
1469 sprintf(buf, "cp%d", sbi->options.codepage); 1469 sprintf(buf, "cp%d", sbi->options.codepage);
1470 sbi->nls_disk = load_nls(buf); 1470 sbi->nls_disk = load_nls(buf);
1471 if (!sbi->nls_disk) { 1471 if (!sbi->nls_disk) {
1472 printk(KERN_ERR "FAT: codepage %s not found\n", buf); 1472 fat_msg(sb, KERN_ERR, "codepage %s not found", buf);
1473 goto out_fail; 1473 goto out_fail;
1474 } 1474 }
1475 1475
@@ -1477,7 +1477,7 @@ int fat_fill_super(struct super_block *sb, void *data, int silent, int isvfat,
1477 if (sbi->options.isvfat) { 1477 if (sbi->options.isvfat) {
1478 sbi->nls_io = load_nls(sbi->options.iocharset); 1478 sbi->nls_io = load_nls(sbi->options.iocharset);
1479 if (!sbi->nls_io) { 1479 if (!sbi->nls_io) {
1480 printk(KERN_ERR "FAT: IO charset %s not found\n", 1480 fat_msg(sb, KERN_ERR, "IO charset %s not found",
1481 sbi->options.iocharset); 1481 sbi->options.iocharset);
1482 goto out_fail; 1482 goto out_fail;
1483 } 1483 }
@@ -1501,7 +1501,7 @@ int fat_fill_super(struct super_block *sb, void *data, int silent, int isvfat,
1501 insert_inode_hash(root_inode); 1501 insert_inode_hash(root_inode);
1502 sb->s_root = d_alloc_root(root_inode); 1502 sb->s_root = d_alloc_root(root_inode);
1503 if (!sb->s_root) { 1503 if (!sb->s_root) {
1504 printk(KERN_ERR "FAT: get root inode failed\n"); 1504 fat_msg(sb, KERN_ERR, "get root inode failed");
1505 goto out_fail; 1505 goto out_fail;
1506 } 1506 }
1507 1507
@@ -1510,8 +1510,7 @@ int fat_fill_super(struct super_block *sb, void *data, int silent, int isvfat,
1510out_invalid: 1510out_invalid:
1511 error = -EINVAL; 1511 error = -EINVAL;
1512 if (!silent) 1512 if (!silent)
1513 printk(KERN_INFO "VFS: Can't find a valid FAT filesystem" 1513 fat_msg(sb, KERN_INFO, "Can't find a valid FAT filesystem");
1514 " on dev %s.\n", sb->s_id);
1515 1514
1516out_fail: 1515out_fail:
1517 if (fat_inode) 1516 if (fat_inode)