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

Function Ext2QueryExtentMappings

Ext4Fsd/fsctl.c:667–769  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

665
666
667NTSTATUS
668Ext2QueryExtentMappings(
669 IN PEXT2_IRP_CONTEXT IrpContext,
670 IN PEXT2_VCB Vcb,
671 IN PEXT2_FCB Fcb,
672 IN PLARGE_INTEGER RequestVbn,
673 OUT PLARGE_INTEGER * pMappedRuns
674)
675{
676 PLARGE_INTEGER MappedRuns = NULL;
677 PLARGE_INTEGER PartialRuns = NULL;
678
679 PEXT2_EXTENT Chain = NULL;
680 PEXT2_EXTENT Extent = NULL;
681
682 LONGLONG Vbn = 0;
683 ULONG Length = 0;
684 ULONG i = 0;
685
686 NTSTATUS Status = STATUS_SUCCESS;
687
688 __try {
689
690 /* now building all the request extents */
691 while (Vbn < RequestVbn->QuadPart) {
692
693 Length = 0x80000000; /* 2g bytes */
694 if (RequestVbn->QuadPart < Vbn + Length) {
695 Length = (ULONG)(RequestVbn->QuadPart - Vbn);
696 }
697
698 /* build extents for sub-range */
699 Extent = NULL;
700 Status = Ext2BuildExtents(
701 IrpContext,
702 Vcb,
703 Fcb->Mcb,
704 Vbn,
705 Length,
706 FALSE,
707 &Extent);
708
709 if (!NT_SUCCESS(Status)) {
710 __leave;
711 }
712
713 if (Chain) {
714 Ext2JointExtents(Chain, Extent);
715 } else {
716 Chain = Extent;
717 }
718
719 /* allocate extent array */
720 PartialRuns = Ext2AllocatePool(
721 NonPagedPool,
722 (Ext2CountExtents(Chain) + 2) *
723 (2 * sizeof(LARGE_INTEGER)),
724 'RE2E');

Callers 2

Ext2GetRetrievalPointersFunction · 0.85

Calls 6

Ext2BuildExtentsFunction · 0.85
Ext2JointExtentsFunction · 0.85
Ext2AllocatePoolFunction · 0.85
Ext2CountExtentsFunction · 0.85
Ext2FreePoolFunction · 0.85
Ext2DestroyExtentChainFunction · 0.85

Tested by

no test coverage detected