Mostly empty implementations for the disk device manager classes. Save KPartition which is partially done.

git-svn-id: file:///srv/svn/repos/haiku/trunk/current@3455 a95241bf-73f2-0310-859d-f6bbb57e9c96
This commit is contained in:
Ingo Weinhold 2003-06-09 23:10:09 +00:00
parent 4c212afefb
commit 1844af0bfa
31 changed files with 1263 additions and 0 deletions

View File

@ -45,6 +45,7 @@ KernelLd linkhack.so :
SubInclude OBOS_TOP src kernel core addons ;
SubInclude OBOS_TOP src kernel core arch ;
SubInclude OBOS_TOP src kernel core disk_device_manager ;
SubInclude OBOS_TOP src kernel core fs ;
SubInclude OBOS_TOP src kernel core vm ;
#SubInclude OBOS_TOP src kernel core net ;

View File

@ -0,0 +1,31 @@
SubDir OBOS_TOP src kernel core disk_device_manager ;
SEARCH_SOURCE += [ FDirName $(SUBDIR) jobs ] ;
UsePrivateHeaders [ FDirName kernel disk_device_manager ] ;
UsePrivateHeaders [ FDirName shared ] ;
UsePrivateHeaders [ FDirName storage ] ;
SharedLibrary disk_device_manager :
KDiskDevice.cpp
KDiskDeviceJob.cpp
KDiskDeviceJobFactory.cpp
KDiskDeviceJobQueue.cpp
KDiskDeviceManager.cpp
KDiskSystem.cpp
KFileSystem.cpp
KPartition.cpp
KPartitioningSystem.cpp
disk_device_manager.cpp
# jobs
KCreateChildJob.cpp
KDefragmentJob.cpp
KDeleteChildJob.cpp
KInitializeJob.cpp
KMoveJob.cpp
KRepairJob.cpp
KResizeJob.cpp
KScanPartitionJob.cpp
KSetParametersJob.cpp
;

View File

@ -0,0 +1,3 @@
// KDiskDevice.cpp
#include "KDiskDevice.h"

View File

@ -0,0 +1,3 @@
// KDiskDeviceJob.cpp
#include "KDiskDeviceJob.h"

View File

@ -0,0 +1,3 @@
// KDiskDeviceJob.cpp
#include "KDiskDeviceJob.h"

View File

@ -0,0 +1,3 @@
// KDiskDeviceJobQueue.cpp
#include "KDiskDeviceJobQueue.h"

View File

@ -0,0 +1,3 @@
// KDiskDeviceManager.cpp
#include "KDiskDeviceManager.h"

View File

@ -0,0 +1,3 @@
// KDiskSystem.cpp
#include "KDiskSystem.h"

View File

@ -0,0 +1,3 @@
// KFileSystem.cpp
#include "KFileSystem.h"

View File

@ -0,0 +1,573 @@
// KPartition.cpp
#include <new>
#include <stdlib.h>
//#include <Partition.h>
// TODO: Move the definitions needed in the kernel to a separate header.
#include "KPartition.h"
using namespace std;
using BPrivate::DiskDevice::KDiskDevice;
using BPrivate::DiskDevice::KDiskSystem;
// set_string
// simple helper
static
status_t
set_string(char *&location, const char *newValue)
{
// unset old value
if (location) {
free(location);
location = NULL;
}
// set new value
status_t error = B_OK;
if (newValue) {
location = strdup(newValue);
if (!location)
error = B_NO_MEMORY;
}
return error;
}
// constructor
KPartition::KPartition(partition_id id)
: fPartitionData(),
fChildren(),
fDevice(NULL),
fParent(NULL),
fDiskSystem(NULL),
fParentDiskSystem(NULL),
fReferenceCount(0)
{
fPartitionData.id = id;
fPartitionData.offset = 0;
fPartitionData.size = 0;
fPartitionData.block_size = 0;
fPartitionData.child_count = 0;
fPartitionData.index = -1;
fPartitionData.status = /*B_PARTITION_UNRECOGNIZED*/ 0;
fPartitionData.flags = 0;
fPartitionData.volume = -1;
fPartitionData.name = NULL;
fPartitionData.content_name = NULL;
fPartitionData.type = NULL;
fPartitionData.content_type = NULL;
fPartitionData.parameters = NULL;
fPartitionData.content_parameters = NULL;
fPartitionData.cookie = NULL;
fPartitionData.content_cookie = NULL;
}
// destructor
KPartition::~KPartition()
{
free(fPartitionData.name);
free(fPartitionData.content_name);
free(fPartitionData.type);
free(fPartitionData.content_type);
free(fPartitionData.parameters);
free(fPartitionData.content_parameters);
}
// Register
bool
KPartition::Register()
{
fReferenceCount++;
return true;
}
// Unregister
bool
KPartition::Unregister()
{
fReferenceCount--;
return true;
}
// CountReferences
int32
KPartition::CountReferences() const
{
return fReferenceCount;
}
// SetBusy
void
KPartition::SetBusy(bool busy)
{
if (busy)
fPartitionData.flags |= B_PARTITION_BUSY;
else
fPartitionData.flags &= ~B_PARTITION_BUSY;
}
// IsBusy
bool
KPartition::IsBusy() const
{
return (fPartitionData.flags & B_PARTITION_BUSY);
}
// SetDescendantBusy
void
KPartition::SetDescendantBusy(bool busy)
{
if (busy)
fPartitionData.flags |= B_PARTITION_DESCENDANT_BUSY;
else
fPartitionData.flags &= ~B_PARTITION_DESCENDANT_BUSY;
}
// IsDescendantBusy
bool
KPartition::IsDescendantBusy() const
{
return (fPartitionData.flags & B_PARTITION_DESCENDANT_BUSY);
}
// SetOffset
void
KPartition::SetOffset(off_t offset)
{
fPartitionData.offset = offset;
}
// Offset
off_t
KPartition::Offset() const
{
return fPartitionData.offset;
}
// SetSize
void
KPartition::SetSize(off_t size)
{
fPartitionData.size = size;
}
// Size
off_t
KPartition::Size() const
{
return fPartitionData.size;
}
// SetBlockSize
void
KPartition::SetBlockSize(uint32 blockSize)
{
fPartitionData.block_size = blockSize;
}
// BlockSize
uint32
KPartition::BlockSize() const
{
return fPartitionData.block_size;
}
// SetIndex
void
KPartition::SetIndex(int32 index)
{
fPartitionData.index = index;
}
// Index
int32
KPartition::Index() const
{
return fPartitionData.index;
}
// SetStatus
void
KPartition::SetStatus(uint32 status)
{
fPartitionData.status = status;
}
// Status
uint32
KPartition::Status() const
{
return fPartitionData.status;
}
// SetFlags
void
KPartition::SetFlags(uint32 flags)
{
fPartitionData.flags = flags;
}
// Flags
uint32
KPartition::Flags() const
{
return fPartitionData.flags;
}
// IsMountable
bool
KPartition::IsMountable() const
{
return (fPartitionData.flags & B_PARTITION_MOUNTABLE);
}
// IsPartitionable
bool
KPartition::IsPartitionable() const
{
return (fPartitionData.flags & B_PARTITION_PARTITIONABLE);
}
// IsReadOnly
bool
KPartition::IsReadOnly() const
{
return (fPartitionData.flags & B_PARTITION_READ_ONLY);
}
// IsMounted
bool
KPartition::IsMounted() const
{
return (fPartitionData.flags & B_PARTITION_MOUNTED);
}
// IsDevice
bool
KPartition::IsDevice() const
{
return (fPartitionData.flags & B_PARTITION_IS_DEVICE);
}
// SetName
status_t
KPartition::SetName(const char *name)
{
return set_string(fPartitionData.name, name);
}
// Name
const char *
KPartition::Name() const
{
return fPartitionData.name;
}
// SetContentName
status_t
KPartition::SetContentName(const char *name)
{
return set_string(fPartitionData.content_name, name);
}
// ContentName
const char *
KPartition::ContentName() const
{
return fPartitionData.content_name;
}
// SetType
status_t
KPartition::SetType(const char *type)
{
return set_string(fPartitionData.type, type);
}
// Type
const char *
KPartition::Type() const
{
return fPartitionData.type;
}
// SetContentType
status_t
KPartition::SetContentType(const char *type)
{
return set_string(fPartitionData.content_type, type);
}
// ContentType
const char *
KPartition::ContentType() const
{
return fPartitionData.content_type;
}
// PartitionData
partition_data *
KPartition::PartitionData()
{
return &fPartitionData;
}
// PartitionData
const partition_data *
KPartition::PartitionData() const
{
return &fPartitionData;
}
// SetID
void
KPartition::SetID(partition_id id)
{
fPartitionData.id = id;
}
// ID
partition_id
KPartition::ID() const
{
return fPartitionData.id;
}
// ChangeCounter
int32
KPartition::ChangeCounter() const
{
}
// GetPath
status_t
KPartition::GetPath(char *path) const
{
// not implemented
return B_ERROR;
}
// SetVolumeID
void
KPartition::SetVolumeID(dev_t volumeID)
{
fPartitionData.volume = volumeID;
}
// VolumeID
dev_t
KPartition::VolumeID() const
{
return fPartitionData.id;
}
// Mount
status_t
KPartition::Mount(uint32 mountFlags, const char *parameters)
{
// not implemented
return B_ERROR;
}
// Unmount
status_t
KPartition::Unmount()
{
// not implemented
return B_ERROR;
}
// SetParameters
status_t
KPartition::SetParameters(const char *parameters)
{
return set_string(fPartitionData.parameters, parameters);
}
// Parameters
const char *
KPartition::Parameters() const
{
return fPartitionData.parameters;
}
// SetContentParameters
status_t
KPartition::SetContentParameters(const char *parameters)
{
return set_string(fPartitionData.content_parameters, parameters);
}
// ContentParameters
const char *
KPartition::ContentParameters() const
{
return fPartitionData.content_parameters;
}
// SetDevice
void
KPartition::SetDevice(KDiskDevice *device)
{
fDevice = device;
}
// Device
KDiskDevice *
KPartition::Device() const
{
return fDevice;
}
// SetParent
void
KPartition::SetParent(KPartition *parent)
{
fParent = parent;
}
// Parent
KPartition *
KPartition::Parent() const
{
return fParent;
}
// AddChild
status_t
KPartition::AddChild(KPartition *partition, int32 index)
{
// check parameters
int32 count = fPartitionData.child_count;
if (index == -1)
index = count;
if (index < 0 || index > count || !partition)
return B_BAD_VALUE;
// add partition
// TODO: Lock the disk device manager!
if (!fChildren.AddItem(partition, index))
return B_NO_MEMORY;
fPartitionData.child_count++;
partition->SetParent(this);
partition->SetDevice(Device());
return B_OK;
}
// RemoveChild
KPartition *
KPartition::RemoveChild(int32 index)
{
KPartition *partition = NULL;
if (index >= 0 && index < fPartitionData.child_count) {
// TODO: Lock the disk device manager!
partition = fChildren.ItemAt(index);
if (partition && fChildren.RemoveItem(index)) {
fPartitionData.child_count--;
partition->SetParent(NULL);
partition->SetDevice(NULL);
}
}
return partition;
}
// ChildAt
KPartition *
KPartition::ChildAt(int32 index) const
{
return fChildren.ItemAt(index);
}
// CountChildren
int32
KPartition::CountChildren() const
{
return fPartitionData.child_count;
}
// CreateShadowPartition
KPartition *
KPartition::CreateShadowPartition()
{
// not implemented
return NULL;
}
// DeleteShadowPartition
void
KPartition::DeleteShadowPartition()
{
// not implemented
}
// ShadowPartition
KPartition *
KPartition::ShadowPartition() const
{
// not implemented
return NULL;
}
// IsShadowPartition
bool
KPartition::IsShadowPartition() const
{
// not implemented
return false;
}
// SetDiskSystem
void
KPartition::SetDiskSystem(KDiskSystem *diskSystem)
{
fDiskSystem = diskSystem;
}
// DiskSystem
KDiskSystem *
KPartition::DiskSystem() const
{
return fDiskSystem;
}
// SetParentDiskSystem
void
KPartition::SetParentDiskSystem(KDiskSystem *diskSystem)
{
fParentDiskSystem = diskSystem;
}
// ParentDiskSystem
KDiskSystem *
KPartition::ParentDiskSystem() const
{
return fParentDiskSystem;
}
// SetCookie
void
KPartition::SetCookie(void *cookie)
{
fPartitionData.cookie = cookie;
}
// Cookie
void *
KPartition::Cookie() const
{
return fPartitionData.cookie;
}
// SetContentCookie
void
KPartition::SetContentCookie(void *cookie)
{
fPartitionData.content_cookie = cookie;
}
// ContentCookie
void *
KPartition::ContentCookie() const
{
return fPartitionData.content_cookie;
}

View File

@ -0,0 +1,3 @@
// KPartitioningSystem.cpp
#include "KPartitioningSystem.h"

View File

@ -0,0 +1,385 @@
// List.h
//
// Copyright (c) 2003, Ingo Weinhold (bonefish@cs.tu-berlin.de)
//
// Permission is hereby granted, free of charge, to any person obtaining a
// copy of this software and associated documentation files (the "Software"),
// to deal in the Software without restriction, including without limitation
// the rights to use, copy, modify, merge, publish, distribute, sublicense,
// and/or sell copies of the Software, and to permit persons to whom the
// Software is furnished to do so, subject to the following conditions:
//
// The above copyright notice and this permission notice shall be included in
// all copies or substantial portions of the Software.
//
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
// THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
// DEALINGS IN THE SOFTWARE.
//
// Except as contained in this notice, the name of a copyright holder shall
// not be used in advertising or otherwise to promote the sale, use or other
// dealings in this Software without prior written authorization of the
// copyright holder.
#ifndef LIST_H
#define LIST_H
#include <new.h>
#include <stdlib.h>
#include <string.h>
#include <SupportDefs.h>
template<typename ITEM>
class DefaultDefaultItemCreator {
public:
static inline ITEM GetItem() { return ITEM(0); }
};
/*!
\class List
\brief A generic list implementation.
*/
template<typename ITEM,
typename DEFAULT_ITEM_SUPPLIER = DefaultDefaultItemCreator<ITEM> >
class List {
public:
typedef ITEM item_t;
typedef List list_t;
private:
static item_t sDefaultItem;
static const size_t kDefaultChunkSize = 10;
static const size_t kMaximalChunkSize = 1024 * 1024;
public:
List(size_t chunkSize = kDefaultChunkSize);
~List();
inline const item_t &GetDefaultItem() const;
inline item_t &GetDefaultItem();
bool AddItem(const item_t &item, int32 index);
bool AddItem(const item_t &item);
// bool AddList(list_t *list, int32 index);
// bool AddList(list_t *list);
bool RemoveItem(const item_t &item);
bool RemoveItem(int32 index);
bool ReplaceItem(int32 index, const item_t &item);
bool MoveItem(int32 oldIndex, int32 newIndex);
void MakeEmpty();
int32 CountItems() const;
bool IsEmpty() const;
const item_t &ItemAt(int32 index) const;
item_t &ItemAt(int32 index);
const item_t *Items() const;
int32 IndexOf(const item_t &item) const;
bool HasItem(const item_t &item) const;
// debugging
int32 GetCapacity() const { return fCapacity; }
private:
inline static void _MoveItems(item_t* items, int32 offset, int32 count);
bool _Resize(size_t count);
private:
size_t fCapacity;
size_t fChunkSize;
int32 fItemCount;
item_t *fItems;
};
// sDefaultItem
template<typename ITEM, typename DEFAULT_ITEM_SUPPLIER>
List<ITEM, DEFAULT_ITEM_SUPPLIER>::item_t
List<ITEM, DEFAULT_ITEM_SUPPLIER>::sDefaultItem(
DEFAULT_ITEM_SUPPLIER::GetItem());
// constructor
template<typename ITEM, typename DEFAULT_ITEM_SUPPLIER>
List<ITEM, DEFAULT_ITEM_SUPPLIER>::List(size_t chunkSize)
: fCapacity(0),
fChunkSize(chunkSize),
fItemCount(0),
fItems(NULL)
{
if (fChunkSize == 0 || fChunkSize > kMaximalChunkSize)
fChunkSize = kDefaultChunkSize;
_Resize(0);
}
// destructor
template<typename ITEM, typename DEFAULT_ITEM_SUPPLIER>
List<ITEM, DEFAULT_ITEM_SUPPLIER>::~List()
{
MakeEmpty();
free(fItems);
}
// GetDefaultItem
template<typename ITEM, typename DEFAULT_ITEM_SUPPLIER>
inline
const List<ITEM, DEFAULT_ITEM_SUPPLIER>::item_t &
List<ITEM, DEFAULT_ITEM_SUPPLIER>::GetDefaultItem() const
{
return sDefaultItem;
}
// GetDefaultItem
template<typename ITEM, typename DEFAULT_ITEM_SUPPLIER>
inline
List<ITEM, DEFAULT_ITEM_SUPPLIER>::item_t &
List<ITEM, DEFAULT_ITEM_SUPPLIER>::GetDefaultItem()
{
return sDefaultItem;
}
// _MoveItems
template<typename ITEM, typename DEFAULT_ITEM_SUPPLIER>
inline
void
List<ITEM, DEFAULT_ITEM_SUPPLIER>::_MoveItems(item_t* items, int32 offset, int32 count)
{
if (count > 0 && offset != 0)
memmove(items + offset, items, count * sizeof(item_t));
}
// AddItem
template<typename ITEM, typename DEFAULT_ITEM_SUPPLIER>
bool
List<ITEM, DEFAULT_ITEM_SUPPLIER>::AddItem(const item_t &item, int32 index)
{
bool result = (index >= 0 && index <= fItemCount
&& _Resize(fItemCount + 1));
if (result) {
_MoveItems(fItems + index, 1, fItemCount - index - 1);
new(fItems + index) item_t(item);
}
return result;
}
// AddItem
template<typename ITEM, typename DEFAULT_ITEM_SUPPLIER>
bool
List<ITEM, DEFAULT_ITEM_SUPPLIER>::AddItem(const item_t &item)
{
bool result = true;
if ((int32)fCapacity > fItemCount) {
new(fItems + fItemCount) item_t(item);
fItemCount++;
} else {
if ((result = _Resize(fItemCount + 1)))
new(fItems + (fItemCount - 1)) item_t(item);
}
return result;
}
// These don't use the copy constructor!
/*
// AddList
template<typename ITEM, typename DEFAULT_ITEM_SUPPLIER>
bool
List<ITEM, DEFAULT_ITEM_SUPPLIER>::AddList(list_t *list, int32 index)
{
bool result = (list && index >= 0 && index <= fItemCount);
if (result && list->fItemCount > 0) {
int32 count = list->fItemCount;
result = _Resize(fItemCount + count);
if (result) {
_MoveItems(fItems + index, count, fItemCount - index - count);
memcpy(fItems + index, list->fItems,
list->fItemCount * sizeof(item_t));
}
}
return result;
}
// AddList
template<typename ITEM, typename DEFAULT_ITEM_SUPPLIER>
bool
List<ITEM, DEFAULT_ITEM_SUPPLIER>::AddList(list_t *list)
{
bool result = (list);
if (result && list->fItemCount > 0) {
int32 index = fItemCount;
int32 count = list->fItemCount;
result = _Resize(fItemCount + count);
if (result) {
memcpy(fItems + index, list->fItems,
list->fItemCount * sizeof(item_t));
}
}
return result;
}
*/
// RemoveItem
template<typename ITEM, typename DEFAULT_ITEM_SUPPLIER>
bool
List<ITEM, DEFAULT_ITEM_SUPPLIER>::RemoveItem(const item_t &item)
{
int32 index = IndexOf(item);
bool result = (index >= 0);
if (result)
RemoveItem(index);
return result;
}
// RemoveItem
template<typename ITEM, typename DEFAULT_ITEM_SUPPLIER>
bool
List<ITEM, DEFAULT_ITEM_SUPPLIER>::RemoveItem(int32 index)
{
if (index >= 0 && index < fItemCount) {
fItems[index].~item_t();
_MoveItems(fItems + index + 1, -1, fItemCount - index - 1);
_Resize(fItemCount - 1);
return true;
}
return false;
}
// ReplaceItem
template<typename ITEM, typename DEFAULT_ITEM_SUPPLIER>
bool
List<ITEM, DEFAULT_ITEM_SUPPLIER>::ReplaceItem(int32 index, const item_t &item)
{
if (index >= 0 && index < fItemCount) {
fItems[index] = item;
return true;
}
return false;
}
// MoveItem
template<typename ITEM, typename DEFAULT_ITEM_SUPPLIER>
bool
List<ITEM, DEFAULT_ITEM_SUPPLIER>::MoveItem(int32 oldIndex, int32 newIndex)
{
if (oldIndex >= 0 && oldIndex < fItemCount
&& newIndex >= 0 && newIndex <= fItemCount) {
if (oldIndex < newIndex - 1) {
item_t item = fItems[oldIndex];
_MoveItems(fItems + oldIndex + 1, -1, newIndex - oldIndex - 1);
fItems[newIndex] = item;
} else if (oldIndex > newIndex) {
item_t item = fItems[oldIndex];
_MoveItems(fItems + newIndex, 1, oldIndex - newIndex);
fItems[newIndex] = item;
}
return true;
}
return false;
}
// MakeEmpty
template<typename ITEM, typename DEFAULT_ITEM_SUPPLIER>
void
List<ITEM, DEFAULT_ITEM_SUPPLIER>::MakeEmpty()
{
for (int32 i = 0; i < fItemCount; i++)
fItems[i].~item_t();
_Resize(0);
}
// CountItems
template<typename ITEM, typename DEFAULT_ITEM_SUPPLIER>
int32
List<ITEM, DEFAULT_ITEM_SUPPLIER>::CountItems() const
{
return fItemCount;
}
// IsEmpty
template<typename ITEM, typename DEFAULT_ITEM_SUPPLIER>
bool
List<ITEM, DEFAULT_ITEM_SUPPLIER>::IsEmpty() const
{
return (fItemCount == 0);
}
// ItemAt
template<typename ITEM, typename DEFAULT_ITEM_SUPPLIER>
const List<ITEM, DEFAULT_ITEM_SUPPLIER>::item_t &
List<ITEM, DEFAULT_ITEM_SUPPLIER>::ItemAt(int32 index) const
{
if (index >= 0 && index < fItemCount)
return fItems[index];
return sDefaultItem;
}
// ItemAt
template<typename ITEM, typename DEFAULT_ITEM_SUPPLIER>
List<ITEM, DEFAULT_ITEM_SUPPLIER>::item_t &
List<ITEM, DEFAULT_ITEM_SUPPLIER>::ItemAt(int32 index)
{
if (index >= 0 && index < fItemCount)
return fItems[index];
return sDefaultItem;
}
// Items
template<typename ITEM, typename DEFAULT_ITEM_SUPPLIER>
const List<ITEM, DEFAULT_ITEM_SUPPLIER>::item_t *
List<ITEM, DEFAULT_ITEM_SUPPLIER>::Items() const
{
return fItems;
}
// IndexOf
template<typename ITEM, typename DEFAULT_ITEM_SUPPLIER>
int32
List<ITEM, DEFAULT_ITEM_SUPPLIER>::IndexOf(const item_t &item) const
{
for (int32 i = 0; i < fItemCount; i++) {
if (fItems[i] == item)
return i;
}
return -1;
}
// HasItem
template<typename ITEM, typename DEFAULT_ITEM_SUPPLIER>
bool
List<ITEM, DEFAULT_ITEM_SUPPLIER>::HasItem(const item_t &item) const
{
return (IndexOf(item) >= 0);
}
// _Resize
template<typename ITEM, typename DEFAULT_ITEM_SUPPLIER>
bool
List<ITEM, DEFAULT_ITEM_SUPPLIER>::_Resize(size_t count)
{
bool result = true;
// calculate the new capacity
int32 newSize = count;
if (newSize <= 0)
newSize = 1;
newSize = ((newSize - 1) / fChunkSize + 1) * fChunkSize;
// resize if necessary
if ((size_t)newSize != fCapacity) {
item_t* newItems
= (item_t*)realloc(fItems, newSize * sizeof(item_t));
if (newItems) {
fItems = newItems;
fCapacity = newSize;
} else
result = false;
}
if (result)
fItemCount = count;
return result;
}
#endif // LIST_H

View File

@ -0,0 +1,3 @@
// disk_device_manager.cpp
#include "disk_device_manager.h"

View File

@ -0,0 +1,3 @@
// KCreateChildJob.cpp
#include "KCreateChildJob.h"

View File

@ -0,0 +1,25 @@
// KCreateChildJob.h
#ifndef _K_DISK_DEVICE_CREATE_CHILD_JOB_H
#define _K_DISK_DEVICE_CREATE_CHILD_JOB_H
#include "KDiskDeviceJob.h"
namespace BPrivate {
namespace DiskDevice {
class KCreateChildJob : public KDiskDeviceJob {
public:
KCreateChildJob(partition_id partition, partition_id child, off_t offset,
off_t size, const char *parameters);
virtual ~KCreateChildJob();
virtual status_t Do();
};
} // namespace DiskDevice
} // namespace BPrivate
using BPrivate::DiskDevice::KCreateChildJob;
#endif // _DISK_DEVICE_CREATE_CHILD_JOB_H

View File

@ -0,0 +1,3 @@
// KDefragmentJob.cpp
#include "KDefragmentJob.h"

View File

@ -0,0 +1,24 @@
// KDefragmentJob.h
#ifndef _K_DISK_DEVICE_DEFRAGMENT_JOB_H
#define _K_DISK_DEVICE_DEFRAGMENT_JOB_H
#include "KDiskDeviceJob.h"
namespace BPrivate {
namespace DiskDevice {
class KDefragmentJob : public KDiskDeviceJob {
public:
KDefragmentJob(partition_id partition);
virtual ~KDefragmentJob();
virtual status_t Do();
};
} // namespace DiskDevice
} // namespace BPrivate
using BPrivate::DiskDevice::KDefragmentJob;
#endif // _DISK_DEVICE_DEFRAGMENT_JOB_H

View File

@ -0,0 +1,3 @@
// KDeleteChildJob.cpp
#include "KDeleteChildJob.h"

View File

@ -0,0 +1,24 @@
// KDeleteChildJob.h
#ifndef _K_DISK_DEVICE_DELETE_CHILD_JOB_H
#define _K_DISK_DEVICE_DELETE_CHILD_JOB_H
#include "KDiskDeviceJob.h"
namespace BPrivate {
namespace DiskDevice {
class KDeleteChildJob : public KDiskDeviceJob {
public:
KDeleteChildJob(partition_id parent, partition_id partition);
virtual ~KDeleteChildJob();
virtual status_t Do();
};
} // namespace DiskDevice
} // namespace BPrivate
using BPrivate::DiskDevice::KDeleteChildJob;
#endif // _DISK_DEVICE_DELETE_CHILD_JOB_H

View File

@ -0,0 +1,3 @@
// KInitializeJob.cpp
#include "KInitializeJob.h"

View File

@ -0,0 +1,25 @@
// KInitializeJob.h
#ifndef _K_DISK_DEVICE_INITIALIZE_JOB_H
#define _K_DISK_DEVICE_INITIALIZE_JOB_H
#include "KDiskDeviceJob.h"
namespace BPrivate {
namespace DiskDevice {
class KInitializeJob : public KDiskDeviceJob {
public:
KInitializeJob(partition_id partition, disk_system_id diskSystemID,
const char *parameters);
virtual ~KInitializeJob();
virtual status_t Do();
};
} // namespace DiskDevice
} // namespace BPrivate
using BPrivate::DiskDevice::KInitializeJob;
#endif // _DISK_DEVICE_INITIALIZE_JOB_H

View File

@ -0,0 +1,3 @@
// KMoveJob.cpp
#include "KMoveJob.h"

View File

@ -0,0 +1,24 @@
// KMoveJob.h
#ifndef _K_DISK_DEVICE_MOVE_JOB_H
#define _K_DISK_DEVICE_MOVE_JOB_H
#include "KDiskDeviceJob.h"
namespace BPrivate {
namespace DiskDevice {
class KMoveJob : public KDiskDeviceJob {
public:
KMoveJob(partition_id parent, partition_id partition, off_t offset);
virtual ~KMoveJob();
virtual status_t Do();
};
} // namespace DiskDevice
} // namespace BPrivate
using BPrivate::DiskDevice::KMoveJob;
#endif // _DISK_DEVICE_MOVE_JOB_H

View File

@ -0,0 +1,3 @@
// KRepairJob.cpp
#include "KRepairJob.h"

View File

@ -0,0 +1,24 @@
// KRepairJob.h
#ifndef _K_DISK_DEVICE_REPAIR_JOB_H
#define _K_DISK_DEVICE_REPAIR_JOB_H
#include "KDiskDeviceJob.h"
namespace BPrivate {
namespace DiskDevice {
class KRepairJob : public KDiskDeviceJob {
public:
KRepairJob(partition_id partition);
virtual ~KRepairJob();
virtual status_t Do();
};
} // namespace DiskDevice
} // namespace BPrivate
using BPrivate::DiskDevice::KRepairJob;
#endif // _DISK_DEVICE_REPAIR_JOB_H

View File

@ -0,0 +1,3 @@
// KResizeJob.cpp
#include "KResizeJob.h"

View File

@ -0,0 +1,24 @@
// KResizeJob.h
#ifndef _K_DISK_DEVICE_RESIZE_JOB_H
#define _K_DISK_DEVICE_RESIZE_JOB_H
#include "KDiskDeviceJob.h"
namespace BPrivate {
namespace DiskDevice {
class KResizeJob : public KDiskDeviceJob {
public:
KResizeJob(partition_id parent, partition_id partition, off_t size);
virtual ~KResizeJob();
virtual status_t Do();
};
} // namespace DiskDevice
} // namespace BPrivate
using BPrivate::DiskDevice::KResizeJob;
#endif // _DISK_DEVICE_RESIZE_JOB_H

View File

@ -0,0 +1,3 @@
// KScanPartitionJob.cpp
#include "KScanPartitionJob.h"

View File

@ -0,0 +1,24 @@
// KScanPartitionJob.h
#ifndef _K_DISK_DEVICE_SCAN_PARTITION_JOB_H
#define _K_DISK_DEVICE_SCAN_PARTITION_JOB_H
namespace BPrivate {
namespace DiskDevice {
#include "KDiskDeviceJob.h"
class KScanPartitionJob : public KDiskDeviceJob {
public:
KScanPartitionJob(partition_id partition);
virtual ~KScanPartitionJob();
virtual status_t Do();
};
} // namespace DiskDevice
} // namespace BPrivate
using BPrivate::DiskDevice::KScanPartitionJob;
#endif // _DISK_DEVICE_SCAN_PARTITION_JOB_H

View File

@ -0,0 +1,3 @@
// KSetParametersJob.cpp
#include "KSetParametersJob.h"

View File

@ -0,0 +1,25 @@
// KSetParametersJob.h
#ifndef _K_DISK_DEVICE_SET_PARAMETERS_JOB_H
#define _K_DISK_DEVICE_SET_PARAMETERS_JOB_H
namespace BPrivate {
namespace DiskDevice {
#include "KDiskDeviceJob.h"
class KSetParametersJob : public KDiskDeviceJob {
public:
KSetParametersJob(partition_id parent, partition_id partition,
const char *parameters, const char *contentParameters);
virtual ~KSetParametersJob();
virtual status_t Do();
};
} // namespace DiskDevice
} // namespace BPrivate
using BPrivate::DiskDevice::KSetParametersJob;
#endif // _DISK_DEVICE_SET_PARAMETERS_JOB_H