MCPcopy Create free account
hub / github.com/bobranten/Ext4Fsd / Ext2TruncateFile

Function Ext2TruncateFile

Ext4Fsd/fileinfo.c:1189–1222  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1187
1188
1189NTSTATUS
1190Ext2TruncateFile(
1191 PEXT2_IRP_CONTEXT IrpContext,
1192 PEXT2_VCB Vcb,
1193 PEXT2_MCB Mcb,
1194 PLARGE_INTEGER Size
1195)
1196{
1197 NTSTATUS status = STATUS_SUCCESS;
1198
1199 if (INODE_HAS_EXTENT(&Mcb->Inode)) {
1200 status = Ext2TruncateExtent(IrpContext, Vcb, Mcb, Size);
1201 } else {
1202 status = Ext2TruncateIndirect(IrpContext, Vcb, Mcb, Size);
1203 }
1204
1205 /* check and clear data/meta mcb extents */
1206 if (Size->QuadPart == 0) {
1207
1208 /* check and remove all data extents */
1209 if (Ext2ListExtents(&Mcb->Extents)) {
1210 DbgBreak();
1211 }
1212 Ext2ClearAllExtents(&Mcb->Extents);
1213 /* check and remove all meta extents */
1214 if (Ext2ListExtents(&Mcb->MetaExts)) {
1215 DbgBreak();
1216 }
1217 Ext2ClearAllExtents(&Mcb->MetaExts);
1218 ClearLongFlag(Mcb->Flags, MCB_ZONE_INITED);
1219 }
1220
1221 return status;
1222}
1223
1224NTSTATUS
1225Ext2IsFileRemovable(

Callers 8

Ext2CleanupFunction · 0.85
Ext2WriteSymlinkFunction · 0.85
Ext2SetReparsePointFunction · 0.85
Ext2TruncateSymlinkFunction · 0.85
Ext2SetFileInformationFunction · 0.85
Ext2DeleteFileFunction · 0.85
Ext2CreateFileFunction · 0.85

Calls 4

Ext2TruncateExtentFunction · 0.85
Ext2TruncateIndirectFunction · 0.85
Ext2ListExtentsFunction · 0.85
Ext2ClearAllExtentsFunction · 0.85

Tested by

no test coverage detected