Don't use a hardcoded sector size of 512 bytes.

svn path=/trunk/; revision=11794
This commit is contained in:
Eric Kohl 2004-11-24 11:09:49 +00:00
parent 0b6ffe64b0
commit 4605029c67
2 changed files with 34 additions and 29 deletions

View file

@ -1,6 +1,6 @@
/*
* ReactOS kernel
* Copyright (C) 2001, 2002, 2003 ReactOS Team
* Copyright (C) 2001, 2002, 2003, 2004 ReactOS Team
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
@ -16,13 +16,13 @@
* along with this program; if not, write to the Free Software
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
*/
/* $Id: disk.c,v 1.46 2004/07/15 04:04:08 jimtabor Exp $
/* $Id: disk.c,v 1.47 2004/11/24 11:09:49 ekohl Exp $
*
* COPYRIGHT: See COPYING in the top level directory
* PROJECT: ReactOS kernel
* FILE: services/storage/disk/disk.c
* PURPOSE: disk class driver
* PROGRAMMER: Eric Kohl (ekohl@rz-online.de)
* PROGRAMMER: Eric Kohl
*/
/* INCLUDES *****************************************************************/
@ -641,13 +641,11 @@ DiskClassCreateDeviceObject(IN PDRIVER_OBJECT DriverObject,
if ((DiskDeviceObject->Characteristics & FILE_REMOVABLE_MEDIA) &&
(DiskDeviceExtension->DiskGeometry->MediaType == RemovableMedia))
{
DiskClassCreateMediaChangeEvent(DiskDeviceExtension,DiskNumber);
if(DiskDeviceExtension->MediaChangeEvent != NULL)
if (DiskDeviceExtension->MediaChangeEvent != NULL)
{
DPRINT("Allocated media change event!\n");
}
}
/* Check disk for presence of a disk manager */
@ -668,6 +666,7 @@ DiskClassCreateDeviceObject(IN PDRIVER_OBJECT DriverObject,
ExFreePool(MbrBuffer);
MbrBuffer = NULL;
}
if ((DiskDeviceObject->Characteristics & FILE_REMOVABLE_MEDIA) &&
(DiskDeviceExtension->DiskGeometry->MediaType == RemovableMedia))
{
@ -765,8 +764,10 @@ DiskClassCreateDeviceObject(IN PDRIVER_OBJECT DriverObject,
PartitionEntry->PartitionNumber,
PartitionEntry->BootIndicator,
PartitionEntry->PartitionType,
PartitionEntry->StartingOffset.QuadPart / 512 /*DrvParms.BytesPerSector*/,
PartitionEntry->PartitionLength.QuadPart / 512 /* DrvParms.BytesPerSector*/);
PartitionEntry->StartingOffset.QuadPart /
DiskDeviceExtension->DiskGeometry->BytesPerSector,
PartitionEntry->PartitionLength.QuadPart /
DiskDeviceExtension->DiskGeometry->BytesPerSector);
/* Create partition device object */
sprintf(NameBuffer2,
@ -924,8 +925,10 @@ DiskBuildPartitionTable(IN PDEVICE_OBJECT DiskDeviceObject,
DiskData->PartitionNumber,
DiskData->BootIndicator,
DiskData->PartitionType,
DiskDeviceExtension->StartingOffset.QuadPart / 512 /*DrvParms.BytesPerSector*/,
DiskDeviceExtension->PartitionLength.QuadPart / 512 /* DrvParms.BytesPerSector*/);
DiskDeviceExtension->StartingOffset.QuadPart /
DiskDeviceExtension->DiskGeometry->BytesPerSector,
DiskDeviceExtension->PartitionLength.QuadPart /
DiskDeviceExtension->DiskGeometry->BytesPerSector);
}
}
else

View file

@ -1,4 +1,4 @@
# $Id: makefile,v 1.8 2004/06/10 08:20:20 hbirr Exp $
# $Id: makefile,v 1.9 2004/11/24 11:09:49 ekohl Exp $
PATH_TO_TOP = ../../..
@ -10,6 +10,8 @@ TARGET_NAME = disk
TARGET_DDKLIBS = class2.a
TARGET_GCCLIBS = gcc
TARGET_OBJECTS = $(TARGET_NAME).o
TARGET_CFLAGS = -Werror -Wall