| 1116 | } |
| 1117 | |
| 1118 | NTSTATUS |
| 1119 | Ext2InitializeZone( |
| 1120 | IN PEXT2_IRP_CONTEXT IrpContext, |
| 1121 | IN PEXT2_VCB Vcb, |
| 1122 | IN PEXT2_MCB Mcb |
| 1123 | ) |
| 1124 | { |
| 1125 | NTSTATUS Status = STATUS_SUCCESS; |
| 1126 | |
| 1127 | ULONG Start = 0; |
| 1128 | ULONG End; |
| 1129 | ULONG Block; |
| 1130 | ULONG Mapped; |
| 1131 | |
| 1132 | Ext2ClearAllExtents(&Mcb->Extents); |
| 1133 | Ext2ClearAllExtents(&Mcb->MetaExts); |
| 1134 | |
| 1135 | ASSERT(Mcb != NULL); |
| 1136 | End = (ULONG)((Mcb->Inode.i_size + BLOCK_SIZE - 1) >> BLOCK_BITS); |
| 1137 | |
| 1138 | while (Start < End) { |
| 1139 | |
| 1140 | Block = Mapped = 0; |
| 1141 | |
| 1142 | /* mapping file offset to ext2 block */ |
| 1143 | if (INODE_HAS_EXTENT(&Mcb->Inode)) { |
| 1144 | Status = Ext2MapExtent( |
| 1145 | IrpContext, |
| 1146 | Vcb, |
| 1147 | Mcb, |
| 1148 | Start, |
| 1149 | FALSE, |
| 1150 | &Block, |
| 1151 | &Mapped |
| 1152 | ); |
| 1153 | } else { |
| 1154 | Status = Ext2MapIndirect( |
| 1155 | IrpContext, |
| 1156 | Vcb, |
| 1157 | Mcb, |
| 1158 | Start, |
| 1159 | FALSE, |
| 1160 | &Block, |
| 1161 | &Mapped |
| 1162 | ); |
| 1163 | } |
| 1164 | |
| 1165 | if (!NT_SUCCESS(Status)) { |
| 1166 | goto errorout; |
| 1167 | } |
| 1168 | |
| 1169 | /* skip wrong blocks, in case wrongly treating symlink |
| 1170 | target names as blocks, silly */ |
| 1171 | if (Block >= TOTAL_BLOCKS) { |
| 1172 | Block = 0; |
| 1173 | } |
| 1174 | |
| 1175 | if (Block) { |
no test coverage detected