* Added file_system_module_info::uninitialize() analogously to
partition_module_info::uninitialize(). * Implemented the hook for BFS. * Implemented KFileSystem::Uninitialize(). Fixes failure to initialize a BFS initialized device with an intel partition map. git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@42142 a95241bf-73f2-0310-859d-f6bbb57e9c96
This commit is contained in:
@@ -294,6 +294,8 @@ struct file_system_module_info {
|
|||||||
const char* parameters, disk_job_id job);
|
const char* parameters, disk_job_id job);
|
||||||
status_t (*initialize)(int fd, partition_id partition, const char* name,
|
status_t (*initialize)(int fd, partition_id partition, const char* name,
|
||||||
const char* parameters, off_t partitionSize, disk_job_id job);
|
const char* parameters, off_t partitionSize, disk_job_id job);
|
||||||
|
status_t (*uninitialize)(int fd, partition_id partition,
|
||||||
|
off_t partitionSize, uint32 blockSize, disk_job_id job);
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -326,6 +326,9 @@ typedef struct fssh_file_system_module_info {
|
|||||||
fssh_status_t (*initialize)(int fd, fssh_partition_id partition,
|
fssh_status_t (*initialize)(int fd, fssh_partition_id partition,
|
||||||
const char *name, const char *parameters,
|
const char *name, const char *parameters,
|
||||||
fssh_off_t partitionSize, fssh_disk_job_id job);
|
fssh_off_t partitionSize, fssh_disk_job_id job);
|
||||||
|
fssh_status_t (*uninitialize)(int fd, fssh_partition_id partition,
|
||||||
|
fssh_off_t partitionSize, uint32_t blockSize,
|
||||||
|
fssh_disk_job_id job);
|
||||||
} fssh_file_system_module_info;
|
} fssh_file_system_module_info;
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
/*
|
/*
|
||||||
* Copyright 2003-2007, Haiku, Inc. All Rights Reserved.
|
* Copyright 2003-2011, Haiku, Inc. All Rights Reserved.
|
||||||
* Distributed under the terms of the MIT License.
|
* Distributed under the terms of the MIT License.
|
||||||
*
|
*
|
||||||
* Authors:
|
* Authors:
|
||||||
@@ -53,6 +53,8 @@ public:
|
|||||||
virtual status_t Initialize(KPartition* partition,
|
virtual status_t Initialize(KPartition* partition,
|
||||||
const char* name, const char* parameters,
|
const char* name, const char* parameters,
|
||||||
disk_job_id job);
|
disk_job_id job);
|
||||||
|
virtual status_t Uninitialize(KPartition* partition,
|
||||||
|
disk_job_id job);
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
virtual status_t LoadModule();
|
virtual status_t LoadModule();
|
||||||
|
|||||||
@@ -2293,6 +2293,28 @@ bfs_initialize(int fd, partition_id partitionID, const char* name,
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
static status_t
|
||||||
|
bfs_uninitialize(int fd, partition_id partitionID, off_t partitionSize,
|
||||||
|
uint32 blockSize, disk_job_id job)
|
||||||
|
{
|
||||||
|
if (blockSize == 0)
|
||||||
|
return B_BAD_VALUE;
|
||||||
|
|
||||||
|
update_disk_device_job_progress(job, 0.0);
|
||||||
|
|
||||||
|
// just overwrite the superblock
|
||||||
|
disk_super_block superBlock;
|
||||||
|
memset(&superBlock, 0, sizeof(superBlock));
|
||||||
|
|
||||||
|
if (write_pos(fd, 512, &superBlock, sizeof(superBlock)) < 0)
|
||||||
|
return errno;
|
||||||
|
|
||||||
|
update_disk_device_job_progress(job, 1.0);
|
||||||
|
|
||||||
|
return B_OK;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
// #pragma mark -
|
// #pragma mark -
|
||||||
|
|
||||||
|
|
||||||
@@ -2477,6 +2499,7 @@ static file_system_module_info sBeFileSystem = {
|
|||||||
NULL, // set_content_name
|
NULL, // set_content_name
|
||||||
NULL, // set_content_parameters
|
NULL, // set_content_parameters
|
||||||
bfs_initialize,
|
bfs_initialize,
|
||||||
|
bfs_uninitialize
|
||||||
};
|
};
|
||||||
|
|
||||||
module_info* modules[] = {
|
module_info* modules[] = {
|
||||||
|
|||||||
@@ -1,9 +1,9 @@
|
|||||||
/*
|
/*
|
||||||
* Copyright 2003-2008, Haiku, Inc. All Rights Reserved.
|
* Copyright 2003-2011, Haiku, Inc. All Rights Reserved.
|
||||||
* Distributed under the terms of the MIT License.
|
* Distributed under the terms of the MIT License.
|
||||||
*
|
*
|
||||||
* Authors:
|
* Authors:
|
||||||
* Ingo Weinhold, bonefish@cs.tu-berlin.de
|
* Ingo Weinhold, ingo_weinhold@gmx.de
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#include "KFileSystem.h"
|
#include "KFileSystem.h"
|
||||||
@@ -221,6 +221,31 @@ KFileSystem::Initialize(KPartition* partition, const char* name,
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
status_t
|
||||||
|
KFileSystem::Uninitialize(KPartition* partition, disk_job_id job)
|
||||||
|
{
|
||||||
|
// check parameters
|
||||||
|
if (partition == NULL || fModule == NULL)
|
||||||
|
return B_BAD_VALUE;
|
||||||
|
if (fModule->uninitialize == NULL)
|
||||||
|
return B_NOT_SUPPORTED;
|
||||||
|
|
||||||
|
// open partition device
|
||||||
|
int fd = -1;
|
||||||
|
status_t result = partition->Open(O_RDWR, &fd);
|
||||||
|
if (result != B_OK)
|
||||||
|
return result;
|
||||||
|
|
||||||
|
// let the module do its job
|
||||||
|
result = fModule->uninitialize(fd, partition->ID(), partition->Size(),
|
||||||
|
partition->BlockSize(), job);
|
||||||
|
|
||||||
|
// cleanup and return
|
||||||
|
close(fd);
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
// LoadModule
|
// LoadModule
|
||||||
status_t
|
status_t
|
||||||
KFileSystem::LoadModule()
|
KFileSystem::LoadModule()
|
||||||
|
|||||||
Reference in New Issue
Block a user