2007-07-27 20:32:47 +04:00
|
|
|
/*
|
2008-05-10 15:44:00 +04:00
|
|
|
* Copyright 2003-2008, Haiku, Inc. All Rights Reserved.
|
2007-07-27 20:32:47 +04:00
|
|
|
* Distributed under the terms of the MIT License.
|
|
|
|
*
|
|
|
|
* Authors:
|
2007-11-05 03:42:47 +03:00
|
|
|
* Ingo Weinhold <ingo_weinhold@gmx.de>
|
2007-07-27 20:32:47 +04:00
|
|
|
*/
|
2003-06-10 03:04:54 +04:00
|
|
|
#ifndef _K_DISK_DEVICE_SYSTEM_H
|
|
|
|
#define _K_DISK_DEVICE_SYSTEM_H
|
|
|
|
|
2008-05-10 15:44:00 +04:00
|
|
|
|
2003-06-10 03:04:54 +04:00
|
|
|
#include "disk_device_manager.h"
|
|
|
|
|
2007-11-05 03:42:47 +03:00
|
|
|
|
2003-07-09 03:23:27 +04:00
|
|
|
struct user_disk_system_info;
|
|
|
|
|
2007-11-05 03:42:47 +03:00
|
|
|
|
2003-06-10 03:04:54 +04:00
|
|
|
namespace BPrivate {
|
|
|
|
namespace DiskDevice {
|
|
|
|
|
2007-11-05 03:42:47 +03:00
|
|
|
|
2003-06-10 03:04:54 +04:00
|
|
|
class KPartition;
|
|
|
|
|
2007-11-05 03:42:47 +03:00
|
|
|
|
2007-07-27 20:32:47 +04:00
|
|
|
//! \brief Common ancestor for disk system add-on wrappers
|
2003-06-10 03:04:54 +04:00
|
|
|
class KDiskSystem {
|
2003-06-11 02:36:31 +04:00
|
|
|
public:
|
2007-11-05 03:42:47 +03:00
|
|
|
KDiskSystem(const char *name);
|
|
|
|
virtual ~KDiskSystem();
|
|
|
|
|
|
|
|
virtual status_t Init();
|
2003-06-10 03:04:54 +04:00
|
|
|
|
2007-11-05 03:42:47 +03:00
|
|
|
// void SetID(disk_system_id id);
|
|
|
|
disk_system_id ID() const;
|
2003-06-12 02:00:59 +04:00
|
|
|
|
2007-11-05 03:42:47 +03:00
|
|
|
const char* Name() const;
|
2008-05-10 15:44:00 +04:00
|
|
|
const char* ShortName() const;
|
|
|
|
const char* PrettyName() const;
|
2007-11-05 03:42:47 +03:00
|
|
|
uint32 Flags() const;
|
2003-06-10 03:04:54 +04:00
|
|
|
|
2007-11-05 03:42:47 +03:00
|
|
|
bool IsFileSystem() const;
|
|
|
|
bool IsPartitioningSystem() const;
|
2003-06-10 03:04:54 +04:00
|
|
|
|
2007-11-05 03:42:47 +03:00
|
|
|
void GetInfo(user_disk_system_info* info);
|
2003-07-09 03:23:27 +04:00
|
|
|
|
2003-06-13 02:21:10 +04:00
|
|
|
// manager will be locked
|
2007-11-05 03:42:47 +03: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.
|
|
|
|
|
2007-11-05 03:42:47 +03:00
|
|
|
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);
|
2003-06-10 03:04:54 +04:00
|
|
|
|
|
|
|
// Writing
|
2007-11-05 03:42:47 +03:00
|
|
|
// Device should not be locked, but all affected partitions are marked
|
|
|
|
// busy, meaning that no one else is allowed to modify it (and we only,
|
|
|
|
// if we get a write lock).
|
|
|
|
|
|
|
|
virtual status_t Defragment(KPartition* partition,
|
|
|
|
disk_job_id job);
|
|
|
|
virtual status_t Repair(KPartition* partition, bool checkOnly,
|
|
|
|
disk_job_id job);
|
|
|
|
virtual status_t Resize(KPartition* partition, off_t size,
|
|
|
|
disk_job_id job);
|
|
|
|
virtual status_t ResizeChild(KPartition* child, off_t size,
|
|
|
|
disk_job_id job);
|
|
|
|
virtual status_t Move(KPartition* partition, off_t offset,
|
|
|
|
disk_job_id job);
|
|
|
|
virtual status_t MoveChild(KPartition* child, off_t offset,
|
|
|
|
disk_job_id job);
|
|
|
|
virtual status_t SetName(KPartition* partition, const char* name,
|
|
|
|
disk_job_id job);
|
|
|
|
virtual status_t SetContentName(KPartition* partition,
|
|
|
|
const char* name, disk_job_id job);
|
|
|
|
virtual status_t SetType(KPartition* partition, const char* type,
|
|
|
|
disk_job_id job);
|
|
|
|
virtual status_t SetParameters(KPartition* partition,
|
|
|
|
const char* parameters, disk_job_id job);
|
|
|
|
virtual status_t SetContentParameters(KPartition* partition,
|
|
|
|
const char* parameters, disk_job_id job);
|
|
|
|
virtual status_t Initialize(KPartition* partition,
|
|
|
|
const char* name, const char* parameters,
|
|
|
|
disk_job_id job);
|
|
|
|
virtual status_t CreateChild(KPartition* partition, off_t offset,
|
|
|
|
off_t size, const char* type,
|
|
|
|
const char* name, const char* parameters,
|
|
|
|
disk_job_id job, KPartition** child = NULL,
|
|
|
|
partition_id childID = -1);
|
|
|
|
virtual status_t DeleteChild(KPartition* child, disk_job_id job);
|
2003-06-11 02:36:31 +04:00
|
|
|
|
|
|
|
protected:
|
2007-11-05 03:42:47 +03:00
|
|
|
virtual status_t LoadModule();
|
|
|
|
virtual void UnloadModule();
|
2003-06-11 02:36:31 +04:00
|
|
|
|
2008-05-10 15:44:00 +04:00
|
|
|
status_t SetShortName(const char* name);
|
2007-11-05 03:42:47 +03:00
|
|
|
status_t SetPrettyName(const char* name);
|
|
|
|
void SetFlags(uint32 flags);
|
2003-06-12 02:00:59 +04:00
|
|
|
|
2007-11-05 03:42:47 +03:00
|
|
|
static int32 _NextID();
|
2003-06-14 02:08:10 +04:00
|
|
|
|
2003-06-11 02:36:31 +04:00
|
|
|
private:
|
2007-11-05 03:42:47 +03:00
|
|
|
disk_system_id fID;
|
|
|
|
char* fName;
|
2008-05-10 15:44:00 +04:00
|
|
|
char* fShortName;
|
2007-11-05 03:42:47 +03:00
|
|
|
char* fPrettyName;
|
|
|
|
uint32 fFlags;
|
|
|
|
int32 fLoadCounter;
|
2003-06-14 02:08:10 +04:00
|
|
|
|
2007-11-05 03:42:47 +03:00
|
|
|
static int32 fNextID;
|
2003-06-10 03:04:54 +04:00
|
|
|
};
|
|
|
|
|
2007-11-05 03:42:47 +03:00
|
|
|
|
2003-06-10 03:04:54 +04:00
|
|
|
} // namespace DiskDevice
|
|
|
|
} // namespace BPrivate
|
|
|
|
|
|
|
|
using BPrivate::DiskDevice::KDiskSystem;
|
|
|
|
|
|
|
|
#endif // _K_DISK_DEVICE_SYSTEM_H
|