The identify hook must return an error in case of an error, not 0.0f - or

else the scan partition hook will be called with an invalid cookie.


git-svn-id: file:///srv/svn/repos/haiku/trunk/current@10631 a95241bf-73f2-0310-859d-f6bbb57e9c96
This commit is contained in:
Axel Dörfler 2005-01-10 07:22:36 +00:00
parent 381c5247e0
commit 42340683af

View File

@ -1,7 +1,7 @@
/*
** Copyright 2004, Axel Dörfler, axeld@pinc-software.de
** This file may be used under the terms of the Haiku License.
*/
* Copyright 2004-2005, Axel Dörfler, axeld@pinc-software.de
* This file may be used under the terms of the MIT License.
*/
/* This file contains the module interface to the disk device manager.
* Currently, only the part for identifying and scanning a volume is implemented.
@ -28,8 +28,9 @@ static float
bfs_identify_partition(int fd, partition_data *partition, void **_cookie)
{
disk_super_block superBlock;
if (Volume::Identify(fd, &superBlock) != B_OK)
return 0.0f;
status_t status = Volume::Identify(fd, &superBlock);
if (status != B_OK)
return status;
identify_cookie *cookie = new identify_cookie;
memcpy(&cookie->super_block, &superBlock, sizeof(disk_super_block));
@ -48,8 +49,9 @@ bfs_scan_partition(int fd, partition_data *partition, void *_cookie)
partition->flags |= B_PARTITION_FILE_SYSTEM;
partition->content_size = cookie->super_block.NumBlocks() * cookie->super_block.BlockSize();
partition->block_size = cookie->super_block.BlockSize();
partition->content_name = strdup(cookie->super_block.name);
if (partition->content_name == NULL)
return B_NO_MEMORY;
return B_OK;
}