aboutsummaryrefslogtreecommitdiffstats
path: root/fs/udf/super.c
diff options
context:
space:
mode:
authorMarcin Slusarz <marcin.slusarz@gmail.com>2008-02-08 07:20:36 -0500
committerLinus Torvalds <torvalds@woody.linux-foundation.org>2008-02-08 12:22:35 -0500
commit4b11111aba6c80cc2969fd1806d2a869bfc9f357 (patch)
tree57b72a1ca58859dc6a9e47d647f29cebb9bcf7e0 /fs/udf/super.c
parentbd45a420f93d18c91115f3f0568dd6a2555aa15a (diff)
udf: fix coding style
fix coding style errors found by checkpatch: - assignments in if conditions - braces {} around single statement blocks - no spaces after commas - printks without KERN_* - lines longer than 80 characters - spaces between "type *" and variable name before: 192 errors, 561 warnings, 8987 lines checked after: 1 errors, 38 warnings, 9468 lines checked Signed-off-by: Marcin Slusarz <marcin.slusarz@gmail.com> Cc: Jan Kara <jack@suse.cz> Cc: Christoph Hellwig <hch@lst.de> Signed-off-by: Andrew Morton <akpm@linux-foundation.org> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Diffstat (limited to 'fs/udf/super.c')
-rw-r--r--fs/udf/super.c377
1 files changed, 243 insertions, 134 deletions
diff --git a/fs/udf/super.c b/fs/udf/super.c
index 3cd5a855033b..7f75a949e152 100644
--- a/fs/udf/super.c
+++ b/fs/udf/super.c
@@ -98,9 +98,11 @@ static int udf_statfs(struct dentry *, struct kstatfs *);
98 98
99struct logicalVolIntegrityDescImpUse *udf_sb_lvidiu(struct udf_sb_info *sbi) 99struct logicalVolIntegrityDescImpUse *udf_sb_lvidiu(struct udf_sb_info *sbi)
100{ 100{
101 struct logicalVolIntegrityDesc *lvid = (struct logicalVolIntegrityDesc *)sbi->s_lvid_bh->b_data; 101 struct logicalVolIntegrityDesc *lvid =
102 (struct logicalVolIntegrityDesc *)sbi->s_lvid_bh->b_data;
102 __u32 number_of_partitions = le32_to_cpu(lvid->numOfPartitions); 103 __u32 number_of_partitions = le32_to_cpu(lvid->numOfPartitions);
103 __u32 offset = number_of_partitions * 2 * sizeof(uint32_t)/sizeof(uint8_t); 104 __u32 offset = number_of_partitions * 2 *
105 sizeof(uint32_t)/sizeof(uint8_t);
104 return (struct logicalVolIntegrityDescImpUse *)&(lvid->impUse[offset]); 106 return (struct logicalVolIntegrityDescImpUse *)&(lvid->impUse[offset]);
105} 107}
106 108
@@ -713,16 +715,23 @@ static void udf_find_anchor(struct super_block *sb)
713 lastblock = last[i] - sbi->s_session; 715 lastblock = last[i] - sbi->s_session;
714 sbi->s_anchor[0] = lastblock; 716 sbi->s_anchor[0] = lastblock;
715 sbi->s_anchor[1] = lastblock - 256; 717 sbi->s_anchor[1] = lastblock - 256;
716 } else if (location == udf_variable_to_fixed(last[i]) - sbi->s_session) { 718 } else if (location ==
719 udf_variable_to_fixed(last[i]) -
720 sbi->s_session) {
717 UDF_SET_FLAG(sb, UDF_FLAG_VARCONV); 721 UDF_SET_FLAG(sb, UDF_FLAG_VARCONV);
718 lastblock = udf_variable_to_fixed(last[i]) - sbi->s_session; 722 lastblock =
723 udf_variable_to_fixed(last[i]) -
724 sbi->s_session;
719 sbi->s_anchor[0] = lastblock; 725 sbi->s_anchor[0] = lastblock;
720 sbi->s_anchor[1] = lastblock - 256 - sbi->s_session; 726 sbi->s_anchor[1] = lastblock - 256 -
727 sbi->s_session;
721 } else { 728 } else {
722 udf_debug("Anchor found at block %d, location mismatch %d.\n", 729 udf_debug("Anchor found at block %d, "
730 "location mismatch %d.\n",
723 last[i], location); 731 last[i], location);
724 } 732 }
725 } else if (ident == TAG_IDENT_FE || ident == TAG_IDENT_EFE) { 733 } else if (ident == TAG_IDENT_FE ||
734 ident == TAG_IDENT_EFE) {
726 lastblock = last[i]; 735 lastblock = last[i];
727 sbi->s_anchor[3] = 512; 736 sbi->s_anchor[3] = 512;
728 } else { 737 } else {
@@ -731,31 +740,40 @@ static void udf_find_anchor(struct super_block *sb)
731 bh = sb_bread(sb, last[i] - 256); 740 bh = sb_bread(sb, last[i] - 256);
732 if (bh) { 741 if (bh) {
733 tag *t = (tag *)bh->b_data; 742 tag *t = (tag *)bh->b_data;
734 ident = le16_to_cpu(t->tagIdent); 743 ident = le16_to_cpu(
735 location = le32_to_cpu(t->tagLocation); 744 t->tagIdent);
745 location = le32_to_cpu(
746 t->tagLocation);
736 brelse(bh); 747 brelse(bh);
737 } 748 }
738 } 749 }
739 750
740 if (ident == TAG_IDENT_AVDP && 751 if (ident == TAG_IDENT_AVDP &&
741 location == last[i] - 256 - sbi->s_session) { 752 location == last[i] - 256 -
753 sbi->s_session) {
742 lastblock = last[i]; 754 lastblock = last[i];
743 sbi->s_anchor[1] = last[i] - 256; 755 sbi->s_anchor[1] = last[i] - 256;
744 } else { 756 } else {
745 ident = location = 0; 757 ident = location = 0;
746 if (last[i] >= 312 + sbi->s_session) { 758 if (last[i] >= 312 + sbi->s_session) {
747 bh = sb_bread(sb, last[i] - 312 - sbi->s_session); 759 bh = sb_bread(sb,
760 last[i] - 312 -
761 sbi->s_session);
748 if (bh) { 762 if (bh) {
749 tag *t = (tag *)bh->b_data; 763 tag *t = (tag *)
750 ident = le16_to_cpu(t->tagIdent); 764 bh->b_data;
751 location = le32_to_cpu(t->tagLocation); 765 ident = le16_to_cpu(
766 t->tagIdent);
767 location = le32_to_cpu(
768 t->tagLocation);
752 brelse(bh); 769 brelse(bh);
753 } 770 }
754 } 771 }
755 772
756 if (ident == TAG_IDENT_AVDP && 773 if (ident == TAG_IDENT_AVDP &&
757 location == udf_variable_to_fixed(last[i]) - 256) { 774 location == udf_variable_to_fixed(last[i]) - 256) {
758 UDF_SET_FLAG(sb, UDF_FLAG_VARCONV); 775 UDF_SET_FLAG(sb,
776 UDF_FLAG_VARCONV);
759 lastblock = udf_variable_to_fixed(last[i]); 777 lastblock = udf_variable_to_fixed(last[i]);
760 sbi->s_anchor[1] = lastblock - 256; 778 sbi->s_anchor[1] = lastblock - 256;
761 } 779 }
@@ -787,7 +805,8 @@ static void udf_find_anchor(struct super_block *sb)
787 else { 805 else {
788 brelse(bh); 806 brelse(bh);
789 if ((ident != TAG_IDENT_AVDP) && 807 if ((ident != TAG_IDENT_AVDP) &&
790 (i || (ident != TAG_IDENT_FE && ident != TAG_IDENT_EFE))) 808 (i || (ident != TAG_IDENT_FE &&
809 ident != TAG_IDENT_EFE)))
791 sbi->s_anchor[i] = 0; 810 sbi->s_anchor[i] = 0;
792 } 811 }
793 } 812 }
@@ -848,11 +867,12 @@ static int udf_find_fileset(struct super_block *sb,
848 case TAG_IDENT_SBD: 867 case TAG_IDENT_SBD:
849 { 868 {
850 struct spaceBitmapDesc *sp; 869 struct spaceBitmapDesc *sp;
851 sp = (struct spaceBitmapDesc *)bh->b_data; 870 sp = (struct spaceBitmapDesc *)
871 bh->b_data;
852 newfileset.logicalBlockNum += 1 + 872 newfileset.logicalBlockNum += 1 +
853 ((le32_to_cpu(sp->numOfBytes) + 873 ((le32_to_cpu(sp->numOfBytes) +
854 sizeof(struct spaceBitmapDesc) - 1) 874 sizeof(struct spaceBitmapDesc)
855 >> sb->s_blocksize_bits); 875 - 1) >> sb->s_blocksize_bits);
856 brelse(bh); 876 brelse(bh);
857 break; 877 break;
858 } 878 }
@@ -908,18 +928,17 @@ static void udf_load_pvoldesc(struct super_block *sb, struct buffer_head *bh)
908 UDF_SB(sb)->s_record_time.tv_nsec = recording_usec * 1000; 928 UDF_SB(sb)->s_record_time.tv_nsec = recording_usec * 1000;
909 } 929 }
910 930
911 if (!udf_build_ustr(&instr, pvoldesc->volIdent, 32)) { 931 if (!udf_build_ustr(&instr, pvoldesc->volIdent, 32))
912 if (udf_CS0toUTF8(&outstr, &instr)) { 932 if (udf_CS0toUTF8(&outstr, &instr)) {
913 strncpy(UDF_SB(sb)->s_volume_ident, outstr.u_name, 933 strncpy(UDF_SB(sb)->s_volume_ident, outstr.u_name,
914 outstr.u_len > 31 ? 31 : outstr.u_len); 934 outstr.u_len > 31 ? 31 : outstr.u_len);
915 udf_debug("volIdent[] = '%s'\n", UDF_SB(sb)->s_volume_ident); 935 udf_debug("volIdent[] = '%s'\n",
936 UDF_SB(sb)->s_volume_ident);
916 } 937 }
917 }
918 938
919 if (!udf_build_ustr(&instr, pvoldesc->volSetIdent, 128)) { 939 if (!udf_build_ustr(&instr, pvoldesc->volSetIdent, 128))
920 if (udf_CS0toUTF8(&outstr, &instr)) 940 if (udf_CS0toUTF8(&outstr, &instr))
921 udf_debug("volSetIdent[] = '%s'\n", outstr.u_name); 941 udf_debug("volSetIdent[] = '%s'\n", outstr.u_name);
922 }
923} 942}
924 943
925static void udf_load_fileset(struct super_block *sb, struct buffer_head *bh, 944static void udf_load_fileset(struct super_block *sb, struct buffer_head *bh,
@@ -987,18 +1006,30 @@ static int udf_load_partdesc(struct super_block *sb, struct buffer_head *bh)
987 for (i = 0; i < sbi->s_partitions; i++) { 1006 for (i = 0; i < sbi->s_partitions; i++) {
988 map = &sbi->s_partmaps[i]; 1007 map = &sbi->s_partmaps[i];
989 udf_debug("Searching map: (%d == %d)\n", 1008 udf_debug("Searching map: (%d == %d)\n",
990 map->s_partition_num, le16_to_cpu(p->partitionNumber)); 1009 map->s_partition_num,
991 if (map->s_partition_num == le16_to_cpu(p->partitionNumber)) { 1010 le16_to_cpu(p->partitionNumber));
992 map->s_partition_len = le32_to_cpu(p->partitionLength); /* blocks */ 1011 if (map->s_partition_num ==
993 map->s_partition_root = le32_to_cpu(p->partitionStartingLocation); 1012 le16_to_cpu(p->partitionNumber)) {
994 if (le32_to_cpu(p->accessType) == PD_ACCESS_TYPE_READ_ONLY) 1013 map->s_partition_len =
995 map->s_partition_flags |= UDF_PART_FLAG_READ_ONLY; 1014 le32_to_cpu(p->partitionLength); /* blocks */
996 if (le32_to_cpu(p->accessType) == PD_ACCESS_TYPE_WRITE_ONCE) 1015 map->s_partition_root =
997 map->s_partition_flags |= UDF_PART_FLAG_WRITE_ONCE; 1016 le32_to_cpu(p->partitionStartingLocation);
998 if (le32_to_cpu(p->accessType) == PD_ACCESS_TYPE_REWRITABLE) 1017 if (le32_to_cpu(p->accessType) ==
999 map->s_partition_flags |= UDF_PART_FLAG_REWRITABLE; 1018 PD_ACCESS_TYPE_READ_ONLY)
1000 if (le32_to_cpu(p->accessType) == PD_ACCESS_TYPE_OVERWRITABLE) 1019 map->s_partition_flags |=
1001 map->s_partition_flags |= UDF_PART_FLAG_OVERWRITABLE; 1020 UDF_PART_FLAG_READ_ONLY;
1021 if (le32_to_cpu(p->accessType) ==
1022 PD_ACCESS_TYPE_WRITE_ONCE)
1023 map->s_partition_flags |=
1024 UDF_PART_FLAG_WRITE_ONCE;
1025 if (le32_to_cpu(p->accessType) ==
1026 PD_ACCESS_TYPE_REWRITABLE)
1027 map->s_partition_flags |=
1028 UDF_PART_FLAG_REWRITABLE;
1029 if (le32_to_cpu(p->accessType) ==
1030 PD_ACCESS_TYPE_OVERWRITABLE)
1031 map->s_partition_flags |=
1032 UDF_PART_FLAG_OVERWRITABLE;
1002 1033
1003 if (!strcmp(p->partitionContents.ident, 1034 if (!strcmp(p->partitionContents.ident,
1004 PD_PARTITION_CONTENTS_NSR02) || 1035 PD_PARTITION_CONTENTS_NSR02) ||
@@ -1006,7 +1037,8 @@ static int udf_load_partdesc(struct super_block *sb, struct buffer_head *bh)
1006 PD_PARTITION_CONTENTS_NSR03)) { 1037 PD_PARTITION_CONTENTS_NSR03)) {
1007 struct partitionHeaderDesc *phd; 1038 struct partitionHeaderDesc *phd;
1008 1039
1009 phd = (struct partitionHeaderDesc *)(p->partitionContentsUse); 1040 phd = (struct partitionHeaderDesc *)
1041 (p->partitionContentsUse);
1010 if (phd->unallocSpaceTable.extLength) { 1042 if (phd->unallocSpaceTable.extLength) {
1011 kernel_lb_addr loc = { 1043 kernel_lb_addr loc = {
1012 .logicalBlockNum = le32_to_cpu(phd->unallocSpaceTable.extPosition), 1044 .logicalBlockNum = le32_to_cpu(phd->unallocSpaceTable.extPosition),
@@ -1019,20 +1051,23 @@ static int udf_load_partdesc(struct super_block *sb, struct buffer_head *bh)
1019 udf_debug("cannot load unallocSpaceTable (part %d)\n", i); 1051 udf_debug("cannot load unallocSpaceTable (part %d)\n", i);
1020 return 1; 1052 return 1;
1021 } 1053 }
1022 map->s_partition_flags |= UDF_PART_FLAG_UNALLOC_TABLE; 1054 map->s_partition_flags |=
1055 UDF_PART_FLAG_UNALLOC_TABLE;
1023 udf_debug("unallocSpaceTable (part %d) @ %ld\n", 1056 udf_debug("unallocSpaceTable (part %d) @ %ld\n",
1024 i, map->s_uspace.s_table->i_ino); 1057 i, map->s_uspace.s_table->i_ino);
1025 } 1058 }
1026 if (phd->unallocSpaceBitmap.extLength) { 1059 if (phd->unallocSpaceBitmap.extLength) {
1027 map->s_uspace.s_bitmap = udf_sb_alloc_bitmap(sb, i); 1060 struct udf_bitmap *bitmap =
1028 if (map->s_uspace.s_bitmap != NULL) { 1061 udf_sb_alloc_bitmap(sb, i);
1029 map->s_uspace.s_bitmap->s_extLength = 1062 map->s_uspace.s_bitmap = bitmap;
1063 if (bitmap != NULL) {
1064 bitmap->s_extLength =
1030 le32_to_cpu(phd->unallocSpaceBitmap.extLength); 1065 le32_to_cpu(phd->unallocSpaceBitmap.extLength);
1031 map->s_uspace.s_bitmap->s_extPosition = 1066 bitmap->s_extPosition =
1032 le32_to_cpu(phd->unallocSpaceBitmap.extPosition); 1067 le32_to_cpu(phd->unallocSpaceBitmap.extPosition);
1033 map->s_partition_flags |= UDF_PART_FLAG_UNALLOC_BITMAP; 1068 map->s_partition_flags |= UDF_PART_FLAG_UNALLOC_BITMAP;
1034 udf_debug("unallocSpaceBitmap (part %d) @ %d\n", 1069 udf_debug("unallocSpaceBitmap (part %d) @ %d\n",
1035 i, map->s_uspace.s_bitmap->s_extPosition); 1070 i, bitmap->s_extPosition);
1036 } 1071 }
1037 } 1072 }
1038 if (phd->partitionIntegrityTable.extLength) 1073 if (phd->partitionIntegrityTable.extLength)
@@ -1049,37 +1084,39 @@ static int udf_load_partdesc(struct super_block *sb, struct buffer_head *bh)
1049 udf_debug("cannot load freedSpaceTable (part %d)\n", i); 1084 udf_debug("cannot load freedSpaceTable (part %d)\n", i);
1050 return 1; 1085 return 1;
1051 } 1086 }
1052 map->s_partition_flags |= UDF_PART_FLAG_FREED_TABLE; 1087 map->s_partition_flags |=
1088 UDF_PART_FLAG_FREED_TABLE;
1053 udf_debug("freedSpaceTable (part %d) @ %ld\n", 1089 udf_debug("freedSpaceTable (part %d) @ %ld\n",
1054 i, map->s_fspace.s_table->i_ino); 1090 i, map->s_fspace.s_table->i_ino);
1055 } 1091 }
1056 if (phd->freedSpaceBitmap.extLength) { 1092 if (phd->freedSpaceBitmap.extLength) {
1057 map->s_fspace.s_bitmap = udf_sb_alloc_bitmap(sb, i); 1093 struct udf_bitmap *bitmap =
1058 if (map->s_fspace.s_bitmap != NULL) { 1094 udf_sb_alloc_bitmap(sb, i);
1059 map->s_fspace.s_bitmap->s_extLength = 1095 map->s_fspace.s_bitmap = bitmap;
1096 if (bitmap != NULL) {
1097 bitmap->s_extLength =
1060 le32_to_cpu(phd->freedSpaceBitmap.extLength); 1098 le32_to_cpu(phd->freedSpaceBitmap.extLength);
1061 map->s_fspace.s_bitmap->s_extPosition = 1099 bitmap->s_extPosition =
1062 le32_to_cpu(phd->freedSpaceBitmap.extPosition); 1100 le32_to_cpu(phd->freedSpaceBitmap.extPosition);
1063 map->s_partition_flags |= UDF_PART_FLAG_FREED_BITMAP; 1101 map->s_partition_flags |= UDF_PART_FLAG_FREED_BITMAP;
1064 udf_debug("freedSpaceBitmap (part %d) @ %d\n", 1102 udf_debug("freedSpaceBitmap (part %d) @ %d\n",
1065 i, map->s_fspace.s_bitmap->s_extPosition); 1103 i, bitmap->s_extPosition);
1066 } 1104 }
1067 } 1105 }
1068 } 1106 }
1069 break; 1107 break;
1070 } 1108 }
1071 } 1109 }
1072 if (i == sbi->s_partitions) { 1110 if (i == sbi->s_partitions)
1073 udf_debug("Partition (%d) not found in partition map\n", 1111 udf_debug("Partition (%d) not found in partition map\n",
1074 le16_to_cpu(p->partitionNumber)); 1112 le16_to_cpu(p->partitionNumber));
1075 } else { 1113 else
1076 udf_debug("Partition (%d:%d type %x) starts at physical %d, " 1114 udf_debug("Partition (%d:%d type %x) starts at physical %d, "
1077 "block length %d\n", 1115 "block length %d\n",
1078 le16_to_cpu(p->partitionNumber), i, 1116 le16_to_cpu(p->partitionNumber), i,
1079 map->s_partition_type, 1117 map->s_partition_type,
1080 map->s_partition_root, 1118 map->s_partition_root,
1081 map->s_partition_len); 1119 map->s_partition_len);
1082 }
1083 return 0; 1120 return 0;
1084} 1121}
1085 1122
@@ -1090,6 +1127,7 @@ static int udf_load_logicalvol(struct super_block *sb, struct buffer_head *bh,
1090 int i, j, offset; 1127 int i, j, offset;
1091 uint8_t type; 1128 uint8_t type;
1092 struct udf_sb_info *sbi = UDF_SB(sb); 1129 struct udf_sb_info *sbi = UDF_SB(sb);
1130 struct genericPartitionMap *gpm;
1093 1131
1094 lvd = (struct logicalVolDesc *)bh->b_data; 1132 lvd = (struct logicalVolDesc *)bh->b_data;
1095 1133
@@ -1099,43 +1137,71 @@ static int udf_load_logicalvol(struct super_block *sb, struct buffer_head *bh,
1099 1137
1100 for (i = 0, offset = 0; 1138 for (i = 0, offset = 0;
1101 i < sbi->s_partitions && offset < le32_to_cpu(lvd->mapTableLength); 1139 i < sbi->s_partitions && offset < le32_to_cpu(lvd->mapTableLength);
1102 i++, offset += ((struct genericPartitionMap *)&(lvd->partitionMaps[offset]))->partitionMapLength) { 1140 i++, offset += gpm->partitionMapLength) {
1103 struct udf_part_map *map = &sbi->s_partmaps[i]; 1141 struct udf_part_map *map = &sbi->s_partmaps[i];
1104 type = ((struct genericPartitionMap *)&(lvd->partitionMaps[offset]))->partitionMapType; 1142 gpm = (struct genericPartitionMap *)
1143 &(lvd->partitionMaps[offset]);
1144 type = gpm->partitionMapType;
1105 if (type == 1) { 1145 if (type == 1) {
1106 struct genericPartitionMap1 *gpm1 = (struct genericPartitionMap1 *)&(lvd->partitionMaps[offset]); 1146 struct genericPartitionMap1 *gpm1 =
1147 (struct genericPartitionMap1 *)gpm;
1107 map->s_partition_type = UDF_TYPE1_MAP15; 1148 map->s_partition_type = UDF_TYPE1_MAP15;
1108 map->s_volumeseqnum = le16_to_cpu(gpm1->volSeqNum); 1149 map->s_volumeseqnum = le16_to_cpu(gpm1->volSeqNum);
1109 map->s_partition_num = le16_to_cpu(gpm1->partitionNum); 1150 map->s_partition_num = le16_to_cpu(gpm1->partitionNum);
1110 map->s_partition_func = NULL; 1151 map->s_partition_func = NULL;
1111 } else if (type == 2) { 1152 } else if (type == 2) {
1112 struct udfPartitionMap2 *upm2 = (struct udfPartitionMap2 *)&(lvd->partitionMaps[offset]); 1153 struct udfPartitionMap2 *upm2 =
1113 if (!strncmp(upm2->partIdent.ident, UDF_ID_VIRTUAL, strlen(UDF_ID_VIRTUAL))) { 1154 (struct udfPartitionMap2 *)gpm;
1114 if (le16_to_cpu(((__le16 *)upm2->partIdent.identSuffix)[0]) == 0x0150) { 1155 if (!strncmp(upm2->partIdent.ident, UDF_ID_VIRTUAL,
1115 map->s_partition_type = UDF_VIRTUAL_MAP15; 1156 strlen(UDF_ID_VIRTUAL))) {
1116 map->s_partition_func = udf_get_pblock_virt15; 1157 u16 suf =
1117 } else if (le16_to_cpu(((__le16 *)upm2->partIdent.identSuffix)[0]) == 0x0200) { 1158 le16_to_cpu(((__le16 *)upm2->partIdent.
1118 map->s_partition_type = UDF_VIRTUAL_MAP20; 1159 identSuffix)[0]);
1119 map->s_partition_func = udf_get_pblock_virt20; 1160 if (suf == 0x0150) {
1161 map->s_partition_type =
1162 UDF_VIRTUAL_MAP15;
1163 map->s_partition_func =
1164 udf_get_pblock_virt15;
1165 } else if (suf == 0x0200) {
1166 map->s_partition_type =
1167 UDF_VIRTUAL_MAP20;
1168 map->s_partition_func =
1169 udf_get_pblock_virt20;
1120 } 1170 }
1121 } else if (!strncmp(upm2->partIdent.ident, UDF_ID_SPARABLE, strlen(UDF_ID_SPARABLE))) { 1171 } else if (!strncmp(upm2->partIdent.ident,
1172 UDF_ID_SPARABLE,
1173 strlen(UDF_ID_SPARABLE))) {
1122 uint32_t loc; 1174 uint32_t loc;
1123 uint16_t ident; 1175 uint16_t ident;
1124 struct sparingTable *st; 1176 struct sparingTable *st;
1125 struct sparablePartitionMap *spm = (struct sparablePartitionMap *)&(lvd->partitionMaps[offset]); 1177 struct sparablePartitionMap *spm =
1178 (struct sparablePartitionMap *)gpm;
1126 1179
1127 map->s_partition_type = UDF_SPARABLE_MAP15; 1180 map->s_partition_type = UDF_SPARABLE_MAP15;
1128 map->s_type_specific.s_sparing.s_packet_len = le16_to_cpu(spm->packetLength); 1181 map->s_type_specific.s_sparing.s_packet_len =
1182 le16_to_cpu(spm->packetLength);
1129 for (j = 0; j < spm->numSparingTables; j++) { 1183 for (j = 0; j < spm->numSparingTables; j++) {
1130 loc = le32_to_cpu(spm->locSparingTable[j]); 1184 struct buffer_head *bh2;
1131 map->s_type_specific.s_sparing.s_spar_map[j] = 1185
1132 udf_read_tagged(sb, loc, loc, &ident); 1186 loc = le32_to_cpu(
1133 if (map->s_type_specific.s_sparing.s_spar_map[j] != NULL) { 1187 spm->locSparingTable[j]);
1134 st = (struct sparingTable *)map->s_type_specific.s_sparing.s_spar_map[j]->b_data; 1188 bh2 = udf_read_tagged(sb, loc, loc,
1135 if (ident != 0 || 1189 &ident);
1136 strncmp(st->sparingIdent.ident, UDF_ID_SPARING, strlen(UDF_ID_SPARING))) { 1190 map->s_type_specific.s_sparing.
1137 brelse(map->s_type_specific.s_sparing.s_spar_map[j]); 1191 s_spar_map[j] = bh2;
1138 map->s_type_specific.s_sparing.s_spar_map[j] = NULL; 1192
1193 if (bh2 != NULL) {
1194 st = (struct sparingTable *)
1195 bh2->b_data;
1196 if (ident != 0 || strncmp(
1197 st->sparingIdent.ident,
1198 UDF_ID_SPARING,
1199 strlen(UDF_ID_SPARING))) {
1200 brelse(bh2);
1201 map->s_type_specific.
1202 s_sparing.
1203 s_spar_map[j] =
1204 NULL;
1139 } 1205 }
1140 } 1206 }
1141 } 1207 }
@@ -1218,6 +1284,7 @@ static int udf_process_sequence(struct super_block *sb, long block,
1218{ 1284{
1219 struct buffer_head *bh = NULL; 1285 struct buffer_head *bh = NULL;
1220 struct udf_vds_record vds[VDS_POS_LENGTH]; 1286 struct udf_vds_record vds[VDS_POS_LENGTH];
1287 struct udf_vds_record *curr;
1221 struct generic_desc *gd; 1288 struct generic_desc *gd;
1222 struct volDescPtr *vdp; 1289 struct volDescPtr *vdp;
1223 int done = 0; 1290 int done = 0;
@@ -1240,43 +1307,51 @@ static int udf_process_sequence(struct super_block *sb, long block,
1240 vdsn = le32_to_cpu(gd->volDescSeqNum); 1307 vdsn = le32_to_cpu(gd->volDescSeqNum);
1241 switch (ident) { 1308 switch (ident) {
1242 case TAG_IDENT_PVD: /* ISO 13346 3/10.1 */ 1309 case TAG_IDENT_PVD: /* ISO 13346 3/10.1 */
1243 if (vdsn >= vds[VDS_POS_PRIMARY_VOL_DESC].volDescSeqNum) { 1310 curr = &vds[VDS_POS_PRIMARY_VOL_DESC];
1244 vds[VDS_POS_PRIMARY_VOL_DESC].volDescSeqNum = vdsn; 1311 if (vdsn >= curr->volDescSeqNum) {
1245 vds[VDS_POS_PRIMARY_VOL_DESC].block = block; 1312 curr->volDescSeqNum = vdsn;
1313 curr->block = block;
1246 } 1314 }
1247 break; 1315 break;
1248 case TAG_IDENT_VDP: /* ISO 13346 3/10.3 */ 1316 case TAG_IDENT_VDP: /* ISO 13346 3/10.3 */
1249 if (vdsn >= vds[VDS_POS_VOL_DESC_PTR].volDescSeqNum) { 1317 curr = &vds[VDS_POS_VOL_DESC_PTR];
1250 vds[VDS_POS_VOL_DESC_PTR].volDescSeqNum = vdsn; 1318 if (vdsn >= curr->volDescSeqNum) {
1251 vds[VDS_POS_VOL_DESC_PTR].block = block; 1319 curr->volDescSeqNum = vdsn;
1320 curr->block = block;
1252 1321
1253 vdp = (struct volDescPtr *)bh->b_data; 1322 vdp = (struct volDescPtr *)bh->b_data;
1254 next_s = le32_to_cpu(vdp->nextVolDescSeqExt.extLocation); 1323 next_s = le32_to_cpu(
1255 next_e = le32_to_cpu(vdp->nextVolDescSeqExt.extLength); 1324 vdp->nextVolDescSeqExt.extLocation);
1325 next_e = le32_to_cpu(
1326 vdp->nextVolDescSeqExt.extLength);
1256 next_e = next_e >> sb->s_blocksize_bits; 1327 next_e = next_e >> sb->s_blocksize_bits;
1257 next_e += next_s; 1328 next_e += next_s;
1258 } 1329 }
1259 break; 1330 break;
1260 case TAG_IDENT_IUVD: /* ISO 13346 3/10.4 */ 1331 case TAG_IDENT_IUVD: /* ISO 13346 3/10.4 */
1261 if (vdsn >= vds[VDS_POS_IMP_USE_VOL_DESC].volDescSeqNum) { 1332 curr = &vds[VDS_POS_IMP_USE_VOL_DESC];
1262 vds[VDS_POS_IMP_USE_VOL_DESC].volDescSeqNum = vdsn; 1333 if (vdsn >= curr->volDescSeqNum) {
1263 vds[VDS_POS_IMP_USE_VOL_DESC].block = block; 1334 curr->volDescSeqNum = vdsn;
1335 curr->block = block;
1264 } 1336 }
1265 break; 1337 break;
1266 case TAG_IDENT_PD: /* ISO 13346 3/10.5 */ 1338 case TAG_IDENT_PD: /* ISO 13346 3/10.5 */
1267 if (!vds[VDS_POS_PARTITION_DESC].block) 1339 curr = &vds[VDS_POS_PARTITION_DESC];
1268 vds[VDS_POS_PARTITION_DESC].block = block; 1340 if (!curr->block)
1341 curr->block = block;
1269 break; 1342 break;
1270 case TAG_IDENT_LVD: /* ISO 13346 3/10.6 */ 1343 case TAG_IDENT_LVD: /* ISO 13346 3/10.6 */
1271 if (vdsn >= vds[VDS_POS_LOGICAL_VOL_DESC].volDescSeqNum) { 1344 curr = &vds[VDS_POS_LOGICAL_VOL_DESC];
1272 vds[VDS_POS_LOGICAL_VOL_DESC].volDescSeqNum = vdsn; 1345 if (vdsn >= curr->volDescSeqNum) {
1273 vds[VDS_POS_LOGICAL_VOL_DESC].block = block; 1346 curr->volDescSeqNum = vdsn;
1347 curr->block = block;
1274 } 1348 }
1275 break; 1349 break;
1276 case TAG_IDENT_USD: /* ISO 13346 3/10.8 */ 1350 case TAG_IDENT_USD: /* ISO 13346 3/10.8 */
1277 if (vdsn >= vds[VDS_POS_UNALLOC_SPACE_DESC].volDescSeqNum) { 1351 curr = &vds[VDS_POS_UNALLOC_SPACE_DESC];
1278 vds[VDS_POS_UNALLOC_SPACE_DESC].volDescSeqNum = vdsn; 1352 if (vdsn >= curr->volDescSeqNum) {
1279 vds[VDS_POS_UNALLOC_SPACE_DESC].block = block; 1353 curr->volDescSeqNum = vdsn;
1354 curr->block = block;
1280 } 1355 }
1281 break; 1356 break;
1282 case TAG_IDENT_TD: /* ISO 13346 3/10.9 */ 1357 case TAG_IDENT_TD: /* ISO 13346 3/10.9 */
@@ -1285,9 +1360,8 @@ static int udf_process_sequence(struct super_block *sb, long block,
1285 block = next_s; 1360 block = next_s;
1286 lastblock = next_e; 1361 lastblock = next_e;
1287 next_s = next_e = 0; 1362 next_s = next_e = 0;
1288 } else { 1363 } else
1289 done = 1; 1364 done = 1;
1290 }
1291 break; 1365 break;
1292 } 1366 }
1293 brelse(bh); 1367 brelse(bh);
@@ -1379,14 +1453,18 @@ static int udf_load_partition(struct super_block *sb, kernel_lb_addr *fileset)
1379 anchor = (struct anchorVolDescPtr *)bh->b_data; 1453 anchor = (struct anchorVolDescPtr *)bh->b_data;
1380 1454
1381 /* Locate the main sequence */ 1455 /* Locate the main sequence */
1382 main_s = le32_to_cpu(anchor->mainVolDescSeqExt.extLocation); 1456 main_s = le32_to_cpu(
1383 main_e = le32_to_cpu(anchor->mainVolDescSeqExt.extLength); 1457 anchor->mainVolDescSeqExt.extLocation);
1458 main_e = le32_to_cpu(
1459 anchor->mainVolDescSeqExt.extLength);
1384 main_e = main_e >> sb->s_blocksize_bits; 1460 main_e = main_e >> sb->s_blocksize_bits;
1385 main_e += main_s; 1461 main_e += main_s;
1386 1462
1387 /* Locate the reserve sequence */ 1463 /* Locate the reserve sequence */
1388 reserve_s = le32_to_cpu(anchor->reserveVolDescSeqExt.extLocation); 1464 reserve_s = le32_to_cpu(
1389 reserve_e = le32_to_cpu(anchor->reserveVolDescSeqExt.extLength); 1465 anchor->reserveVolDescSeqExt.extLocation);
1466 reserve_e = le32_to_cpu(
1467 anchor->reserveVolDescSeqExt.extLength);
1390 reserve_e = reserve_e >> sb->s_blocksize_bits; 1468 reserve_e = reserve_e >> sb->s_blocksize_bits;
1391 reserve_e += reserve_s; 1469 reserve_e += reserve_s;
1392 1470
@@ -1394,8 +1472,10 @@ static int udf_load_partition(struct super_block *sb, kernel_lb_addr *fileset)
1394 1472
1395 /* Process the main & reserve sequences */ 1473 /* Process the main & reserve sequences */
1396 /* responsible for finding the PartitionDesc(s) */ 1474 /* responsible for finding the PartitionDesc(s) */
1397 if (!(udf_process_sequence(sb, main_s, main_e, fileset) && 1475 if (!(udf_process_sequence(sb, main_s, main_e,
1398 udf_process_sequence(sb, reserve_s, reserve_e, fileset))) 1476 fileset) &&
1477 udf_process_sequence(sb, reserve_s, reserve_e,
1478 fileset)))
1399 break; 1479 break;
1400 } 1480 }
1401 } 1481 }
@@ -1426,10 +1506,14 @@ static int udf_load_partition(struct super_block *sb, kernel_lb_addr *fileset)
1426 for (j = 0; j < sbi->s_partitions; j++) { 1506 for (j = 0; j < sbi->s_partitions; j++) {
1427 struct udf_part_map *map2 = &sbi->s_partmaps[j]; 1507 struct udf_part_map *map2 = &sbi->s_partmaps[j];
1428 if (j != i && 1508 if (j != i &&
1429 map->s_volumeseqnum == map2->s_volumeseqnum && 1509 map->s_volumeseqnum ==
1430 map->s_partition_num == map2->s_partition_num) { 1510 map2->s_volumeseqnum &&
1511 map->s_partition_num ==
1512 map2->s_partition_num) {
1431 ino.partitionReferenceNum = j; 1513 ino.partitionReferenceNum = j;
1432 ino.logicalBlockNum = sbi->s_last_block - map2->s_partition_root; 1514 ino.logicalBlockNum =
1515 sbi->s_last_block -
1516 map2->s_partition_root;
1433 break; 1517 break;
1434 } 1518 }
1435 } 1519 }
@@ -1448,17 +1532,22 @@ static int udf_load_partition(struct super_block *sb, kernel_lb_addr *fileset)
1448 (sbi->s_vat_inode->i_size - 36) >> 2; 1532 (sbi->s_vat_inode->i_size - 36) >> 2;
1449 } else if (map->s_partition_type == UDF_VIRTUAL_MAP20) { 1533 } else if (map->s_partition_type == UDF_VIRTUAL_MAP20) {
1450 uint32_t pos; 1534 uint32_t pos;
1535 struct virtualAllocationTable20 *vat20;
1451 1536
1452 pos = udf_block_map(sbi->s_vat_inode, 0); 1537 pos = udf_block_map(sbi->s_vat_inode, 0);
1453 bh = sb_bread(sb, pos); 1538 bh = sb_bread(sb, pos);
1454 if (!bh) 1539 if (!bh)
1455 return 1; 1540 return 1;
1541 vat20 = (struct virtualAllocationTable20 *)
1542 bh->b_data +
1543 udf_ext0_offset(sbi->s_vat_inode);
1456 map->s_type_specific.s_virtual.s_start_offset = 1544 map->s_type_specific.s_virtual.s_start_offset =
1457 le16_to_cpu(((struct virtualAllocationTable20 *)bh->b_data + 1545 le16_to_cpu(vat20->lengthHeader) +
1458 udf_ext0_offset(sbi->s_vat_inode))->lengthHeader) +
1459 udf_ext0_offset(sbi->s_vat_inode); 1546 udf_ext0_offset(sbi->s_vat_inode);
1460 map->s_type_specific.s_virtual.s_num_entries = (sbi->s_vat_inode->i_size - 1547 map->s_type_specific.s_virtual.s_num_entries =
1461 map->s_type_specific.s_virtual.s_start_offset) >> 2; 1548 (sbi->s_vat_inode->i_size -
1549 map->s_type_specific.s_virtual.
1550 s_start_offset) >> 2;
1462 brelse(bh); 1551 brelse(bh);
1463 } 1552 }
1464 map->s_partition_root = udf_get_pblock(sb, 0, i, 0); 1553 map->s_partition_root = udf_get_pblock(sb, 0, i, 0);
@@ -1477,8 +1566,10 @@ static void udf_open_lvid(struct super_block *sb)
1477 if (bh) { 1566 if (bh) {
1478 int i; 1567 int i;
1479 kernel_timestamp cpu_time; 1568 kernel_timestamp cpu_time;
1480 struct logicalVolIntegrityDesc *lvid = (struct logicalVolIntegrityDesc *)bh->b_data; 1569 struct logicalVolIntegrityDesc *lvid =
1481 struct logicalVolIntegrityDescImpUse *lvidiu = udf_sb_lvidiu(sbi); 1570 (struct logicalVolIntegrityDesc *)bh->b_data;
1571 struct logicalVolIntegrityDescImpUse *lvidiu =
1572 udf_sb_lvidiu(sbi);
1482 1573
1483 lvidiu->impIdent.identSuffix[0] = UDF_OS_CLASS_UNIX; 1574 lvidiu->impIdent.identSuffix[0] = UDF_OS_CLASS_UNIX;
1484 lvidiu->impIdent.identSuffix[1] = UDF_OS_ID_LINUX; 1575 lvidiu->impIdent.identSuffix[1] = UDF_OS_ID_LINUX;
@@ -1486,8 +1577,10 @@ static void udf_open_lvid(struct super_block *sb)
1486 lvid->recordingDateAndTime = cpu_to_lets(cpu_time); 1577 lvid->recordingDateAndTime = cpu_to_lets(cpu_time);
1487 lvid->integrityType = LVID_INTEGRITY_TYPE_OPEN; 1578 lvid->integrityType = LVID_INTEGRITY_TYPE_OPEN;
1488 1579
1489 lvid->descTag.descCRC = cpu_to_le16(udf_crc((char *)lvid + sizeof(tag), 1580 lvid->descTag.descCRC = cpu_to_le16(
1490 le16_to_cpu(lvid->descTag.descCRCLength), 0)); 1581 udf_crc((char *)lvid + sizeof(tag),
1582 le16_to_cpu(lvid->descTag.descCRCLength),
1583 0));
1491 1584
1492 lvid->descTag.tagChecksum = 0; 1585 lvid->descTag.tagChecksum = 0;
1493 for (i = 0; i < 16; i++) 1586 for (i = 0; i < 16; i++)
@@ -1513,22 +1606,25 @@ static void udf_close_lvid(struct super_block *sb)
1513 lvid = (struct logicalVolIntegrityDesc *)bh->b_data; 1606 lvid = (struct logicalVolIntegrityDesc *)bh->b_data;
1514 1607
1515 if (lvid->integrityType == LVID_INTEGRITY_TYPE_OPEN) { 1608 if (lvid->integrityType == LVID_INTEGRITY_TYPE_OPEN) {
1516 struct logicalVolIntegrityDescImpUse *lvidiu = udf_sb_lvidiu(sbi); 1609 struct logicalVolIntegrityDescImpUse *lvidiu =
1610 udf_sb_lvidiu(sbi);
1517 lvidiu->impIdent.identSuffix[0] = UDF_OS_CLASS_UNIX; 1611 lvidiu->impIdent.identSuffix[0] = UDF_OS_CLASS_UNIX;
1518 lvidiu->impIdent.identSuffix[1] = UDF_OS_ID_LINUX; 1612 lvidiu->impIdent.identSuffix[1] = UDF_OS_ID_LINUX;
1519 if (udf_time_to_stamp(&cpu_time, CURRENT_TIME)) 1613 if (udf_time_to_stamp(&cpu_time, CURRENT_TIME))
1520 lvid->recordingDateAndTime = cpu_to_lets(cpu_time); 1614 lvid->recordingDateAndTime = cpu_to_lets(cpu_time);
1521 if (UDF_MAX_WRITE_VERSION > le16_to_cpu(lvidiu->maxUDFWriteRev)) 1615 if (UDF_MAX_WRITE_VERSION > le16_to_cpu(lvidiu->maxUDFWriteRev))
1522 lvidiu->maxUDFWriteRev = cpu_to_le16(UDF_MAX_WRITE_VERSION); 1616 lvidiu->maxUDFWriteRev =
1617 cpu_to_le16(UDF_MAX_WRITE_VERSION);
1523 if (sbi->s_udfrev > le16_to_cpu(lvidiu->minUDFReadRev)) 1618 if (sbi->s_udfrev > le16_to_cpu(lvidiu->minUDFReadRev))
1524 lvidiu->minUDFReadRev = cpu_to_le16(sbi->s_udfrev); 1619 lvidiu->minUDFReadRev = cpu_to_le16(sbi->s_udfrev);
1525 if (sbi->s_udfrev > le16_to_cpu(lvidiu->minUDFWriteRev)) 1620 if (sbi->s_udfrev > le16_to_cpu(lvidiu->minUDFWriteRev))
1526 lvidiu->minUDFWriteRev = cpu_to_le16(sbi->s_udfrev); 1621 lvidiu->minUDFWriteRev = cpu_to_le16(sbi->s_udfrev);
1527 lvid->integrityType = cpu_to_le32(LVID_INTEGRITY_TYPE_CLOSE); 1622 lvid->integrityType = cpu_to_le32(LVID_INTEGRITY_TYPE_CLOSE);
1528 1623
1529 lvid->descTag.descCRC = 1624 lvid->descTag.descCRC = cpu_to_le16(
1530 cpu_to_le16(udf_crc((char *)lvid + sizeof(tag), 1625 udf_crc((char *)lvid + sizeof(tag),
1531 le16_to_cpu(lvid->descTag.descCRCLength), 0)); 1626 le16_to_cpu(lvid->descTag.descCRCLength),
1627 0));
1532 1628
1533 lvid->descTag.tagChecksum = 0; 1629 lvid->descTag.tagChecksum = 0;
1534 for (i = 0; i < 16; i++) 1630 for (i = 0; i < 16; i++)
@@ -1544,7 +1640,8 @@ static void udf_sb_free_bitmap(struct udf_bitmap *bitmap)
1544{ 1640{
1545 int i; 1641 int i;
1546 int nr_groups = bitmap->s_nr_groups; 1642 int nr_groups = bitmap->s_nr_groups;
1547 int size = sizeof(struct udf_bitmap) + (sizeof(struct buffer_head *) * nr_groups); 1643 int size = sizeof(struct udf_bitmap) + (sizeof(struct buffer_head *) *
1644 nr_groups);
1548 1645
1549 for (i = 0; i < nr_groups; i++) 1646 for (i = 0; i < nr_groups; i++)
1550 if (bitmap->s_block_bitmap[i]) 1647 if (bitmap->s_block_bitmap[i])
@@ -1662,19 +1759,21 @@ static int udf_fill_super(struct super_block *sb, void *options, int silent)
1662 udf_debug("Lastblock=%d\n", sbi->s_last_block); 1759 udf_debug("Lastblock=%d\n", sbi->s_last_block);
1663 1760
1664 if (sbi->s_lvid_bh) { 1761 if (sbi->s_lvid_bh) {
1665 struct logicalVolIntegrityDescImpUse *lvidiu = udf_sb_lvidiu(sbi); 1762 struct logicalVolIntegrityDescImpUse *lvidiu =
1763 udf_sb_lvidiu(sbi);
1666 uint16_t minUDFReadRev = le16_to_cpu(lvidiu->minUDFReadRev); 1764 uint16_t minUDFReadRev = le16_to_cpu(lvidiu->minUDFReadRev);
1667 uint16_t minUDFWriteRev = le16_to_cpu(lvidiu->minUDFWriteRev); 1765 uint16_t minUDFWriteRev = le16_to_cpu(lvidiu->minUDFWriteRev);
1668 /* uint16_t maxUDFWriteRev = le16_to_cpu(lvidiu->maxUDFWriteRev); */ 1766 /* uint16_t maxUDFWriteRev =
1767 le16_to_cpu(lvidiu->maxUDFWriteRev); */
1669 1768
1670 if (minUDFReadRev > UDF_MAX_READ_VERSION) { 1769 if (minUDFReadRev > UDF_MAX_READ_VERSION) {
1671 printk(KERN_ERR "UDF-fs: minUDFReadRev=%x (max is %x)\n", 1770 printk(KERN_ERR "UDF-fs: minUDFReadRev=%x "
1771 "(max is %x)\n",
1672 le16_to_cpu(lvidiu->minUDFReadRev), 1772 le16_to_cpu(lvidiu->minUDFReadRev),
1673 UDF_MAX_READ_VERSION); 1773 UDF_MAX_READ_VERSION);
1674 goto error_out; 1774 goto error_out;
1675 } else if (minUDFWriteRev > UDF_MAX_WRITE_VERSION) { 1775 } else if (minUDFWriteRev > UDF_MAX_WRITE_VERSION)
1676 sb->s_flags |= MS_RDONLY; 1776 sb->s_flags |= MS_RDONLY;
1677 }
1678 1777
1679 sbi->s_udfrev = minUDFWriteRev; 1778 sbi->s_udfrev = minUDFWriteRev;
1680 1779
@@ -1689,8 +1788,10 @@ static int udf_fill_super(struct super_block *sb, void *options, int silent)
1689 goto error_out; 1788 goto error_out;
1690 } 1789 }
1691 1790
1692 if (sbi->s_partmaps[sbi->s_partition].s_partition_flags & UDF_PART_FLAG_READ_ONLY) { 1791 if (sbi->s_partmaps[sbi->s_partition].s_partition_flags &
1693 printk(KERN_NOTICE "UDF-fs: Partition marked readonly; forcing readonly mount\n"); 1792 UDF_PART_FLAG_READ_ONLY) {
1793 printk(KERN_NOTICE "UDF-fs: Partition marked readonly; "
1794 "forcing readonly mount\n");
1694 sb->s_flags |= MS_RDONLY; 1795 sb->s_flags |= MS_RDONLY;
1695 } 1796 }
1696 1797
@@ -1716,7 +1817,8 @@ static int udf_fill_super(struct super_block *sb, void *options, int silent)
1716 /* perhaps it's not extensible enough, but for now ... */ 1817 /* perhaps it's not extensible enough, but for now ... */
1717 inode = udf_iget(sb, rootdir); 1818 inode = udf_iget(sb, rootdir);
1718 if (!inode) { 1819 if (!inode) {
1719 printk(KERN_ERR "UDF-fs: Error in udf_iget, block=%d, partition=%d\n", 1820 printk(KERN_ERR "UDF-fs: Error in udf_iget, block=%d, "
1821 "partition=%d\n",
1720 rootdir.logicalBlockNum, rootdir.partitionReferenceNum); 1822 rootdir.logicalBlockNum, rootdir.partitionReferenceNum);
1721 goto error_out; 1823 goto error_out;
1722 } 1824 }
@@ -1746,7 +1848,8 @@ error_out:
1746 udf_sb_free_bitmap(map->s_fspace.s_bitmap); 1848 udf_sb_free_bitmap(map->s_fspace.s_bitmap);
1747 if (map->s_partition_type == UDF_SPARABLE_MAP15) 1849 if (map->s_partition_type == UDF_SPARABLE_MAP15)
1748 for (i = 0; i < 4; i++) 1850 for (i = 0; i < 4; i++)
1749 brelse(map->s_type_specific.s_sparing.s_spar_map[i]); 1851 brelse(map->s_type_specific.s_sparing.
1852 s_spar_map[i]);
1750 } 1853 }
1751#ifdef CONFIG_UDF_NLS 1854#ifdef CONFIG_UDF_NLS
1752 if (UDF_QUERY_FLAG(sb, UDF_FLAG_NLS_MAP)) 1855 if (UDF_QUERY_FLAG(sb, UDF_FLAG_NLS_MAP))
@@ -1824,7 +1927,8 @@ static void udf_put_super(struct super_block *sb)
1824 udf_sb_free_bitmap(map->s_fspace.s_bitmap); 1927 udf_sb_free_bitmap(map->s_fspace.s_bitmap);
1825 if (map->s_partition_type == UDF_SPARABLE_MAP15) 1928 if (map->s_partition_type == UDF_SPARABLE_MAP15)
1826 for (i = 0; i < 4; i++) 1929 for (i = 0; i < 4; i++)
1827 brelse(map->s_type_specific.s_sparing.s_spar_map[i]); 1930 brelse(map->s_type_specific.s_sparing.
1931 s_spar_map[i]);
1828 } 1932 }
1829#ifdef CONFIG_UDF_NLS 1933#ifdef CONFIG_UDF_NLS
1830 if (UDF_QUERY_FLAG(sb, UDF_FLAG_NLS_MAP)) 1934 if (UDF_QUERY_FLAG(sb, UDF_FLAG_NLS_MAP))
@@ -1881,7 +1985,8 @@ static unsigned char udf_bitmap_lookup[16] = {
1881 0, 1, 1, 2, 1, 2, 2, 3, 1, 2, 2, 3, 2, 3, 3, 4 1985 0, 1, 1, 2, 1, 2, 2, 3, 1, 2, 2, 3, 2, 3, 3, 4
1882}; 1986};
1883 1987
1884static unsigned int udf_count_free_bitmap(struct super_block *sb, struct udf_bitmap *bitmap) 1988static unsigned int udf_count_free_bitmap(struct super_block *sb,
1989 struct udf_bitmap *bitmap)
1885{ 1990{
1886 struct buffer_head *bh = NULL; 1991 struct buffer_head *bh = NULL;
1887 unsigned int accum = 0; 1992 unsigned int accum = 0;
@@ -1942,7 +2047,8 @@ out:
1942 return accum; 2047 return accum;
1943} 2048}
1944 2049
1945static unsigned int udf_count_free_table(struct super_block *sb, struct inode *table) 2050static unsigned int udf_count_free_table(struct super_block *sb,
2051 struct inode *table)
1946{ 2052{
1947 unsigned int accum = 0; 2053 unsigned int accum = 0;
1948 uint32_t elen; 2054 uint32_t elen;
@@ -1974,9 +2080,12 @@ static unsigned int udf_count_free(struct super_block *sb)
1974 2080
1975 sbi = UDF_SB(sb); 2081 sbi = UDF_SB(sb);
1976 if (sbi->s_lvid_bh) { 2082 if (sbi->s_lvid_bh) {
1977 struct logicalVolIntegrityDesc *lvid = (struct logicalVolIntegrityDesc *)sbi->s_lvid_bh->b_data; 2083 struct logicalVolIntegrityDesc *lvid =
2084 (struct logicalVolIntegrityDesc *)
2085 sbi->s_lvid_bh->b_data;
1978 if (le32_to_cpu(lvid->numOfPartitions) > sbi->s_partition) { 2086 if (le32_to_cpu(lvid->numOfPartitions) > sbi->s_partition) {
1979 accum = le32_to_cpu(lvid->freeSpaceTable[sbi->s_partition]); 2087 accum = le32_to_cpu(
2088 lvid->freeSpaceTable[sbi->s_partition]);
1980 if (accum == 0xFFFFFFFF) 2089 if (accum == 0xFFFFFFFF)
1981 accum = 0; 2090 accum = 0;
1982 } 2091 }