2007-07-27 16:32:47 +00:00
|
|
|
/*
|
|
|
|
* Copyright 2003-2007, Haiku, Inc. All Rights Reserved.
|
|
|
|
* Distributed under the terms of the MIT License.
|
|
|
|
*
|
|
|
|
* Authors:
|
|
|
|
* Ingo Weinhold <bonefish@cs.tu-berlin.de>
|
|
|
|
*/
|
2003-06-09 23:04:54 +00:00
|
|
|
#ifndef _K_DISK_DEVICE_SYSTEM_H
|
|
|
|
#define _K_DISK_DEVICE_SYSTEM_H
|
|
|
|
|
|
|
|
#include "disk_device_manager.h"
|
|
|
|
|
2003-07-08 23:23:27 +00:00
|
|
|
struct user_disk_system_info;
|
|
|
|
|
2003-06-09 23:04:54 +00:00
|
|
|
namespace BPrivate {
|
|
|
|
namespace DiskDevice {
|
|
|
|
|
2007-11-01 22:41:22 +00:00
|
|
|
//class KDiskDeviceJob;
|
2003-06-09 23:04:54 +00:00
|
|
|
class KPartition;
|
|
|
|
|
2007-07-27 16:32:47 +00:00
|
|
|
//! \brief Common ancestor for disk system add-on wrappers
|
2003-06-09 23:04:54 +00:00
|
|
|
class KDiskSystem {
|
2003-06-10 22:36:31 +00:00
|
|
|
public:
|
2003-06-09 23:04:54 +00:00
|
|
|
KDiskSystem(const char *name);
|
|
|
|
virtual ~KDiskSystem();
|
|
|
|
|
2003-06-11 22:00:59 +00:00
|
|
|
virtual status_t Init();
|
|
|
|
|
2003-06-22 23:03:17 +00:00
|
|
|
// void SetID(disk_system_id id);
|
2003-06-09 23:04:54 +00:00
|
|
|
disk_system_id ID() const;
|
|
|
|
const char *Name() const;
|
2003-07-18 18:41:21 +00:00
|
|
|
const char *PrettyName();
|
|
|
|
uint32 Flags() const;
|
2003-06-09 23:04:54 +00:00
|
|
|
|
2003-07-18 18:41:21 +00:00
|
|
|
bool IsFileSystem() const;
|
2003-06-09 23:04:54 +00:00
|
|
|
bool IsPartitioningSystem() const;
|
|
|
|
|
2003-07-08 23:23:27 +00:00
|
|
|
void GetInfo(user_disk_system_info *info);
|
|
|
|
|
2003-06-12 22:21:10 +00:00
|
|
|
// manager will be locked
|
2003-06-10 22:36:31 +00:00
|
|
|
status_t Load(); // load/unload -- can be nested
|
|
|
|
void Unload(); //
|
|
|
|
bool IsLoaded() const;
|
2003-06-09 23:04:54 +00: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);
|
|
|
|
|
|
|
|
// Writing
|
|
|
|
// Device should not be locked.
|
|
|
|
|
2007-11-01 22:41:22 +00:00
|
|
|
#if 0
|
2003-06-09 23:04:54 +00:00
|
|
|
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-15 21:41:32 +00: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-09 23:04:54 +00: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-19 20:29:58 +00: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-09 23:04:54 +00: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.
|
2007-11-01 22:41:22 +00:00
|
|
|
#endif // 0
|
2003-06-10 22:36:31 +00:00
|
|
|
|
|
|
|
protected:
|
|
|
|
virtual status_t LoadModule();
|
|
|
|
virtual void UnloadModule();
|
|
|
|
|
2003-06-11 22:00:59 +00:00
|
|
|
status_t SetPrettyName(const char *name);
|
2003-07-18 18:41:21 +00:00
|
|
|
void SetFlags(uint32 flags);
|
2003-06-11 22:00:59 +00:00
|
|
|
|
2003-06-13 22:08:10 +00:00
|
|
|
static int32 _NextID();
|
|
|
|
|
2003-06-10 22:36:31 +00:00
|
|
|
private:
|
|
|
|
disk_system_id fID;
|
|
|
|
char *fName;
|
2003-06-11 22:00:59 +00:00
|
|
|
char *fPrettyName;
|
2003-07-18 18:41:21 +00:00
|
|
|
uint32 fFlags;
|
2003-06-10 22:36:31 +00:00
|
|
|
int32 fLoadCounter;
|
2003-06-13 22:08:10 +00:00
|
|
|
|
|
|
|
static int32 fNextID;
|
2003-06-09 23:04:54 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
} // namespace DiskDevice
|
|
|
|
} // namespace BPrivate
|
|
|
|
|
|
|
|
using BPrivate::DiskDevice::KDiskSystem;
|
|
|
|
|
|
|
|
#endif // _K_DISK_DEVICE_SYSTEM_H
|