https://git.reactos.org/?p=reactos.git;a=commitdiff;h=b1eab36f6bed95fd08de770d07645e933c29f729

commit b1eab36f6bed95fd08de770d07645e933c29f729
Author: Trevor Thompson <[email protected]>
AuthorDate: Thu Jul 27 18:34:23 2017 +0000

    [NTFS] - Add GetAllocationOffsetFromVCN() function, which was mistakenly 
left out of the last commit.
    
    svn path=/branches/GSoC_2016/NTFS/; revision=75425
---
 drivers/filesystems/ntfs/btree.c | 12 ++++++++++++
 1 file changed, 12 insertions(+)

diff --git a/drivers/filesystems/ntfs/btree.c b/drivers/filesystems/ntfs/btree.c
index 38fa9aefee..f4bdf909a1 100644
--- a/drivers/filesystems/ntfs/btree.c
+++ b/drivers/filesystems/ntfs/btree.c
@@ -511,6 +511,18 @@ DumpBTree(PB_TREE Tree)
     DumpBTreeNode(Tree->RootNode, 0, 0);
 }
 
+// Calculates start of Index Buffer relative to the index allocation, given 
the node's VCN
+ULONGLONG
+GetAllocationOffsetFromVCN(PDEVICE_EXTENSION DeviceExt,
+                           ULONG IndexBufferSize,
+                           ULONGLONG Vcn)
+{
+    if (IndexBufferSize < DeviceExt->NtfsInfo.BytesPerCluster)
+        return Vcn * DeviceExt->NtfsInfo.BytesPerSector;
+
+    return Vcn * DeviceExt->NtfsInfo.BytesPerCluster;
+}
+
 /**
 * @name NtfsInsertKey
 * @implemented

Reply via email to