Now correctly translates the partition block offset into a byte offset.

git-svn-id: file:///srv/svn/repos/haiku/trunk/current@7283 a95241bf-73f2-0310-859d-f6bbb57e9c96
This commit is contained in:
Axel Dörfler 2004-04-21 11:09:33 +00:00
parent 42033342bc
commit 4c03f90f63

View File

@ -100,6 +100,8 @@ class BIOSDrive : public Node {
virtual off_t Size() const;
uint32 BlockSize() const { return fBlockSize; }
protected:
uint8 fDriveID;
bool fLBA;
@ -316,18 +318,21 @@ platform_get_boot_device(struct stage2_args *args, Node **_device)
status_t
platform_get_boot_partition(struct stage2_args *args, NodeList *list,
boot::Partition **_partition)
platform_get_boot_partition(struct stage2_args *args, Node *bootDevice,
NodeList *list, boot::Partition **_partition)
{
printf("boot partition offset: %lu\n", gBootPartitionOffset);
BIOSDrive *drive = static_cast<BIOSDrive *>(bootDevice);
off_t offset = (off_t)gBootPartitionOffset * drive->BlockSize();
printf("boot partition offset: %Ld\n", offset);
NodeIterator iterator = list->Iterator();
boot::Partition *partition = NULL;
while ((partition = (boot::Partition *)iterator.Next()) != NULL) {
// search for the partition that contains the partition
// offset as reported by the BFS boot block
if (gBootPartitionOffset >= partition->offset
&& gBootPartitionOffset < partition->offset + partition->size) {
if (offset >= partition->offset
&& offset < partition->offset + partition->size) {
*_partition = partition;
return B_OK;
}