[NTFS]
authorPierre Schweitzer <pierre@reactos.org>
Fri, 26 Sep 2014 06:41:51 +0000 (06:41 +0000)
committerPierre Schweitzer <pierre@reactos.org>
Fri, 26 Sep 2014 06:41:51 +0000 (06:41 +0000)
- Divert NtfsReadSectors() into NtfsReadDisk()
- Reimplement NtfsReadSectors() using NtfsReadDisk()

svn path=/trunk/; revision=64294

reactos/drivers/filesystems/ntfs/blockdev.c
reactos/drivers/filesystems/ntfs/ntfs.h

index 8558693..3628bb3 100644 (file)
 /* FUNCTIONS ****************************************************************/
 
 NTSTATUS
-NtfsReadSectors(IN PDEVICE_OBJECT DeviceObject,
-                IN ULONG DiskSector,
-                IN ULONG SectorCount,
-                IN ULONG SectorSize,
-                IN OUT PUCHAR Buffer,
-                IN BOOLEAN Override)
+NtfsReadDisk(IN PDEVICE_OBJECT DeviceObject,
+             IN LONGLONG StartingOffset,
+             IN ULONG Length,
+             IN OUT PUCHAR Buffer,
+             IN BOOLEAN Override)
 {
     PIO_STACK_LOCATION Stack;
     IO_STATUS_BLOCK IoStatus;
     LARGE_INTEGER Offset;
-    ULONG BlockSize;
     KEVENT Event;
     PIRP Irp;
     NTSTATUS Status;
 
+    DPRINT("NtfsReadDisk(%p, %I64x, %u, %p, %d)\n", DeviceObject, StartingOffset, Length, Buffer, Override);
+
     KeInitializeEvent(&Event,
                       NotificationEvent,
                       FALSE);
 
-    Offset.QuadPart = (LONGLONG)DiskSector * (LONGLONG)SectorSize;
-    BlockSize = SectorCount * SectorSize;
-
-    DPRINT("NtfsReadSectors(DeviceObject %p, DiskSector %d, Buffer %p)\n",
-           DeviceObject, DiskSector, Buffer);
-    DPRINT("Offset %I64x BlockSize %ld\n",
-           Offset.QuadPart,
-           BlockSize);
+    Offset.QuadPart = StartingOffset;
 
     DPRINT("Building synchronous FSD Request...\n");
     Irp = IoBuildSynchronousFsdRequest(IRP_MJ_READ,
                                        DeviceObject,
                                        Buffer,
-                                       BlockSize,
+                                       Length,
                                        &Offset,
                                        &Event,
                                        &IoStatus);
@@ -93,11 +86,28 @@ NtfsReadSectors(IN PDEVICE_OBJECT DeviceObject,
         Status = IoStatus.Status;
     }
 
-    DPRINT("NtfsReadSectors() done (Status %x)\n", Status);
+    DPRINT("NtfsReadDisk() done (Status %x)\n", Status);
 
     return Status;
 }
 
+NTSTATUS
+NtfsReadSectors(IN PDEVICE_OBJECT DeviceObject,
+                IN ULONG DiskSector,
+                IN ULONG SectorCount,
+                IN ULONG SectorSize,
+                IN OUT PUCHAR Buffer,
+                IN BOOLEAN Override)
+{
+    LONGLONG Offset;
+    ULONG BlockSize;
+
+    Offset = (LONGLONG)DiskSector * (LONGLONG)SectorSize;
+    BlockSize = SectorCount * SectorSize;
+
+    return NtfsReadDisk(DeviceObject, Offset, BlockSize, Buffer, Override);
+}
+
 
 NTSTATUS
 NtfsDeviceIoControl(IN PDEVICE_OBJECT DeviceObject,
index cbdc3f0..0da7175 100644 (file)
@@ -385,6 +385,13 @@ NtfsDumpFileAttributes(PFILE_RECORD_HEADER FileRecord);
 
 /* blockdev.c */
 
+NTSTATUS
+NtfsReadDisk(IN PDEVICE_OBJECT DeviceObject,
+             IN LONGLONG StartingOffset,
+             IN ULONG Length,
+             IN OUT PUCHAR Buffer,
+             IN BOOLEAN Override);
+
 NTSTATUS
 NtfsReadSectors(IN PDEVICE_OBJECT DeviceObject,
                 IN ULONG DiskSector,