Added an InitCheck() method; if something goes wrong, the device won't be

added to the boot device list anymore. This is currently used to remove
devices that don't support the LBA access mechanism (since CHS support has
still not been implemented).


git-svn-id: file:///srv/svn/repos/haiku/trunk/current@8650 a95241bf-73f2-0310-859d-f6bbb57e9c96
This commit is contained in:
Axel Dörfler 2004-08-25 15:25:08 +00:00
parent b430068a23
commit f191528003
1 changed files with 18 additions and 3 deletions

View File

@ -95,6 +95,8 @@ class BIOSDrive : public Node {
BIOSDrive(uint8 driveID);
virtual ~BIOSDrive();
status_t InitCheck() const;
virtual ssize_t ReadAt(void *cookie, off_t pos, void *buffer, size_t bufferSize);
virtual ssize_t WriteAt(void *cookie, off_t pos, const void *buffer, size_t bufferSize);
@ -219,6 +221,14 @@ BIOSDrive::~BIOSDrive()
}
status_t
BIOSDrive::InitCheck() const
{
return fLBA ? B_OK : B_ERROR;
// ToDo: for now...
}
ssize_t
BIOSDrive::ReadAt(void *cookie, off_t pos, void *buffer, size_t bufferSize)
{
@ -309,7 +319,11 @@ platform_get_boot_device(struct stage2_args *args, Node **_device)
{
printf("boot drive ID: %x\n", gBootDriveID);
Node *drive = new BIOSDrive(gBootDriveID);
BIOSDrive *drive = new BIOSDrive(gBootDriveID);
if (drive->InitCheck() != B_OK) {
puts("no boot drive!");
return B_ERROR;
}
printf("drive size: %Ld bytes\n", drive->Size());
@ -353,3 +367,4 @@ platform_add_block_devices(stage2_args *args, NodeList *devicesList)
return B_OK;
}