* Removed no longer needed disk device related syscalls
(_kern_{supports,validate}_*(), etc.). * Adjusted the prototypes of the disk device modification syscalls. Commented out their implementations for the time -- they'll mostly have to be rewritten completely. * Implemented the userland disk device jobs. git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@22781 a95241bf-73f2-0310-859d-f6bbb57e9c96
This commit is contained in:
parent
61291964c3
commit
300868ce27
@ -86,133 +86,48 @@ status_t _user_get_next_disk_system_info(int32 *cookie,
|
||||
user_disk_system_info *info);
|
||||
status_t _user_find_disk_system(const char *name, user_disk_system_info *info);
|
||||
|
||||
bool _user_supports_defragmenting_partition(partition_id partitionID,
|
||||
int32 changeCounter,
|
||||
bool *whileMounted);
|
||||
bool _user_supports_repairing_partition(partition_id partitionID,
|
||||
int32 changeCounter, bool checkOnly,
|
||||
bool *whileMounted);
|
||||
bool _user_supports_resizing_partition(partition_id partitionID,
|
||||
int32 changeCounter,
|
||||
bool *canResizeContents,
|
||||
bool *whileMounted);
|
||||
bool _user_supports_moving_partition(partition_id partitionID,
|
||||
int32 changeCounter,
|
||||
partition_id *unmovable,
|
||||
partition_id *needUnmounting,
|
||||
size_t bufferSize);
|
||||
bool _user_supports_setting_partition_name(partition_id partitionID,
|
||||
int32 changeCounter);
|
||||
bool _user_supports_setting_partition_content_name(partition_id partitionID,
|
||||
int32 changeCounter,
|
||||
bool *whileMounted);
|
||||
bool _user_supports_setting_partition_type(partition_id partitionID,
|
||||
int32 changeCounter);
|
||||
bool _user_supports_setting_partition_parameters(partition_id partitionID,
|
||||
int32 changeCounter);
|
||||
bool _user_supports_setting_partition_content_parameters(
|
||||
partition_id partitionID, int32 changeCounter, bool *whileMounted);
|
||||
bool _user_supports_initializing_partition(partition_id partitionID,
|
||||
int32 changeCounter,
|
||||
const char *diskSystemName);
|
||||
bool _user_supports_creating_child_partition(partition_id partitionID,
|
||||
int32 changeCounter);
|
||||
bool _user_supports_deleting_child_partition(partition_id partitionID,
|
||||
int32 changeCounter);
|
||||
bool _user_is_sub_disk_system_for(disk_system_id diskSystemID,
|
||||
partition_id partitionID,
|
||||
int32 changeCounter);
|
||||
|
||||
status_t _user_validate_resize_partition(partition_id partitionID,
|
||||
int32 changeCounter, off_t *size);
|
||||
status_t _user_validate_move_partition(partition_id partitionID,
|
||||
int32 changeCounter, off_t *newOffset);
|
||||
status_t _user_validate_set_partition_name(partition_id partitionID,
|
||||
int32 changeCounter, char *name);
|
||||
status_t _user_validate_set_partition_content_name(partition_id partitionID,
|
||||
int32 changeCounter,
|
||||
char *name);
|
||||
status_t _user_validate_set_partition_type(partition_id partitionID,
|
||||
int32 changeCounter,
|
||||
const char *type);
|
||||
status_t _user_validate_initialize_partition(partition_id partitionID,
|
||||
int32 changeCounter,
|
||||
const char *diskSystemName,
|
||||
char *name,
|
||||
const char *parameters,
|
||||
size_t parametersSize);
|
||||
status_t _user_validate_create_child_partition(partition_id partitionID,
|
||||
int32 changeCounter,
|
||||
off_t *offset, off_t *size,
|
||||
const char *type,
|
||||
const char *parameters,
|
||||
size_t parametersSize);
|
||||
status_t _user_get_partitionable_spaces(partition_id partitionID,
|
||||
int32 changeCounter,
|
||||
partitionable_space_data *buffer,
|
||||
int32 count, int32 *actualCount);
|
||||
status_t _user_get_next_supported_partition_type(partition_id partitionID,
|
||||
int32 changeCounter,
|
||||
int32 *cookie, char *type);
|
||||
status_t _user_get_partition_type_for_content_type(disk_system_id diskSystemID,
|
||||
const char *contentType,
|
||||
char *type);
|
||||
|
||||
// disk device modification
|
||||
status_t _user_prepare_disk_device_modifications(partition_id deviceID);
|
||||
status_t _user_commit_disk_device_modifications(partition_id deviceID,
|
||||
port_id port, int32 token,
|
||||
bool completeProgress);
|
||||
status_t _user_cancel_disk_device_modifications(partition_id deviceID);
|
||||
bool _user_is_disk_device_modified(partition_id deviceID);
|
||||
|
||||
status_t _user_defragment_partition(partition_id partitionID,
|
||||
int32 changeCounter);
|
||||
status_t _user_repair_partition(partition_id partitionID, int32 changeCounter,
|
||||
bool checkOnly);
|
||||
status_t _user_resize_partition(partition_id partitionID, int32 changeCounter,
|
||||
off_t size);
|
||||
status_t _user_move_partition(partition_id partitionID, int32 changeCounter,
|
||||
off_t newOffset);
|
||||
int32* changeCounter);
|
||||
status_t _user_repair_partition(partition_id partitionID, int32* changeCounter,
|
||||
bool checkOnly);
|
||||
status_t _user_resize_partition(partition_id partitionID, int32* changeCounter,
|
||||
partition_id childID, int32* childChangeCounter, off_t size,
|
||||
off_t contentSize);
|
||||
status_t _user_move_partition(partition_id partitionID, int32* changeCounter,
|
||||
partition_id childID, int32* childChangeCounter,
|
||||
off_t newOffset, partition_id* descendantIDs,
|
||||
int32* descendantChangeCounters, int32 descendantCount);
|
||||
status_t _user_set_partition_name(partition_id partitionID,
|
||||
int32 changeCounter, const char *name);
|
||||
int32* changeCounter, partition_id childID,
|
||||
int32* childChangeCounter, const char* name);
|
||||
status_t _user_set_partition_content_name(partition_id partitionID,
|
||||
int32 changeCounter,
|
||||
const char *name);
|
||||
int32* changeCounter, const char* name);
|
||||
status_t _user_set_partition_type(partition_id partitionID,
|
||||
int32 changeCounter, const char *type);
|
||||
int32* changeCounter, partition_id childID,
|
||||
int32* childChangeCounter, const char* type);
|
||||
status_t _user_set_partition_parameters(partition_id partitionID,
|
||||
int32 changeCounter,
|
||||
const char *parameters,
|
||||
size_t parametersSize);
|
||||
int32* changeCounter, partition_id childID,
|
||||
int32* childChangeCounter, const char* parameters,
|
||||
size_t parametersSize);
|
||||
status_t _user_set_partition_content_parameters(partition_id partitionID,
|
||||
int32 changeCounter,
|
||||
const char *parameters,
|
||||
size_t parametersSize);
|
||||
int32* changeCounter, const char* parameters,
|
||||
size_t parametersSize);
|
||||
status_t _user_initialize_partition(partition_id partitionID,
|
||||
int32 changeCounter,
|
||||
const char *diskSystemName,
|
||||
const char *name, const char *parameters,
|
||||
size_t parametersSize);
|
||||
int32* changeCounter, const char* diskSystemName,
|
||||
const char* name, const char* parameters,
|
||||
size_t parametersSize);
|
||||
status_t _user_uninitialize_partition(partition_id partitionID,
|
||||
int32 changeCounter);
|
||||
status_t _user_create_child_partition(partition_id partitionID,
|
||||
int32 changeCounter, off_t offset,
|
||||
off_t size, const char *type,
|
||||
const char *parameters,
|
||||
size_t parametersSize,
|
||||
partition_id *childID);
|
||||
status_t _user_delete_partition(partition_id partitionID, int32 changeCounter);
|
||||
int32* changeCounter);
|
||||
|
||||
// jobs
|
||||
status_t _user_get_next_disk_device_job_info(int32 *cookie,
|
||||
user_disk_device_job_info *info);
|
||||
status_t _user_get_disk_device_job_info(disk_job_id id,
|
||||
user_disk_device_job_info *info);
|
||||
status_t _user_get_disk_device_job_progress_info(disk_job_id id,
|
||||
disk_device_job_progress_info *info);
|
||||
status_t _user_pause_disk_device_job(disk_job_id id);
|
||||
status_t _user_cancel_disk_device_job(disk_job_id id, bool reverse);
|
||||
status_t _user_create_child_partition(partition_id partitionID,
|
||||
int32* changeCounter, off_t offset, off_t size,
|
||||
const char* type, const char* name, const char* parameters,
|
||||
size_t parametersSize, partition_id* childID,
|
||||
int32* childChangeCounter);
|
||||
status_t _user_delete_child_partition(partition_id partitionID,
|
||||
int32* changeCounter, partition_id childID,
|
||||
int32 childChangeCounter);
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
|
@ -340,107 +340,50 @@ extern status_t _kern_get_next_disk_system_info(int32 *cookie,
|
||||
struct user_disk_system_info *info);
|
||||
extern status_t _kern_find_disk_system(const char *name,
|
||||
struct user_disk_system_info *info);
|
||||
extern bool _kern_supports_defragmenting_partition(partition_id partitionID,
|
||||
int32 changeCounter, bool *whileMounted);
|
||||
extern bool _kern_supports_repairing_partition(partition_id partitionID,
|
||||
int32 changeCounter, bool checkOnly, bool *whileMounted);
|
||||
extern bool _kern_supports_resizing_partition(partition_id partitionID,
|
||||
int32 changeCounter, bool *canResizeContents, bool *whileMounted);
|
||||
extern bool _kern_supports_moving_partition(partition_id partitionID,
|
||||
int32 changeCounter, partition_id *unmovable,
|
||||
partition_id *needUnmounting, size_t bufferSize);
|
||||
extern bool _kern_supports_setting_partition_name(partition_id partitionID,
|
||||
int32 changeCounter);
|
||||
extern bool _kern_supports_setting_partition_content_name(partition_id partitionID,
|
||||
int32 changeCounter, bool *whileMounted);
|
||||
extern bool _kern_supports_setting_partition_type(partition_id partitionID,
|
||||
int32 changeCounter);
|
||||
extern bool _kern_supports_setting_partition_parameters(partition_id partitionID,
|
||||
int32 changeCounter);
|
||||
extern bool _kern_supports_setting_partition_content_parameters(
|
||||
partition_id partitionID, int32 changeCounter, bool *whileMounted);
|
||||
extern bool _kern_supports_initializing_partition(partition_id partitionID,
|
||||
int32 changeCounter, const char *diskSystemName);
|
||||
extern bool _kern_supports_creating_child_partition(partition_id partitionID,
|
||||
int32 changeCounter);
|
||||
extern bool _kern_supports_deleting_child_partition(partition_id partitionID,
|
||||
int32 changeCounter);
|
||||
extern bool _kern_is_sub_disk_system_for(disk_system_id diskSystemID,
|
||||
partition_id partitionID, int32 changeCounter);
|
||||
|
||||
extern status_t _kern_validate_resize_partition(partition_id partitionID,
|
||||
int32 changeCounter, off_t *size);
|
||||
extern status_t _kern_validate_move_partition(partition_id partitionID,
|
||||
int32 changeCounter, off_t *newOffset);
|
||||
extern status_t _kern_validate_set_partition_name(partition_id partitionID,
|
||||
int32 changeCounter, char *name);
|
||||
extern status_t _kern_validate_set_partition_content_name(partition_id partitionID,
|
||||
int32 changeCounter, char *name);
|
||||
extern status_t _kern_validate_set_partition_type(partition_id partitionID,
|
||||
int32 changeCounter, const char *type);
|
||||
extern status_t _kern_validate_initialize_partition(partition_id partitionID,
|
||||
int32 changeCounter, const char *diskSystemName,
|
||||
char *name, const char *parameters, size_t parametersSize);
|
||||
extern status_t _kern_validate_create_child_partition(partition_id partitionID,
|
||||
int32 changeCounter, off_t *offset, off_t *size,
|
||||
const char *type, const char *parameters,
|
||||
size_t parametersSize);
|
||||
extern status_t _kern_get_partitionable_spaces(partition_id partitionID,
|
||||
int32 changeCounter,
|
||||
struct partitionable_space_data *buffer, int32 count,
|
||||
int32 *actualCount);
|
||||
extern status_t _kern_get_next_supported_partition_type(partition_id partitionID,
|
||||
int32 changeCounter, int32 *cookie, char *type);
|
||||
extern status_t _kern_get_partition_type_for_content_type(disk_system_id diskSystemID,
|
||||
const char *contentType, char *type);
|
||||
|
||||
// disk device modification
|
||||
extern status_t _kern_prepare_disk_device_modifications(partition_id deviceID);
|
||||
extern status_t _kern_commit_disk_device_modifications(partition_id deviceID,
|
||||
port_id port, int32 token, bool completeProgress);
|
||||
extern status_t _kern_cancel_disk_device_modifications(partition_id deviceID);
|
||||
extern bool _kern_is_disk_device_modified(partition_id deviceID);
|
||||
extern status_t _kern_defragment_partition(partition_id partitionID,
|
||||
int32 changeCounter);
|
||||
extern status_t _kern_repair_partition(partition_id partitionID, int32 changeCounter,
|
||||
bool checkOnly);
|
||||
extern status_t _kern_resize_partition(partition_id partitionID, int32 changeCounter,
|
||||
off_t size);
|
||||
extern status_t _kern_move_partition(partition_id partitionID, int32 changeCounter,
|
||||
off_t newOffset);
|
||||
int32* changeCounter);
|
||||
extern status_t _kern_repair_partition(partition_id partitionID,
|
||||
int32* changeCounter, bool checkOnly);
|
||||
extern status_t _kern_resize_partition(partition_id partitionID,
|
||||
int32* changeCounter, partition_id childID,
|
||||
int32* childChangeCounter, off_t size,
|
||||
off_t contentSize);
|
||||
extern status_t _kern_move_partition(partition_id partitionID,
|
||||
int32* changeCounter, partition_id childID,
|
||||
int32* childChangeCounter, off_t newOffset,
|
||||
partition_id* descendantIDs,
|
||||
int32* descendantChangeCounters, int32 descendantCount);
|
||||
extern status_t _kern_set_partition_name(partition_id partitionID,
|
||||
int32 changeCounter, const char *name);
|
||||
int32* changeCounter, partition_id childID,
|
||||
int32* childChangeCounter, const char* name);
|
||||
extern status_t _kern_set_partition_content_name(partition_id partitionID,
|
||||
int32 changeCounter, const char *name);
|
||||
int32* changeCounter, const char* name);
|
||||
extern status_t _kern_set_partition_type(partition_id partitionID,
|
||||
int32 changeCounter, const char *type);
|
||||
int32* changeCounter, partition_id childID,
|
||||
int32* childChangeCounter, const char* type);
|
||||
extern status_t _kern_set_partition_parameters(partition_id partitionID,
|
||||
int32 changeCounter, const char *parameters,
|
||||
size_t parametersSize);
|
||||
extern status_t _kern_set_partition_content_parameters(partition_id partitionID,
|
||||
int32 changeCounter, const char *parameters,
|
||||
int32* changeCounter, partition_id childID,
|
||||
int32* childChangeCounter, const char* parameters,
|
||||
size_t parametersSize);
|
||||
extern status_t _kern_set_partition_content_parameters(
|
||||
partition_id partitionID, int32* changeCounter,
|
||||
const char* parameters, size_t parametersSize);
|
||||
extern status_t _kern_initialize_partition(partition_id partitionID,
|
||||
int32 changeCounter, const char *diskSystemName,
|
||||
const char *name, const char *parameters,
|
||||
int32* changeCounter, const char* diskSystemName,
|
||||
const char* name, const char* parameters,
|
||||
size_t parametersSize);
|
||||
extern status_t _kern_uninitialize_partition(partition_id partitionID,
|
||||
int32 changeCounter);
|
||||
int32* changeCounter);
|
||||
extern status_t _kern_create_child_partition(partition_id partitionID,
|
||||
int32 changeCounter, off_t offset, off_t size, const char *type,
|
||||
const char *parameters, size_t parametersSize,
|
||||
partition_id *childID);
|
||||
extern status_t _kern_delete_partition(partition_id partitionID, int32 changeCounter);
|
||||
|
||||
// jobs
|
||||
extern status_t _kern_get_next_disk_device_job_info(int32 *cookie,
|
||||
struct user_disk_device_job_info *info);
|
||||
extern status_t _kern_get_disk_device_job_info(disk_job_id id,
|
||||
struct user_disk_device_job_info *info);
|
||||
extern status_t _kern_get_disk_device_job_progress_info(disk_job_id id,
|
||||
struct disk_device_job_progress_info *info);
|
||||
extern status_t _kern_pause_disk_device_job(disk_job_id id);
|
||||
extern status_t _kern_cancel_disk_device_job(disk_job_id id, bool reverse);
|
||||
int32* changeCounter, off_t offset, off_t size,
|
||||
const char* type, const char* name,
|
||||
const char* parameters, size_t parametersSize,
|
||||
partition_id* childID, int32* childChangeCounter);
|
||||
extern status_t _kern_delete_child_partition(partition_id partitionID,
|
||||
int32* changeCounter, partition_id childID,
|
||||
int32 childChangeCounter);
|
||||
|
||||
#if 0
|
||||
|
||||
|
@ -29,9 +29,6 @@ public:
|
||||
int32 CountPartitionableSpaces() const;
|
||||
|
||||
private:
|
||||
status_t _SetTo(partition_id partition,
|
||||
int32 changeCounter);
|
||||
|
||||
status_t _InsertSpaces(int32 index, int32 count);
|
||||
void _RemoveSpaces(int32 index, int32 count);
|
||||
|
||||
|
@ -7,7 +7,7 @@
|
||||
|
||||
|
||||
// constructor
|
||||
PartitionReference::PartitionReference(partition_id id, uint32 changeCounter)
|
||||
PartitionReference::PartitionReference(partition_id id, int32 changeCounter)
|
||||
: Referenceable(true), // delete when unreferenced
|
||||
fID(id),
|
||||
fChangeCounter(changeCounter)
|
||||
@ -21,6 +21,15 @@ PartitionReference::~PartitionReference()
|
||||
}
|
||||
|
||||
|
||||
// SetTo
|
||||
void
|
||||
PartitionReference::SetTo(partition_id id, int32 changeCounter)
|
||||
{
|
||||
fID = id;
|
||||
fChangeCounter = changeCounter;
|
||||
}
|
||||
|
||||
|
||||
// PartitionID
|
||||
partition_id
|
||||
PartitionReference::PartitionID() const
|
||||
@ -38,7 +47,7 @@ PartitionReference::SetPartitionID(partition_id id)
|
||||
|
||||
|
||||
// ChangeCounter
|
||||
uint32
|
||||
int32
|
||||
PartitionReference::ChangeCounter() const
|
||||
{
|
||||
return fChangeCounter;
|
||||
@ -47,7 +56,7 @@ PartitionReference::ChangeCounter() const
|
||||
|
||||
// SetChangeCounter
|
||||
void
|
||||
PartitionReference::SetChangeCounter(uint32 counter)
|
||||
PartitionReference::SetChangeCounter(int32 counter)
|
||||
{
|
||||
fChangeCounter = counter;
|
||||
}
|
||||
|
@ -16,18 +16,20 @@ namespace BPrivate {
|
||||
class PartitionReference : public Referenceable {
|
||||
public:
|
||||
PartitionReference(partition_id id = -1,
|
||||
uint32 changeCounter = 0);
|
||||
int32 changeCounter = 0);
|
||||
~PartitionReference();
|
||||
|
||||
void SetTo(partition_id id, int32 changeCounter);
|
||||
|
||||
partition_id PartitionID() const;
|
||||
void SetPartitionID(partition_id id);
|
||||
|
||||
uint32 ChangeCounter() const;
|
||||
void SetChangeCounter(uint32 counter);
|
||||
int32 ChangeCounter() const;
|
||||
void SetChangeCounter(int32 counter);
|
||||
|
||||
private:
|
||||
partition_id fID;
|
||||
uint32 fChangeCounter;
|
||||
int32 fChangeCounter;
|
||||
};
|
||||
|
||||
|
||||
|
@ -170,45 +170,6 @@ BPartitioningInfo::CountPartitionableSpaces() const
|
||||
}
|
||||
|
||||
|
||||
// _SetTo
|
||||
status_t
|
||||
BPartitioningInfo::_SetTo(partition_id partition, int32 changeCounter)
|
||||
{
|
||||
Unset();
|
||||
|
||||
status_t error = B_OK;
|
||||
partitionable_space_data* buffer = NULL;
|
||||
int32 count = 0;
|
||||
int32 actualCount = 0;
|
||||
while (true) {
|
||||
error = _kern_get_partitionable_spaces(partition, changeCounter,
|
||||
buffer, count, &actualCount);
|
||||
if (error != B_BUFFER_OVERFLOW)
|
||||
break;
|
||||
|
||||
// buffer too small re-allocate it
|
||||
delete[] buffer;
|
||||
buffer = new(nothrow) partitionable_space_data[actualCount];
|
||||
if (!buffer) {
|
||||
error = B_NO_MEMORY;
|
||||
break;
|
||||
}
|
||||
|
||||
count = actualCount;
|
||||
}
|
||||
|
||||
// set data / cleanup on failure
|
||||
if (error == B_OK) {
|
||||
fPartitionID = partition;
|
||||
fSpaces = buffer;
|
||||
fCount = actualCount;
|
||||
} else if (buffer)
|
||||
delete[] buffer;
|
||||
|
||||
return error;
|
||||
}
|
||||
|
||||
|
||||
// _InsertSpaces
|
||||
status_t
|
||||
BPartitioningInfo::_InsertSpaces(int32 index, int32 count)
|
||||
|
@ -5,6 +5,8 @@
|
||||
|
||||
#include "CreateChildJob.h"
|
||||
|
||||
#include <syscalls.h>
|
||||
|
||||
#include "DiskDeviceUtils.h"
|
||||
#include "PartitionReference.h"
|
||||
|
||||
@ -51,7 +53,18 @@ CreateChildJob::Init(off_t offset, off_t size, const char* type,
|
||||
status_t
|
||||
CreateChildJob::Do()
|
||||
{
|
||||
// Implement!
|
||||
return B_BAD_VALUE;
|
||||
int32 changeCounter = fPartition->ChangeCounter();
|
||||
partition_id childID;
|
||||
int32 childChangeCounter;
|
||||
status_t error = _kern_create_child_partition(fPartition->PartitionID(),
|
||||
&changeCounter, fOffset, fSize, fType, fName, fParameters,
|
||||
fParameters ? strlen(fParameters) : 0, &childID, &childChangeCounter);
|
||||
if (error != B_OK)
|
||||
return error;
|
||||
|
||||
fPartition->SetChangeCounter(changeCounter);
|
||||
fChild->SetTo(childID, childChangeCounter);
|
||||
|
||||
return B_OK;
|
||||
}
|
||||
|
||||
|
@ -5,6 +5,8 @@
|
||||
|
||||
#include "DefragmentJob.h"
|
||||
|
||||
#include <syscalls.h>
|
||||
|
||||
#include "PartitionReference.h"
|
||||
|
||||
|
||||
@ -25,7 +27,14 @@ DefragmentJob::~DefragmentJob()
|
||||
status_t
|
||||
DefragmentJob::Do()
|
||||
{
|
||||
// Implement!
|
||||
return B_BAD_VALUE;
|
||||
int32 changeCounter = fPartition->ChangeCounter();
|
||||
status_t error = _kern_defragment_partition(fPartition->PartitionID(),
|
||||
&changeCounter);
|
||||
if (error != B_OK)
|
||||
return error;
|
||||
|
||||
fPartition->SetChangeCounter(changeCounter);
|
||||
|
||||
return B_OK;
|
||||
}
|
||||
|
||||
|
@ -5,6 +5,8 @@
|
||||
|
||||
#include "DeleteChildJob.h"
|
||||
|
||||
#include <syscalls.h>
|
||||
|
||||
#include "DiskDeviceUtils.h"
|
||||
#include "PartitionReference.h"
|
||||
|
||||
@ -27,7 +29,15 @@ DeleteChildJob::~DeleteChildJob()
|
||||
status_t
|
||||
DeleteChildJob::Do()
|
||||
{
|
||||
// Implement!
|
||||
return B_BAD_VALUE;
|
||||
int32 changeCounter = fPartition->ChangeCounter();
|
||||
status_t error = _kern_delete_child_partition(fPartition->PartitionID(),
|
||||
&changeCounter, fChild->PartitionID(), fChild->ChangeCounter());
|
||||
if (error != B_OK)
|
||||
return error;
|
||||
|
||||
fPartition->SetChangeCounter(changeCounter);
|
||||
fChild->SetTo(-1, 0);
|
||||
|
||||
return B_OK;
|
||||
}
|
||||
|
||||
|
@ -5,6 +5,8 @@
|
||||
|
||||
#include "InitializeJob.h"
|
||||
|
||||
#include <syscalls.h>
|
||||
|
||||
#include "DiskDeviceUtils.h"
|
||||
#include "PartitionReference.h"
|
||||
|
||||
@ -45,7 +47,16 @@ InitializeJob::Init(const char* diskSystem, const char* name,
|
||||
status_t
|
||||
InitializeJob::Do()
|
||||
{
|
||||
// Implement!
|
||||
return B_BAD_VALUE;
|
||||
int32 changeCounter = fPartition->ChangeCounter();
|
||||
status_t error = _kern_initialize_partition(fPartition->PartitionID(),
|
||||
&changeCounter, fDiskSystem, fName, fParameters,
|
||||
fParameters ? strlen(fParameters) : 0);
|
||||
|
||||
if (error != B_OK)
|
||||
return error;
|
||||
|
||||
fPartition->SetChangeCounter(changeCounter);
|
||||
|
||||
return B_OK;
|
||||
}
|
||||
|
||||
|
@ -3,9 +3,13 @@
|
||||
* Distributed under the terms of the MIT License.
|
||||
*/
|
||||
|
||||
#include "MoveJob.h"
|
||||
|
||||
#include <new>
|
||||
|
||||
#include "MoveJob.h"
|
||||
#include <AutoDeleter.h>
|
||||
|
||||
#include <syscalls.h>
|
||||
|
||||
#include "DiskDeviceUtils.h"
|
||||
#include "PartitionReference.h"
|
||||
@ -58,7 +62,35 @@ MoveJob::Init(off_t offset, PartitionReference** contents, int32 contentsCount)
|
||||
status_t
|
||||
MoveJob::Do()
|
||||
{
|
||||
// Implement!
|
||||
return B_BAD_VALUE;
|
||||
int32 changeCounter = fPartition->ChangeCounter();
|
||||
int32 childChangeCounter = fChild->ChangeCounter();
|
||||
|
||||
partition_id* descendantIDs = new(nothrow) partition_id[fContentsCount];
|
||||
int32* descendantChangeCounters = new(nothrow) int32[fContentsCount];
|
||||
ArrayDeleter<partition_id> _(descendantIDs);
|
||||
ArrayDeleter<int32> _2(descendantChangeCounters);
|
||||
|
||||
if (!descendantIDs || !descendantChangeCounters)
|
||||
return B_NO_MEMORY;
|
||||
|
||||
for (int32 i = 0; i < fContentsCount; i++) {
|
||||
descendantIDs[i] = fContents[i]->PartitionID();
|
||||
descendantChangeCounters[i] = fContents[i]->ChangeCounter();
|
||||
}
|
||||
|
||||
status_t error = _kern_move_partition(fPartition->PartitionID(),
|
||||
&changeCounter, fChild->PartitionID(), &childChangeCounter, fOffset,
|
||||
descendantIDs, descendantChangeCounters, fContentsCount);
|
||||
|
||||
if (error != B_OK)
|
||||
return error;
|
||||
|
||||
fPartition->SetChangeCounter(changeCounter);
|
||||
fChild->SetChangeCounter(childChangeCounter);
|
||||
|
||||
for (int32 i = 0; i < fContentsCount; i++)
|
||||
fContents[i]->SetChangeCounter(descendantChangeCounters[i]);
|
||||
|
||||
return B_OK;
|
||||
}
|
||||
|
||||
|
@ -5,6 +5,8 @@
|
||||
|
||||
#include "RepairJob.h"
|
||||
|
||||
#include <syscalls.h>
|
||||
|
||||
#include "PartitionReference.h"
|
||||
|
||||
|
||||
@ -26,7 +28,14 @@ RepairJob::~RepairJob()
|
||||
status_t
|
||||
RepairJob::Do()
|
||||
{
|
||||
// Implement!
|
||||
return B_BAD_VALUE;
|
||||
int32 changeCounter = fPartition->ChangeCounter();
|
||||
status_t error = _kern_repair_partition(fPartition->PartitionID(),
|
||||
&changeCounter, fCheckOnly);
|
||||
if (error != B_OK)
|
||||
return error;
|
||||
|
||||
fPartition->SetChangeCounter(changeCounter);
|
||||
|
||||
return B_OK;
|
||||
}
|
||||
|
||||
|
@ -5,6 +5,8 @@
|
||||
|
||||
#include "ResizeJob.h"
|
||||
|
||||
#include <syscalls.h>
|
||||
|
||||
#include "DiskDeviceUtils.h"
|
||||
#include "PartitionReference.h"
|
||||
|
||||
@ -29,7 +31,17 @@ ResizeJob::~ResizeJob()
|
||||
status_t
|
||||
ResizeJob::Do()
|
||||
{
|
||||
// Implement!
|
||||
return B_BAD_VALUE;
|
||||
int32 changeCounter = fPartition->ChangeCounter();
|
||||
int32 childChangeCounter = fChild->ChangeCounter();
|
||||
status_t error = _kern_resize_partition(fPartition->PartitionID(),
|
||||
&changeCounter, fChild->PartitionID(), &childChangeCounter, fSize,
|
||||
fContentSize);
|
||||
if (error != B_OK)
|
||||
return error;
|
||||
|
||||
fPartition->SetChangeCounter(changeCounter);
|
||||
fChild->SetChangeCounter(childChangeCounter);
|
||||
|
||||
return B_OK;
|
||||
}
|
||||
|
||||
|
@ -5,6 +5,8 @@
|
||||
|
||||
#include "SetStringJob.h"
|
||||
|
||||
#include <syscalls.h>
|
||||
|
||||
#include "DiskDeviceUtils.h"
|
||||
#include "PartitionReference.h"
|
||||
|
||||
@ -51,7 +53,50 @@ SetStringJob::Init(const char* string, uint32 jobType)
|
||||
status_t
|
||||
SetStringJob::Do()
|
||||
{
|
||||
// Implement!
|
||||
return B_BAD_VALUE;
|
||||
int32 changeCounter = fPartition->ChangeCounter();
|
||||
int32 childChangeCounter = (fChild ? fChild->ChangeCounter() : 0);
|
||||
status_t error;
|
||||
bool updateChildChangeCounter = false;
|
||||
|
||||
switch (fJobType) {
|
||||
case B_DISK_DEVICE_JOB_SET_NAME:
|
||||
error = _kern_set_partition_name(fPartition->PartitionID(),
|
||||
&changeCounter, fChild->PartitionID(), &childChangeCounter,
|
||||
fString);
|
||||
updateChildChangeCounter = true;
|
||||
break;
|
||||
case B_DISK_DEVICE_JOB_SET_CONTENT_NAME:
|
||||
error = _kern_set_partition_content_name(fPartition->PartitionID(),
|
||||
&changeCounter, fString);
|
||||
break;
|
||||
case B_DISK_DEVICE_JOB_SET_TYPE:
|
||||
error = _kern_set_partition_type(fPartition->PartitionID(),
|
||||
&changeCounter, fChild->PartitionID(), &childChangeCounter,
|
||||
fString);
|
||||
updateChildChangeCounter = true;
|
||||
break;
|
||||
case B_DISK_DEVICE_JOB_SET_PARAMETERS:
|
||||
error = _kern_set_partition_parameters(fPartition->PartitionID(),
|
||||
&changeCounter, fChild->PartitionID(), &childChangeCounter,
|
||||
fString, fString ? strlen(fString) : 0);
|
||||
updateChildChangeCounter = true;
|
||||
break;
|
||||
case B_DISK_DEVICE_JOB_SET_CONTENT_PARAMETERS:
|
||||
error = _kern_set_partition_content_parameters(
|
||||
fPartition->PartitionID(), &changeCounter, fString,
|
||||
fString ? strlen(fString) : 0);
|
||||
break;
|
||||
default:
|
||||
return B_BAD_VALUE;
|
||||
}
|
||||
|
||||
if (error != B_OK)
|
||||
return error;
|
||||
|
||||
fPartition->SetChangeCounter(changeCounter);
|
||||
if (updateChildChangeCounter)
|
||||
fChild->SetChangeCounter(childChangeCounter);
|
||||
|
||||
return B_OK;
|
||||
}
|
||||
|
||||
|
@ -5,6 +5,8 @@
|
||||
|
||||
#include "UninitializeJob.h"
|
||||
|
||||
#include <syscalls.h>
|
||||
|
||||
#include "PartitionReference.h"
|
||||
|
||||
|
||||
@ -25,7 +27,15 @@ UninitializeJob::~UninitializeJob()
|
||||
status_t
|
||||
UninitializeJob::Do()
|
||||
{
|
||||
// Implement!
|
||||
return B_BAD_VALUE;
|
||||
int32 changeCounter = fPartition->ChangeCounter();
|
||||
status_t error = _kern_uninitialize_partition(fPartition->PartitionID(),
|
||||
&changeCounter);
|
||||
|
||||
if (error != B_OK)
|
||||
return error;
|
||||
|
||||
fPartition->SetChangeCounter(changeCounter);
|
||||
|
||||
return B_OK;
|
||||
}
|
||||
|
||||
|
File diff suppressed because it is too large
Load Diff
Loading…
Reference in New Issue
Block a user