mirror of
https://github.com/reactos/reactos.git
synced 2025-08-01 19:22:58 +00:00
[NTFS]
Lay some groundwork for extending allocation size. +AddRun() - Unimplemented +GetLastClusterInDataRun() +NtfsAllocateClusters() svn path=/branches/GSoC_2016/NTFS/; revision=71696
This commit is contained in:
parent
84a1280fd6
commit
77fc65dc0e
4 changed files with 223 additions and 5 deletions
|
@ -35,6 +35,19 @@
|
|||
|
||||
/* FUNCTIONS ****************************************************************/
|
||||
|
||||
NTSTATUS
|
||||
AddRun(PNTFS_ATTR_CONTEXT AttrContext,
|
||||
ULONGLONG NextAssignedCluster,
|
||||
ULONG RunLength)
|
||||
{
|
||||
UNIMPLEMENTED;
|
||||
|
||||
if (!AttrContext->Record.IsNonResident)
|
||||
return STATUS_INVALID_PARAMETER;
|
||||
|
||||
return STATUS_NOT_IMPLEMENTED;
|
||||
}
|
||||
|
||||
PUCHAR
|
||||
DecodeRun(PUCHAR DataRun,
|
||||
LONGLONG *DataRunOffset,
|
||||
|
@ -551,6 +564,50 @@ GetFileNameFromRecord(PDEVICE_EXTENSION Vcb,
|
|||
return NULL;
|
||||
}
|
||||
|
||||
NTSTATUS
|
||||
GetLastClusterInDataRun(PDEVICE_EXTENSION Vcb, PNTFS_ATTR_RECORD Attribute, PULONGLONG LastCluster)
|
||||
{
|
||||
LONGLONG DataRunOffset;
|
||||
ULONGLONG DataRunLength;
|
||||
LONGLONG DataRunStartLCN;
|
||||
|
||||
ULONGLONG LastLCN = 0;
|
||||
PUCHAR DataRun = (PUCHAR)Attribute + Attribute->NonResident.MappingPairsOffset;
|
||||
|
||||
if (!Attribute->IsNonResident)
|
||||
return STATUS_INVALID_PARAMETER;
|
||||
|
||||
while (1)
|
||||
{
|
||||
DataRun = DecodeRun(DataRun, &DataRunOffset, &DataRunLength);
|
||||
|
||||
if (DataRunOffset == -1)
|
||||
{
|
||||
// sparse run
|
||||
if (*DataRun == 0)
|
||||
{
|
||||
// if it's the last run, return the last cluster of the last run
|
||||
*LastCluster = LastLCN + DataRunLength - 1;
|
||||
break;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
// Normal data run.
|
||||
DataRunStartLCN = LastLCN + DataRunOffset;
|
||||
LastLCN = DataRunStartLCN;
|
||||
}
|
||||
|
||||
if (*DataRun == 0)
|
||||
{
|
||||
*LastCluster = LastLCN + DataRunLength - 1;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
return STATUS_SUCCESS;
|
||||
}
|
||||
|
||||
PSTANDARD_INFORMATION
|
||||
GetStandardInformationFromRecord(PDEVICE_EXTENSION Vcb,
|
||||
PFILE_RECORD_HEADER FileRecord)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue