aboutsummaryrefslogtreecommitdiffstats
path: root/fs/udf/super.c
diff options
context:
space:
mode:
Diffstat (limited to 'fs/udf/super.c')
-rw-r--r--fs/udf/super.c51
1 files changed, 19 insertions, 32 deletions
diff --git a/fs/udf/super.c b/fs/udf/super.c
index f175c9bf3b9c..4360c7a05743 100644
--- a/fs/udf/super.c
+++ b/fs/udf/super.c
@@ -913,8 +913,7 @@ static int udf_load_partdesc(struct super_block *sb, struct buffer_head *bh)
913 UDF_SB_PARTMAPS(sb)[i].s_uspace.s_table = 913 UDF_SB_PARTMAPS(sb)[i].s_uspace.s_table =
914 udf_iget(sb, loc); 914 udf_iget(sb, loc);
915 if (!UDF_SB_PARTMAPS(sb)[i].s_uspace.s_table) { 915 if (!UDF_SB_PARTMAPS(sb)[i].s_uspace.s_table) {
916 udf_debug("cannot load unallocSpaceTable (part %d)\n", 916 udf_debug("cannot load unallocSpaceTable (part %d)\n", i);
917 i);
918 return 1; 917 return 1;
919 } 918 }
920 UDF_SB_PARTFLAGS(sb,i) |= UDF_PART_FLAG_UNALLOC_TABLE; 919 UDF_SB_PARTFLAGS(sb,i) |= UDF_PART_FLAG_UNALLOC_TABLE;
@@ -944,8 +943,7 @@ static int udf_load_partdesc(struct super_block *sb, struct buffer_head *bh)
944 UDF_SB_PARTMAPS(sb)[i].s_fspace.s_table = 943 UDF_SB_PARTMAPS(sb)[i].s_fspace.s_table =
945 udf_iget(sb, loc); 944 udf_iget(sb, loc);
946 if (!UDF_SB_PARTMAPS(sb)[i].s_fspace.s_table) { 945 if (!UDF_SB_PARTMAPS(sb)[i].s_fspace.s_table) {
947 udf_debug("cannot load freedSpaceTable (part %d)\n", 946 udf_debug("cannot load freedSpaceTable (part %d)\n", i);
948 i);
949 return 1; 947 return 1;
950 } 948 }
951 UDF_SB_PARTFLAGS(sb,i) |= UDF_PART_FLAG_FREED_TABLE; 949 UDF_SB_PARTFLAGS(sb,i) |= UDF_PART_FLAG_FREED_TABLE;
@@ -1293,19 +1291,16 @@ static int udf_load_partition(struct super_block *sb, kernel_lb_addr *fileset)
1293 1291
1294 if (!UDF_SB_LASTBLOCK(sb)) { 1292 if (!UDF_SB_LASTBLOCK(sb)) {
1295 udf_debug("Unable to determine Lastblock (For " 1293 udf_debug("Unable to determine Lastblock (For "
1296 "Virtual Partition)\n"); 1294 "Virtual Partition)\n");
1297 return 1; 1295 return 1;
1298 } 1296 }
1299 1297
1300 for (j = 0; j < UDF_SB_NUMPARTS(sb); j++) { 1298 for (j = 0; j < UDF_SB_NUMPARTS(sb); j++) {
1301 if (j != i && UDF_SB_PARTVSN(sb, i) == 1299 if (j != i &&
1302 UDF_SB_PARTVSN(sb, j) && 1300 UDF_SB_PARTVSN(sb, i) == UDF_SB_PARTVSN(sb, j) &&
1303 UDF_SB_PARTNUM(sb, i) == 1301 UDF_SB_PARTNUM(sb, i) == UDF_SB_PARTNUM(sb, j)) {
1304 UDF_SB_PARTNUM(sb, j)) {
1305 ino.partitionReferenceNum = j; 1302 ino.partitionReferenceNum = j;
1306 ino.logicalBlockNum = 1303 ino.logicalBlockNum = UDF_SB_LASTBLOCK(sb) - UDF_SB_PARTROOT(sb, j);
1307 UDF_SB_LASTBLOCK(sb) -
1308 UDF_SB_PARTROOT(sb, j);
1309 break; 1304 break;
1310 } 1305 }
1311 } 1306 }
@@ -1318,9 +1313,9 @@ static int udf_load_partition(struct super_block *sb, kernel_lb_addr *fileset)
1318 1313
1319 if (UDF_SB_PARTTYPE(sb, i) == UDF_VIRTUAL_MAP15) { 1314 if (UDF_SB_PARTTYPE(sb, i) == UDF_VIRTUAL_MAP15) {
1320 UDF_SB_TYPEVIRT(sb, i).s_start_offset = 1315 UDF_SB_TYPEVIRT(sb, i).s_start_offset =
1321 udf_ext0_offset(UDF_SB_VAT(sb)); 1316 udf_ext0_offset(UDF_SB_VAT(sb));
1322 UDF_SB_TYPEVIRT(sb, i).s_num_entries = 1317 UDF_SB_TYPEVIRT(sb, i).s_num_entries =
1323 (UDF_SB_VAT(sb)->i_size - 36) >> 2; 1318 (UDF_SB_VAT(sb)->i_size - 36) >> 2;
1324 } else if (UDF_SB_PARTTYPE(sb, i) == UDF_VIRTUAL_MAP20) { 1319 } else if (UDF_SB_PARTTYPE(sb, i) == UDF_VIRTUAL_MAP20) {
1325 struct buffer_head *bh = NULL; 1320 struct buffer_head *bh = NULL;
1326 uint32_t pos; 1321 uint32_t pos;
@@ -1330,19 +1325,15 @@ static int udf_load_partition(struct super_block *sb, kernel_lb_addr *fileset)
1330 if (!bh) 1325 if (!bh)
1331 return 1; 1326 return 1;
1332 UDF_SB_TYPEVIRT(sb, i).s_start_offset = 1327 UDF_SB_TYPEVIRT(sb, i).s_start_offset =
1333 le16_to_cpu(((struct 1328 le16_to_cpu(((struct virtualAllocationTable20 *)bh->b_data +
1334 virtualAllocationTable20 *)bh->b_data + 1329 udf_ext0_offset(UDF_SB_VAT(sb)))->lengthHeader) +
1335 udf_ext0_offset(UDF_SB_VAT(sb)))-> 1330 udf_ext0_offset(UDF_SB_VAT(sb));
1336 lengthHeader) + 1331 UDF_SB_TYPEVIRT(sb, i).s_num_entries = (UDF_SB_VAT(sb)->i_size -
1337 udf_ext0_offset(UDF_SB_VAT(sb)); 1332 UDF_SB_TYPEVIRT(sb, i).s_start_offset) >> 2;
1338 UDF_SB_TYPEVIRT(sb, i).s_num_entries =
1339 (UDF_SB_VAT(sb)->i_size -
1340 UDF_SB_TYPEVIRT(sb, i).s_start_offset) >> 2;
1341 brelse(bh); 1333 brelse(bh);
1342 } 1334 }
1343 UDF_SB_PARTROOT(sb, i) = udf_get_pblock(sb, 0, i, 0); 1335 UDF_SB_PARTROOT(sb, i) = udf_get_pblock(sb, 0, i, 0);
1344 UDF_SB_PARTLEN(sb, i) = UDF_SB_PARTLEN(sb, 1336 UDF_SB_PARTLEN(sb, i) = UDF_SB_PARTLEN(sb, ino.partitionReferenceNum);
1345 ino.partitionReferenceNum);
1346 } 1337 }
1347 } 1338 }
1348 return 0; 1339 return 0;
@@ -1357,21 +1348,17 @@ static void udf_open_lvid(struct super_block *sb)
1357 UDF_SB_LVIDIU(sb)->impIdent.identSuffix[0] = UDF_OS_CLASS_UNIX; 1348 UDF_SB_LVIDIU(sb)->impIdent.identSuffix[0] = UDF_OS_CLASS_UNIX;
1358 UDF_SB_LVIDIU(sb)->impIdent.identSuffix[1] = UDF_OS_ID_LINUX; 1349 UDF_SB_LVIDIU(sb)->impIdent.identSuffix[1] = UDF_OS_ID_LINUX;
1359 if (udf_time_to_stamp(&cpu_time, CURRENT_TIME)) 1350 if (udf_time_to_stamp(&cpu_time, CURRENT_TIME))
1360 UDF_SB_LVID(sb)->recordingDateAndTime = 1351 UDF_SB_LVID(sb)->recordingDateAndTime = cpu_to_lets(cpu_time);
1361 cpu_to_lets(cpu_time);
1362 UDF_SB_LVID(sb)->integrityType = LVID_INTEGRITY_TYPE_OPEN; 1352 UDF_SB_LVID(sb)->integrityType = LVID_INTEGRITY_TYPE_OPEN;
1363 1353
1364 UDF_SB_LVID(sb)->descTag.descCRC = 1354 UDF_SB_LVID(sb)->descTag.descCRC = cpu_to_le16(udf_crc((char *)UDF_SB_LVID(sb) + sizeof(tag),
1365 cpu_to_le16(udf_crc((char *)UDF_SB_LVID(sb) + sizeof(tag), 1355 le16_to_cpu(UDF_SB_LVID(sb)->descTag.descCRCLength), 0));
1366 le16_to_cpu(UDF_SB_LVID(sb)->descTag.
1367 descCRCLength), 0));
1368 1356
1369 UDF_SB_LVID(sb)->descTag.tagChecksum = 0; 1357 UDF_SB_LVID(sb)->descTag.tagChecksum = 0;
1370 for (i = 0; i < 16; i++) 1358 for (i = 0; i < 16; i++)
1371 if (i != 4) 1359 if (i != 4)
1372 UDF_SB_LVID(sb)->descTag.tagChecksum += 1360 UDF_SB_LVID(sb)->descTag.tagChecksum +=
1373 ((uint8_t *) & 1361 ((uint8_t *) &(UDF_SB_LVID(sb)->descTag))[i];
1374 (UDF_SB_LVID(sb)->descTag))[i];
1375 1362
1376 mark_buffer_dirty(UDF_SB_LVIDBH(sb)); 1363 mark_buffer_dirty(UDF_SB_LVIDBH(sb));
1377 } 1364 }