* Implemented SetContentName(), and SetContentParameters().
* Added license. * Minor cleanup. git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@24420 a95241bf-73f2-0310-859d-f6bbb57e9c96
This commit is contained in:
@@ -1,4 +1,12 @@
|
|||||||
// KFileSystem.cpp
|
/*
|
||||||
|
* Copyright 2003-2008, Haiku, Inc. All Rights Reserved.
|
||||||
|
* Distributed under the terms of the MIT License.
|
||||||
|
*
|
||||||
|
* Authors:
|
||||||
|
* Ingo Weinhold, [email protected]
|
||||||
|
*/
|
||||||
|
|
||||||
|
#include "KFileSystem.h"
|
||||||
|
|
||||||
#include <fcntl.h>
|
#include <fcntl.h>
|
||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
@@ -7,9 +15,7 @@
|
|||||||
#include <fs_interface.h>
|
#include <fs_interface.h>
|
||||||
|
|
||||||
#include "ddm_modules.h"
|
#include "ddm_modules.h"
|
||||||
//#include "KDiskDeviceJob.h"
|
|
||||||
#include "KDiskDeviceUtils.h"
|
#include "KDiskDeviceUtils.h"
|
||||||
#include "KFileSystem.h"
|
|
||||||
#include "KPartition.h"
|
#include "KPartition.h"
|
||||||
|
|
||||||
|
|
||||||
@@ -54,7 +60,7 @@ KFileSystem::Identify(KPartition *partition, void **cookie)
|
|||||||
if (partition->Open(O_RDONLY, &fd) != B_OK)
|
if (partition->Open(O_RDONLY, &fd) != B_OK)
|
||||||
return -1;
|
return -1;
|
||||||
float result = fModule->identify_partition(fd, partition->PartitionData(),
|
float result = fModule->identify_partition(fd, partition->PartitionData(),
|
||||||
cookie);
|
cookie);
|
||||||
close(fd);
|
close(fd);
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
@@ -82,8 +88,7 @@ KFileSystem::FreeIdentifyCookie(KPartition *partition, void *cookie)
|
|||||||
{
|
{
|
||||||
if (!partition || !fModule || !fModule->free_identify_partition_cookie)
|
if (!partition || !fModule || !fModule->free_identify_partition_cookie)
|
||||||
return;
|
return;
|
||||||
fModule->free_identify_partition_cookie(partition->PartitionData(),
|
fModule->free_identify_partition_cookie(partition->PartitionData(), cookie);
|
||||||
cookie);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@@ -138,8 +143,24 @@ status_t
|
|||||||
KFileSystem::SetContentName(KPartition* partition, const char* name,
|
KFileSystem::SetContentName(KPartition* partition, const char* name,
|
||||||
disk_job_id job)
|
disk_job_id job)
|
||||||
{
|
{
|
||||||
// to be implemented
|
// check parameters
|
||||||
return B_ERROR;
|
if (!partition || !fModule)
|
||||||
|
return B_BAD_VALUE;
|
||||||
|
if (!fModule->set_content_name)
|
||||||
|
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->set_content_name(fd, partition->ID(), name, job);
|
||||||
|
|
||||||
|
// cleanup and return
|
||||||
|
close(fd);
|
||||||
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@@ -148,8 +169,25 @@ status_t
|
|||||||
KFileSystem::SetContentParameters(KPartition* partition,
|
KFileSystem::SetContentParameters(KPartition* partition,
|
||||||
const char* parameters, disk_job_id job)
|
const char* parameters, disk_job_id job)
|
||||||
{
|
{
|
||||||
// to be implemented
|
// check parameters
|
||||||
return B_ERROR;
|
if (!partition || !fModule)
|
||||||
|
return B_BAD_VALUE;
|
||||||
|
if (!fModule->set_content_parameters)
|
||||||
|
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->set_content_parameters(fd, partition->ID(), parameters,
|
||||||
|
job);
|
||||||
|
|
||||||
|
// cleanup and return
|
||||||
|
close(fd);
|
||||||
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user