* Fixed typos in the disk device job constants.

* Added missing job classes (they don't do anything yet, though) and
  completed the implementation of the job generator.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@22767 a95241bf-73f2-0310-859d-f6bbb57e9c96
This commit is contained in:
Ingo Weinhold
2007-10-29 23:51:02 +00:00
parent afa1bfe51d
commit 25ab0d1a4a
21 changed files with 879 additions and 37 deletions
+2 -2
View File
@@ -110,8 +110,8 @@ enum {
B_DISK_DEVICE_JOB_SET_NAME,
B_DISK_DEVICE_JOB_SET_CONTENT_NAME,
B_DISK_DEVICE_JOB_SET_TYPE,
B_DISK_DEVICE_JOB_SET_PARMETERS,
B_DISK_DEVICE_JOB_SET_CONTENT_PARMETERS,
B_DISK_DEVICE_JOB_SET_PARAMETERS,
B_DISK_DEVICE_JOB_SET_CONTENT_PARAMETERS,
B_DISK_DEVICE_JOB_INITIALIZE,
B_DISK_DEVICE_JOB_UNINITIALIZE,
B_DISK_DEVICE_JOB_CREATE,
+1
View File
@@ -194,6 +194,7 @@ private:
BPartition* _ChildAt(int32 index) const;
int32 _CountChildren() const;
int32 _CountDescendants() const;
int32 _Level() const;
virtual bool _AcceptVisitor(BDiskDeviceVisitor* visitor,
@@ -19,7 +19,15 @@
#include "PartitionDelegate.h"
#include "PartitionReference.h"
#include "CreateChildJob.h"
#include "DeleteChildJob.h"
#include "DefragmentJob.h"
#include "InitializeJob.h"
#include "MoveJob.h"
#include "RepairJob.h"
#include "ResizeJob.h"
#include "SetStringJob.h"
#include "UninitializeJob.h"
using std::nothrow;
@@ -84,13 +92,18 @@ DiskDeviceJobGenerator::DiskDeviceJobGenerator(BDiskDevice* device,
: fDevice(device),
fJobQueue(jobQueue),
fMoveInfos(NULL),
fPartitionRefs(NULL)
fPartitionRefs(NULL),
fContentsToMove(NULL),
fContentsToMoveCount(0)
{
fPartitionCount = fDevice->CountDescendants();
// Make sure the arrays are big enough (worst case: all old partitions have
// been deleted and new ones been created).
fPartitionCount = fDevice->CountDescendants()
+ fDevice->_CountDescendants();
fMoveInfos = new(nothrow) MoveInfo[fPartitionCount];
// fPartitionIDs = new(nothrow) partition_id[fPartitionCount];
fPartitionRefs = new(nothrow) PartitionRefInfo[fPartitionCount];
fContentsToMove = new(nothrow) PartitionReference*[fPartitionCount];
}
@@ -98,8 +111,8 @@ DiskDeviceJobGenerator::DiskDeviceJobGenerator(BDiskDevice* device,
DiskDeviceJobGenerator::~DiskDeviceJobGenerator()
{
delete[] fMoveInfos;
// delete[] fPartitionIDs;
delete[] fPartitionRefs;
delete[] fContentsToMove;
}
@@ -111,7 +124,7 @@ DiskDeviceJobGenerator::GenerateJobs()
if (!fDevice || !fJobQueue)
return B_BAD_VALUE;
if (!fMoveInfos /*|| !fPartitionIDs*/ || !fPartitionRefs)
if (!fMoveInfos || !fPartitionRefs || !fContentsToMove)
return B_NO_MEMORY;
// 1) Generate jobs for all physical partitions that don't have an
@@ -268,7 +281,7 @@ DiskDeviceJobGenerator::_GenerateChildPlacementJobs(BPartition* partition)
// sort the move infos
if (childCount > 0 && moveForth + moveBack > 0) {
qsort(fMoveInfos, childCount, sizeof(MoveInfo),
_CompareMoveInfoPosition);
_CompareMoveInfoPosition);
}
// move the children to their final positions
@@ -277,7 +290,7 @@ DiskDeviceJobGenerator::_GenerateChildPlacementJobs(BPartition* partition)
if (moveForth < moveBack) {
// move children back
for (int32 i = 0; i < childCount; i++) {
MoveInfo &info = fMoveInfos[i];
MoveInfo& info = fMoveInfos[i];
if (info.position > info.target_position) {
if (i == 0
|| info.target_position >= fMoveInfos[i - 1].position
@@ -488,8 +501,12 @@ DiskDeviceJobGenerator::_GenerateInitializeJob(BPartition* partition)
status_t
DiskDeviceJobGenerator::_GenerateUninitializeJob(BPartition* partition)
{
// TODO: Implement!
return B_BAD_VALUE;
PartitionReference* reference;
status_t error = _GetPartitionReference(partition, reference);
if (error != B_OK)
return error;
return _AddJob(new(nothrow) UninitializeJob(reference));
}
@@ -497,8 +514,23 @@ DiskDeviceJobGenerator::_GenerateUninitializeJob(BPartition* partition)
status_t
DiskDeviceJobGenerator::_GenerateSetContentNameJob(BPartition* partition)
{
// TODO: Implement!
return B_BAD_VALUE;
PartitionReference* reference;
status_t error = _GetPartitionReference(partition, reference);
if (error != B_OK)
return error;
SetStringJob* job = new(nothrow) SetStringJob(reference);
if (!job)
return B_NO_MEMORY;
error = job->Init(partition->ContentName(),
B_DISK_DEVICE_JOB_SET_CONTENT_NAME);
if (error != B_OK) {
delete job;
return error;
}
return _AddJob(job);
}
@@ -506,8 +538,23 @@ DiskDeviceJobGenerator::_GenerateSetContentNameJob(BPartition* partition)
status_t
DiskDeviceJobGenerator::_GenerateSetContentParametersJob(BPartition* partition)
{
// TODO: Implement!
return B_BAD_VALUE;
PartitionReference* reference;
status_t error = _GetPartitionReference(partition, reference);
if (error != B_OK)
return error;
SetStringJob* job = new(nothrow) SetStringJob(reference);
if (!job)
return B_NO_MEMORY;
error = job->Init(partition->ContentParameters(),
B_DISK_DEVICE_JOB_SET_CONTENT_PARAMETERS);
if (error != B_OK) {
delete job;
return error;
}
return _AddJob(job);
}
@@ -515,8 +562,12 @@ DiskDeviceJobGenerator::_GenerateSetContentParametersJob(BPartition* partition)
status_t
DiskDeviceJobGenerator::_GenerateDefragmentJob(BPartition* partition)
{
// TODO: Implement!
return B_BAD_VALUE;
PartitionReference* reference;
status_t error = _GetPartitionReference(partition, reference);
if (error != B_OK)
return error;
return _AddJob(new(nothrow) DefragmentJob(reference));
}
@@ -524,8 +575,12 @@ DiskDeviceJobGenerator::_GenerateDefragmentJob(BPartition* partition)
status_t
DiskDeviceJobGenerator::_GenerateRepairJob(BPartition* partition, bool repair)
{
// TODO: Implement!
return B_BAD_VALUE;
PartitionReference* reference;
status_t error = _GetPartitionReference(partition, reference);
if (error != B_OK)
return error;
return _AddJob(new(nothrow) RepairJob(reference, repair));
}
@@ -534,18 +589,48 @@ status_t
DiskDeviceJobGenerator::_GenerateCreateChildJob(BPartition* parent,
BPartition* partition)
{
// TODO: Implement!
return B_BAD_VALUE;
PartitionReference* parentReference;
status_t error = _GetPartitionReference(parent, parentReference);
if (error != B_OK)
return error;
PartitionReference* reference;
error = _GetPartitionReference(partition, reference);
if (error != B_OK)
return error;
CreateChildJob* job = new(nothrow) CreateChildJob(parentReference,
reference);
if (!job)
return B_NO_MEMORY;
error = job->Init(partition->Offset(), partition->Size(), partition->Type(),
partition->Name(), partition->Parameters());
if (error != B_OK) {
delete job;
return error;
}
return _AddJob(job);
}
// _GenerateDeleteChildJob
status_t
DiskDeviceJobGenerator::_GenerateDeleteChildJob(BPartition* parent,
BPartition* child)
BPartition* partition)
{
// TODO: Implement!
return B_BAD_VALUE;
PartitionReference* parentReference;
status_t error = _GetPartitionReference(parent, parentReference);
if (error != B_OK)
return error;
PartitionReference* reference;
error = _GetPartitionReference(partition, reference);
if (error != B_OK)
return error;
return _AddJob(new(nothrow) DeleteChildJob(parentReference, reference));
}
@@ -553,8 +638,22 @@ DiskDeviceJobGenerator::_GenerateDeleteChildJob(BPartition* parent,
status_t
DiskDeviceJobGenerator::_GenerateResizeJob(BPartition* partition)
{
// TODO: Implement!
return B_BAD_VALUE;
BPartition* parent = partition->Parent();
if (!parent)
return B_BAD_VALUE;
PartitionReference* parentReference;
status_t error = _GetPartitionReference(parent, parentReference);
if (error != B_OK)
return error;
PartitionReference* reference;
error = _GetPartitionReference(partition, reference);
if (error != B_OK)
return error;
return _AddJob(new(nothrow) ResizeJob(parentReference, reference,
partition->Size(), partition->ContentSize()));
}
@@ -562,8 +661,39 @@ DiskDeviceJobGenerator::_GenerateResizeJob(BPartition* partition)
status_t
DiskDeviceJobGenerator::_GenerateMoveJob(BPartition* partition)
{
// TODO: Implement!
return B_BAD_VALUE;
BPartition* parent = partition->Parent();
if (!parent)
return B_BAD_VALUE;
PartitionReference* parentReference;
status_t error = _GetPartitionReference(parent, parentReference);
if (error != B_OK)
return error;
PartitionReference* reference;
error = _GetPartitionReference(partition, reference);
if (error != B_OK)
return error;
// collect all descendants whose contents need to be moved
fContentsToMoveCount = 0;
error = _CollectContentsToMove(partition);
if (error != B_OK)
return B_OK;
// create and init the job
MoveJob* job = new(nothrow) MoveJob(parentReference, reference);
if (!job)
return B_NO_MEMORY;
error = job->Init(partition->Offset(), fContentsToMove,
fContentsToMoveCount);
if (error != B_OK) {
delete job;
return error;
}
return _AddJob(job);
}
@@ -572,8 +702,27 @@ status_t
DiskDeviceJobGenerator::_GenerateSetNameJob(BPartition* parent,
BPartition* partition)
{
// TODO: Implement!
return B_BAD_VALUE;
PartitionReference* parentReference;
status_t error = _GetPartitionReference(parent, parentReference);
if (error != B_OK)
return error;
PartitionReference* reference;
error = _GetPartitionReference(partition, reference);
if (error != B_OK)
return error;
SetStringJob* job = new(nothrow) SetStringJob(parentReference, reference);
if (!job)
return B_NO_MEMORY;
error = job->Init(partition->Name(), B_DISK_DEVICE_JOB_SET_NAME);
if (error != B_OK) {
delete job;
return error;
}
return _AddJob(job);
}
@@ -582,8 +731,27 @@ status_t
DiskDeviceJobGenerator::_GenerateSetTypeJob(BPartition* parent,
BPartition* partition)
{
// TODO: Implement!
return B_BAD_VALUE;
PartitionReference* parentReference;
status_t error = _GetPartitionReference(parent, parentReference);
if (error != B_OK)
return error;
PartitionReference* reference;
error = _GetPartitionReference(partition, reference);
if (error != B_OK)
return error;
SetStringJob* job = new(nothrow) SetStringJob(parentReference, reference);
if (!job)
return B_NO_MEMORY;
error = job->Init(partition->Type(), B_DISK_DEVICE_JOB_SET_TYPE);
if (error != B_OK) {
delete job;
return error;
}
return _AddJob(job);
}
@@ -592,8 +760,28 @@ status_t
DiskDeviceJobGenerator::_GenerateSetParametersJob(BPartition* parent,
BPartition* partition)
{
// TODO: Implement!
return B_BAD_VALUE;
PartitionReference* parentReference;
status_t error = _GetPartitionReference(parent, parentReference);
if (error != B_OK)
return error;
PartitionReference* reference;
error = _GetPartitionReference(partition, reference);
if (error != B_OK)
return error;
SetStringJob* job = new(nothrow) SetStringJob(parentReference, reference);
if (!job)
return B_NO_MEMORY;
error = job->Init(partition->Parameters(),
B_DISK_DEVICE_JOB_SET_PARAMETERS);
if (error != B_OK) {
delete job;
return error;
}
return _AddJob(job);
}
@@ -601,8 +789,43 @@ DiskDeviceJobGenerator::_GenerateSetParametersJob(BPartition* parent,
status_t
DiskDeviceJobGenerator::_CollectContentsToMove(BPartition* partition)
{
// TODO: Implement!
return B_BAD_VALUE;
BMutablePartition* shadow = _GetMutablePartition(partition);
if (shadow->Status() == B_PARTITION_UNRECOGNIZED)
return B_ERROR;
// if the partition has contents, push its ID
if (shadow->ContentType()
&& !(shadow->ChangeFlags() & B_PARTITION_CHANGED_INITIALIZATION)) {
status_t error = _PushContentsToMove(partition);
if (error != B_OK)
return error;
}
// recurse
for (int32 i = 0; BPartition* child = partition->ChildAt(i); i++) {
status_t error = _CollectContentsToMove(child);
if (error != B_OK)
return error;
}
return B_OK;
}
// _PushContentsToMove
status_t
DiskDeviceJobGenerator::_PushContentsToMove(BPartition* partition)
{
if (fContentsToMoveCount >= fPartitionCount)
return B_ERROR;
PartitionReference* reference;
status_t error = _GetPartitionReference(partition, reference);
if (error != B_OK)
return error;
fContentsToMove[fContentsToMoveCount++] = reference;
return B_OK;
}
@@ -54,7 +54,7 @@ private:
status_t _GenerateCreateChildJob(BPartition* parent,
BPartition* partition);
status_t _GenerateDeleteChildJob(BPartition* parent,
BPartition* child);
BPartition* partition);
status_t _GenerateResizeJob(BPartition* partition);
status_t _GenerateMoveJob(BPartition* partition);
status_t _GenerateSetNameJob(BPartition* parent,
@@ -65,6 +65,7 @@ private:
BPartition* partition);
status_t _CollectContentsToMove(BPartition* partition);
status_t _PushContentsToMove(BPartition* partition);
status_t _GetPartitionReference(BPartition* partition,
PartitionReference*& reference);
@@ -81,6 +82,8 @@ private:
MoveInfo* fMoveInfos;
int32 fPartitionCount;
PartitionRefInfo* fPartitionRefs;
PartitionReference** fContentsToMove;
int32 fContentsToMoveCount;
};
@@ -1425,6 +1425,17 @@ BPartition::_CountChildren() const
}
// _CountDescendants
int32
BPartition::_CountDescendants() const
{
int32 count = 1;
for (int32 i = 0; BPartition* child = _ChildAt(i); i++)
count += child->_CountDescendants();
return count;
}
// _Level
int32
BPartition::_Level() const
@@ -0,0 +1,57 @@
/*
* Copyright 2007, Ingo Weinhold, ingo_weinhold@gmx.de.
* Distributed under the terms of the MIT License.
*/
#include "CreateChildJob.h"
#include "DiskDeviceUtils.h"
#include "PartitionReference.h"
// constructor
CreateChildJob::CreateChildJob(PartitionReference* partition,
PartitionReference* child)
: DiskDeviceJob(partition, child),
fOffset(0),
fSize(0),
fType(NULL),
fName(NULL),
fParameters(NULL)
{
}
// destructor
CreateChildJob::~CreateChildJob()
{
free(fType);
free(fName);
free(fParameters);
}
// Init
status_t
CreateChildJob::Init(off_t offset, off_t size, const char* type,
const char* name, const char* parameters)
{
fOffset = offset;
fSize = size;
SET_STRING_RETURN_ON_ERROR(fType, type);
SET_STRING_RETURN_ON_ERROR(fName, name);
SET_STRING_RETURN_ON_ERROR(fParameters, parameters);
return B_OK;
}
// Do
status_t
CreateChildJob::Do()
{
// Implement!
return B_BAD_VALUE;
}
@@ -0,0 +1,40 @@
/*
* Copyright 2007, Ingo Weinhold, ingo_weinhold@gmx.de.
* Distributed under the terms of the MIT License.
*/
#ifndef _CREATE_CHILD_JOB_H
#define _CREATE_CHILD_JOB_H
#include "DiskDeviceJob.h"
namespace BPrivate {
class CreateChildJob : public DiskDeviceJob {
public:
CreateChildJob(PartitionReference* partition,
PartitionReference* child);
virtual ~CreateChildJob();
status_t Init(off_t offset, off_t size,
const char* type, const char* name,
const char* parameters);
virtual status_t Do();
protected:
off_t fOffset;
off_t fSize;
char* fType;
char* fName;
char* fParameters;
};
} // namespace BPrivate
using BPrivate::CreateChildJob;
#endif // _CREATE_CHILD_JOB_H
@@ -0,0 +1,31 @@
/*
* Copyright 2007, Ingo Weinhold, ingo_weinhold@gmx.de.
* Distributed under the terms of the MIT License.
*/
#include "DefragmentJob.h"
#include "PartitionReference.h"
// constructor
DefragmentJob::DefragmentJob(PartitionReference* partition)
: DiskDeviceJob(partition)
{
}
// destructor
DefragmentJob::~DefragmentJob()
{
}
// Do
status_t
DefragmentJob::Do()
{
// Implement!
return B_BAD_VALUE;
}
@@ -0,0 +1,28 @@
/*
* Copyright 2007, Ingo Weinhold, ingo_weinhold@gmx.de.
* Distributed under the terms of the MIT License.
*/
#ifndef _DEFRAGMENT_JOB_H
#define _DEFRAGMENT_JOB_H
#include "DiskDeviceJob.h"
namespace BPrivate {
class DefragmentJob : public DiskDeviceJob {
public:
DefragmentJob(PartitionReference* partition);
virtual ~DefragmentJob();
virtual status_t Do();
};
} // namespace BPrivate
using BPrivate::DefragmentJob;
#endif // _DEFRAGMENT_JOB_H
@@ -0,0 +1,33 @@
/*
* Copyright 2007, Ingo Weinhold, ingo_weinhold@gmx.de.
* Distributed under the terms of the MIT License.
*/
#include "DeleteChildJob.h"
#include "DiskDeviceUtils.h"
#include "PartitionReference.h"
// constructor
DeleteChildJob::DeleteChildJob(PartitionReference* partition,
PartitionReference* child)
: DiskDeviceJob(partition, child)
{
}
// destructor
DeleteChildJob::~DeleteChildJob()
{
}
// Do
status_t
DeleteChildJob::Do()
{
// Implement!
return B_BAD_VALUE;
}
@@ -0,0 +1,29 @@
/*
* Copyright 2007, Ingo Weinhold, ingo_weinhold@gmx.de.
* Distributed under the terms of the MIT License.
*/
#ifndef _DELETE_CHILD_JOB_H
#define _DELETE_CHILD_JOB_H
#include "DiskDeviceJob.h"
namespace BPrivate {
class DeleteChildJob : public DiskDeviceJob {
public:
DeleteChildJob(PartitionReference* partition,
PartitionReference* child);
virtual ~DeleteChildJob();
virtual status_t Do();
};
} // namespace BPrivate
using BPrivate::DeleteChildJob;
#endif // _DELETE_CHILD_JOB_H
@@ -0,0 +1,64 @@
/*
* Copyright 2007, Ingo Weinhold, ingo_weinhold@gmx.de.
* Distributed under the terms of the MIT License.
*/
#include <new>
#include "MoveJob.h"
#include "DiskDeviceUtils.h"
#include "PartitionReference.h"
using std::nothrow;
// constructor
MoveJob::MoveJob(PartitionReference* partition, PartitionReference* child)
: DiskDeviceJob(partition, child),
fContents(NULL),
fContentsCount(0)
{
}
// destructor
MoveJob::~MoveJob()
{
if (fContents) {
for (int32 i = 0; i < fContentsCount; i++)
fContents[i]->RemoveReference();
delete[] fContents;
}
}
// Init
status_t
MoveJob::Init(off_t offset, PartitionReference** contents, int32 contentsCount)
{
fContents = new(nothrow) PartitionReference*[contentsCount];
if (!fContents)
return B_NO_MEMORY;
fContentsCount = contentsCount;
for (int32 i = 0; i < contentsCount; i++) {
fContents[i] = contents[i];
fContents[i]->AddReference();
}
fOffset = offset;
return B_OK;
}
// Do
status_t
MoveJob::Do()
{
// Implement!
return B_BAD_VALUE;
}
@@ -0,0 +1,38 @@
/*
* Copyright 2007, Ingo Weinhold, ingo_weinhold@gmx.de.
* Distributed under the terms of the MIT License.
*/
#ifndef _MOVE_JOB_H
#define _MOVE_JOB_H
#include "DiskDeviceJob.h"
namespace BPrivate {
class MoveJob : public DiskDeviceJob {
public:
MoveJob(PartitionReference* partition,
PartitionReference* child);
virtual ~MoveJob();
status_t Init(off_t offset,
PartitionReference** contents,
int32 contentsCount);
virtual status_t Do();
protected:
off_t fOffset;
PartitionReference** fContents;
int32 fContentsCount;
};
} // namespace BPrivate
using BPrivate::MoveJob;
#endif // _MOVE_JOB_H
@@ -0,0 +1,32 @@
/*
* Copyright 2007, Ingo Weinhold, ingo_weinhold@gmx.de.
* Distributed under the terms of the MIT License.
*/
#include "RepairJob.h"
#include "PartitionReference.h"
// constructor
RepairJob::RepairJob(PartitionReference* partition, bool checkOnly)
: DiskDeviceJob(partition),
fCheckOnly(checkOnly)
{
}
// destructor
RepairJob::~RepairJob()
{
}
// Do
status_t
RepairJob::Do()
{
// Implement!
return B_BAD_VALUE;
}
@@ -0,0 +1,32 @@
/*
* Copyright 2007, Ingo Weinhold, ingo_weinhold@gmx.de.
* Distributed under the terms of the MIT License.
*/
#ifndef _REPAIR_JOB_H
#define _REPAIR_JOB_H
#include "DiskDeviceJob.h"
namespace BPrivate {
class RepairJob : public DiskDeviceJob {
public:
RepairJob(PartitionReference* partition,
bool checkOnly);
virtual ~RepairJob();
virtual status_t Do();
private:
bool fCheckOnly;
};
} // namespace BPrivate
using BPrivate::RepairJob;
#endif // _REPAIR_JOB_H
@@ -0,0 +1,35 @@
/*
* Copyright 2007, Ingo Weinhold, ingo_weinhold@gmx.de.
* Distributed under the terms of the MIT License.
*/
#include "ResizeJob.h"
#include "DiskDeviceUtils.h"
#include "PartitionReference.h"
// constructor
ResizeJob::ResizeJob(PartitionReference* partition, PartitionReference* child,
off_t size, off_t contentSize)
: DiskDeviceJob(partition, child),
fSize(size),
fContentSize(contentSize)
{
}
// destructor
ResizeJob::~ResizeJob()
{
}
// Do
status_t
ResizeJob::Do()
{
// Implement!
return B_BAD_VALUE;
}
@@ -0,0 +1,34 @@
/*
* Copyright 2007, Ingo Weinhold, ingo_weinhold@gmx.de.
* Distributed under the terms of the MIT License.
*/
#ifndef _RESIZE_JOB_H
#define _RESIZE_JOB_H
#include "DiskDeviceJob.h"
namespace BPrivate {
class ResizeJob : public DiskDeviceJob {
public:
ResizeJob(PartitionReference* partition,
PartitionReference* child, off_t size,
off_t contentSize);
virtual ~ResizeJob();
virtual status_t Do();
protected:
off_t fSize;
off_t fContentSize;
};
} // namespace BPrivate
using BPrivate::ResizeJob;
#endif // _RESIZE_JOB_H
@@ -0,0 +1,57 @@
/*
* Copyright 2007, Ingo Weinhold, ingo_weinhold@gmx.de.
* Distributed under the terms of the MIT License.
*/
#include "SetStringJob.h"
#include "DiskDeviceUtils.h"
#include "PartitionReference.h"
// constructor
SetStringJob::SetStringJob(PartitionReference* partition,
PartitionReference* child)
: DiskDeviceJob(partition, child),
fString(NULL)
{
}
// destructor
SetStringJob::~SetStringJob()
{
free(fString);
}
// Init
status_t
SetStringJob::Init(const char* string, uint32 jobType)
{
switch (jobType) {
case B_DISK_DEVICE_JOB_SET_NAME:
case B_DISK_DEVICE_JOB_SET_CONTENT_NAME:
case B_DISK_DEVICE_JOB_SET_TYPE:
case B_DISK_DEVICE_JOB_SET_PARAMETERS:
case B_DISK_DEVICE_JOB_SET_CONTENT_PARAMETERS:
break;
default:
return B_BAD_VALUE;
}
fJobType = jobType;
SET_STRING_RETURN_ON_ERROR(fString, string);
return B_OK;
}
// Do
status_t
SetStringJob::Do()
{
// Implement!
return B_BAD_VALUE;
}
@@ -0,0 +1,35 @@
/*
* Copyright 2007, Ingo Weinhold, ingo_weinhold@gmx.de.
* Distributed under the terms of the MIT License.
*/
#ifndef _SET_STRING_JOB_H
#define _SET_STRING_JOB_H
#include "DiskDeviceJob.h"
namespace BPrivate {
class SetStringJob : public DiskDeviceJob {
public:
SetStringJob(PartitionReference* partition,
PartitionReference* child = NULL);
virtual ~SetStringJob();
status_t Init(const char* string, uint32 jobType);
virtual status_t Do();
protected:
char* fString;
uint32 fJobType;
};
} // namespace BPrivate
using BPrivate::SetStringJob;
#endif // _SET_STRING_JOB_H
@@ -0,0 +1,31 @@
/*
* Copyright 2007, Ingo Weinhold, ingo_weinhold@gmx.de.
* Distributed under the terms of the MIT License.
*/
#include "UninitializeJob.h"
#include "PartitionReference.h"
// constructor
UninitializeJob::UninitializeJob(PartitionReference* partition)
: DiskDeviceJob(partition)
{
}
// destructor
UninitializeJob::~UninitializeJob()
{
}
// Do
status_t
UninitializeJob::Do()
{
// Implement!
return B_BAD_VALUE;
}
@@ -0,0 +1,28 @@
/*
* Copyright 2007, Ingo Weinhold, ingo_weinhold@gmx.de.
* Distributed under the terms of the MIT License.
*/
#ifndef _UNINITIALIZE_JOB_H
#define _UNINITIALIZE_JOB_H
#include "DiskDeviceJob.h"
namespace BPrivate {
class UninitializeJob : public DiskDeviceJob {
public:
UninitializeJob(PartitionReference* partition);
virtual ~UninitializeJob();
virtual status_t Do();
};
} // namespace BPrivate
using BPrivate::UninitializeJob;
#endif // _UNINITIALIZE_JOB_H