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:
parent
381c5247e0
commit
42340683af
@ -1,7 +1,7 @@
|
|||||||
/*
|
/*
|
||||||
** Copyright 2004, Axel Dörfler, axeld@pinc-software.de
|
* Copyright 2004-2005, Axel Dörfler, axeld@pinc-software.de
|
||||||
** This file may be used under the terms of the Haiku License.
|
* This file may be used under the terms of the MIT License.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
/* This file contains the module interface to the disk device manager.
|
/* This file contains the module interface to the disk device manager.
|
||||||
* Currently, only the part for identifying and scanning a volume is implemented.
|
* 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)
|
bfs_identify_partition(int fd, partition_data *partition, void **_cookie)
|
||||||
{
|
{
|
||||||
disk_super_block superBlock;
|
disk_super_block superBlock;
|
||||||
if (Volume::Identify(fd, &superBlock) != B_OK)
|
status_t status = Volume::Identify(fd, &superBlock);
|
||||||
return 0.0f;
|
if (status != B_OK)
|
||||||
|
return status;
|
||||||
|
|
||||||
identify_cookie *cookie = new identify_cookie;
|
identify_cookie *cookie = new identify_cookie;
|
||||||
memcpy(&cookie->super_block, &superBlock, sizeof(disk_super_block));
|
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->flags |= B_PARTITION_FILE_SYSTEM;
|
||||||
partition->content_size = cookie->super_block.NumBlocks() * cookie->super_block.BlockSize();
|
partition->content_size = cookie->super_block.NumBlocks() * cookie->super_block.BlockSize();
|
||||||
partition->block_size = cookie->super_block.BlockSize();
|
partition->block_size = cookie->super_block.BlockSize();
|
||||||
|
|
||||||
partition->content_name = strdup(cookie->super_block.name);
|
partition->content_name = strdup(cookie->super_block.name);
|
||||||
|
if (partition->content_name == NULL)
|
||||||
|
return B_NO_MEMORY;
|
||||||
|
|
||||||
return B_OK;
|
return B_OK;
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user