[NTFS] - Add GetAllocationOffsetFromVCN() function, which was mistakenly left out...
authorTrevor Thompson <tmt256@email.vccs.edu>
Thu, 27 Jul 2017 18:34:23 +0000 (18:34 +0000)
committerThomas Faber <thomas.faber@reactos.org>
Sun, 10 Dec 2017 10:15:06 +0000 (11:15 +0100)
svn path=/branches/GSoC_2016/NTFS/; revision=75425

drivers/filesystems/ntfs/btree.c

index 38fa9ae..f4bdf90 100644 (file)
@@ -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