2003-06-10 03:04:54 +04:00
|
|
|
// KDiskSystem.h
|
|
|
|
|
|
|
|
#ifndef _K_DISK_DEVICE_SYSTEM_H
|
|
|
|
#define _K_DISK_DEVICE_SYSTEM_H
|
|
|
|
|
|
|
|
#include "disk_device_manager.h"
|
|
|
|
|
2003-07-09 03:23:27 +04:00
|
|
|
struct user_disk_system_info;
|
|
|
|
|
2003-06-10 03:04:54 +04:00
|
|
|
namespace BPrivate {
|
|
|
|
namespace DiskDevice {
|
|
|
|
|
|
|
|
class KDiskDeviceJob;
|
|
|
|
class KPartition;
|
|
|
|
|
|
|
|
class KDiskSystem {
|
2003-06-11 02:36:31 +04:00
|
|
|
public:
|
2003-06-10 03:04:54 +04:00
|
|
|
KDiskSystem(const char *name);
|
|
|
|
virtual ~KDiskSystem();
|
|
|
|
|
2003-06-12 02:00:59 +04:00
|
|
|
virtual status_t Init();
|
|
|
|
|
2003-06-23 03:03:17 +04:00
|
|
|
// void SetID(disk_system_id id);
|
2003-06-10 03:04:54 +04:00
|
|
|
disk_system_id ID() const;
|
|
|
|
const char *Name() const;
|
2003-07-18 22:41:21 +04:00
|
|
|
const char *PrettyName();
|
|
|
|
uint32 Flags() const;
|
2003-06-10 03:04:54 +04:00
|
|
|
|
2003-07-18 22:41:21 +04:00
|
|
|
bool IsFileSystem() const;
|
2003-06-10 03:04:54 +04:00
|
|
|
bool IsPartitioningSystem() const;
|
|
|
|
|
2003-07-09 03:23:27 +04:00
|
|
|
void GetInfo(user_disk_system_info *info);
|
|
|
|
|
2003-06-13 02:21:10 +04:00
|
|
|
// manager will be locked
|
2003-06-11 02:36:31 +04:00
|
|
|
status_t Load(); // load/unload -- can be nested
|
|
|
|
void Unload(); //
|
|
|
|
bool IsLoaded() const;
|
2003-06-10 03:04:54 +04:00
|
|
|
|
|
|
|
// Scanning
|
|
|
|
// Device must be write locked.
|
|
|
|
|
|
|
|
virtual float Identify(KPartition *partition, void **cookie);
|
|
|
|
virtual status_t Scan(KPartition *partition, void *cookie);
|
|
|
|
virtual void FreeIdentifyCookie(KPartition *partition, void *cookie);
|
|
|
|
virtual void FreeCookie(KPartition *partition);
|
|
|
|
virtual void FreeContentCookie(KPartition *partition);
|
|
|
|
|
|
|
|
// Querying
|
|
|
|
// Device must be read locked.
|
|
|
|
|
|
|
|
virtual bool SupportsDefragmenting(KPartition *partition,
|
|
|
|
bool *whileMounted);
|
|
|
|
virtual bool SupportsRepairing(KPartition *partition, bool checkOnly,
|
|
|
|
bool *whileMounted);
|
|
|
|
virtual bool SupportsResizing(KPartition *partition, bool *whileMounted);
|
|
|
|
virtual bool SupportsResizingChild(KPartition *child);
|
2003-07-20 00:29:58 +04:00
|
|
|
virtual bool SupportsMoving(KPartition *partition, bool *isNoOp);
|
2003-06-10 03:04:54 +04:00
|
|
|
virtual bool SupportsMovingChild(KPartition *child);
|
2003-07-16 01:41:32 +04:00
|
|
|
virtual bool SupportsSettingName(KPartition *partition);
|
|
|
|
virtual bool SupportsSettingContentName(KPartition *partition,
|
|
|
|
bool *whileMounted);
|
|
|
|
virtual bool SupportsSettingType(KPartition *partition);
|
2003-07-20 00:29:58 +04:00
|
|
|
virtual bool SupportsSettingParameters(KPartition *partition);
|
|
|
|
virtual bool SupportsSettingContentParameters(KPartition *partition,
|
|
|
|
bool *whileMounted);
|
2003-07-16 01:41:32 +04:00
|
|
|
virtual bool SupportsInitializing(KPartition *partition);
|
|
|
|
virtual bool SupportsInitializingChild(KPartition *child,
|
|
|
|
const char *diskSystem);
|
2003-07-20 00:29:58 +04:00
|
|
|
virtual bool SupportsCreatingChild(KPartition *partition);
|
|
|
|
virtual bool SupportsDeletingChild(KPartition *child);
|
2003-07-17 01:00:01 +04:00
|
|
|
virtual bool IsSubSystemFor(KPartition *partition);
|
2003-06-10 03:04:54 +04:00
|
|
|
|
|
|
|
virtual bool ValidateResize(KPartition *partition, off_t *size);
|
2003-07-20 21:15:35 +04:00
|
|
|
virtual bool ValidateResizeChild(KPartition *child, off_t *size);
|
2003-06-23 03:03:17 +04:00
|
|
|
virtual bool ValidateMove(KPartition *partition, off_t *start);
|
2003-07-20 21:15:35 +04:00
|
|
|
virtual bool ValidateMoveChild(KPartition *child, off_t *start);
|
2003-07-16 01:41:32 +04:00
|
|
|
virtual bool ValidateSetName(KPartition *partition, char *name);
|
|
|
|
virtual bool ValidateSetContentName(KPartition *partition, char *name);
|
|
|
|
virtual bool ValidateSetType(KPartition *partition, const char *type);
|
2003-06-10 03:04:54 +04:00
|
|
|
virtual bool ValidateSetParameters(KPartition *partition,
|
|
|
|
const char *parameters);
|
2003-07-20 21:15:35 +04:00
|
|
|
virtual bool ValidateSetContentParameters(KPartition *parameters,
|
2003-06-10 03:04:54 +04:00
|
|
|
const char *parameters);
|
2003-07-20 00:29:58 +04:00
|
|
|
virtual bool ValidateInitialize(KPartition *partition, char *name,
|
|
|
|
const char *parameters);
|
|
|
|
virtual bool ValidateCreateChild(KPartition *partition, off_t *start,
|
|
|
|
off_t *size, const char *type,
|
2003-07-25 02:53:23 +04:00
|
|
|
const char *parameters, int32 *index);
|
2003-06-10 03:04:54 +04:00
|
|
|
virtual int32 CountPartitionableSpaces(KPartition *partition);
|
2003-07-20 21:15:35 +04:00
|
|
|
virtual status_t GetPartitionableSpaces(KPartition *partition,
|
|
|
|
partitionable_space_data *buffer,
|
|
|
|
int32 count,
|
|
|
|
int32 *actualCount = NULL);
|
2003-06-10 03:04:54 +04:00
|
|
|
|
2003-07-16 01:41:32 +04:00
|
|
|
virtual status_t GetNextSupportedType(KPartition *partition, int32 *cookie,
|
|
|
|
char *type);
|
|
|
|
virtual status_t GetTypeForContentType(const char *contentType,
|
|
|
|
char *type);
|
|
|
|
|
2003-07-25 02:53:23 +04:00
|
|
|
// Shadow partition modification
|
|
|
|
// Device must be write locked.
|
|
|
|
|
|
|
|
virtual status_t ShadowPartitionChanged(KPartition *partition,
|
|
|
|
uint32 operation);
|
|
|
|
|
2003-06-10 03:04:54 +04:00
|
|
|
// Writing
|
|
|
|
// Device should not be locked.
|
|
|
|
|
|
|
|
virtual status_t Defragment(KPartition *partition, KDiskDeviceJob *job);
|
|
|
|
virtual status_t Repair(KPartition *partition, bool checkOnly,
|
|
|
|
KDiskDeviceJob *job);
|
|
|
|
virtual status_t Resize(KPartition *partition, off_t size,
|
|
|
|
KDiskDeviceJob *job);
|
|
|
|
virtual status_t ResizeChild(KPartition *child, off_t size,
|
|
|
|
KDiskDeviceJob *job);
|
|
|
|
virtual status_t Move(KPartition *partition, off_t offset,
|
|
|
|
KDiskDeviceJob *job);
|
|
|
|
virtual status_t MoveChild(KPartition *child, off_t offset,
|
|
|
|
KDiskDeviceJob *job);
|
2003-07-16 01:41:32 +04:00
|
|
|
virtual status_t SetName(KPartition *partition, char *name,
|
|
|
|
KDiskDeviceJob *job);
|
|
|
|
virtual status_t SetContentName(KPartition *partition, char *name,
|
|
|
|
KDiskDeviceJob *job);
|
|
|
|
virtual status_t SetType(KPartition *partition, char *type,
|
|
|
|
KDiskDeviceJob *job);
|
2003-06-10 03:04:54 +04:00
|
|
|
virtual status_t SetParameters(KPartition *partition,
|
|
|
|
const char *parameters,
|
|
|
|
KDiskDeviceJob *job);
|
|
|
|
virtual status_t SetContentParameters(KPartition *partition,
|
|
|
|
const char *parameters,
|
|
|
|
KDiskDeviceJob *job);
|
2003-07-20 00:29:58 +04:00
|
|
|
virtual status_t Initialize(KPartition *partition, const char *name,
|
|
|
|
const char *parameters, KDiskDeviceJob *job);
|
|
|
|
virtual status_t CreateChild(KPartition *partition, off_t offset,
|
|
|
|
off_t size, const char *type,
|
|
|
|
const char *parameters, KDiskDeviceJob *job,
|
|
|
|
KPartition **child = NULL,
|
|
|
|
partition_id childID = -1);
|
|
|
|
virtual status_t DeleteChild(KPartition *child, KDiskDeviceJob *job);
|
2003-06-10 03:04:54 +04:00
|
|
|
// The KPartition* parameters for the writing methods are a bit `volatile',
|
|
|
|
// since the device will not be locked, when they are called. The KPartition
|
|
|
|
// is registered though, so that it is at least guaranteed that the object
|
|
|
|
// won't go away.
|
2003-06-11 02:36:31 +04:00
|
|
|
|
|
|
|
protected:
|
|
|
|
virtual status_t LoadModule();
|
|
|
|
virtual void UnloadModule();
|
|
|
|
|
2003-06-12 02:00:59 +04:00
|
|
|
status_t SetPrettyName(const char *name);
|
2003-07-18 22:41:21 +04:00
|
|
|
void SetFlags(uint32 flags);
|
2003-06-12 02:00:59 +04:00
|
|
|
|
2003-06-14 02:08:10 +04:00
|
|
|
static int32 _NextID();
|
|
|
|
|
2003-06-11 02:36:31 +04:00
|
|
|
private:
|
|
|
|
disk_system_id fID;
|
|
|
|
char *fName;
|
2003-06-12 02:00:59 +04:00
|
|
|
char *fPrettyName;
|
2003-07-18 22:41:21 +04:00
|
|
|
uint32 fFlags;
|
2003-06-11 02:36:31 +04:00
|
|
|
int32 fLoadCounter;
|
2003-06-14 02:08:10 +04:00
|
|
|
|
|
|
|
static int32 fNextID;
|
2003-06-10 03:04:54 +04:00
|
|
|
};
|
|
|
|
|
|
|
|
} // namespace DiskDevice
|
|
|
|
} // namespace BPrivate
|
|
|
|
|
|
|
|
using BPrivate::DiskDevice::KDiskSystem;
|
|
|
|
|
|
|
|
#endif // _K_DISK_DEVICE_SYSTEM_H
|