* Added back and partially reimplemented the
K{Disk,File,Partitioning}System writing methods. It is now required
that the caller has marked the concerned partitions busy, hence we can
(read-)access them without needing a lock. The module interfaces will
will be changed to take advantage of the fact as well. The methods take a
disk_job_id instead of a KDiskDeviceJob* now, though I haven't quite
decided, whether we need it at all or just want to add a special
handling in the cases where notifications during the operation make
sense.
* Reimplemented the disk device write support syscalls (save
_user_move_partition() for which other module hooks are needed). They
call the KDiskSystem methods, now.
git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@22832 a95241bf-73f2-0310-859d-f6bbb57e9c96
This commit is contained in:
@@ -3,114 +3,116 @@
|
||||
* Distributed under the terms of the MIT License.
|
||||
*
|
||||
* Authors:
|
||||
* Ingo Weinhold <[email protected].de>
|
||||
* Ingo Weinhold <ingo_weinhold@gmx.de>
|
||||
*/
|
||||
#ifndef _K_DISK_DEVICE_SYSTEM_H
|
||||
#define _K_DISK_DEVICE_SYSTEM_H
|
||||
|
||||
#include "disk_device_manager.h"
|
||||
|
||||
|
||||
struct user_disk_system_info;
|
||||
|
||||
|
||||
namespace BPrivate {
|
||||
namespace DiskDevice {
|
||||
|
||||
//class KDiskDeviceJob;
|
||||
|
||||
class KPartition;
|
||||
|
||||
|
||||
//! \brief Common ancestor for disk system add-on wrappers
|
||||
class KDiskSystem {
|
||||
public:
|
||||
KDiskSystem(const char *name);
|
||||
virtual ~KDiskSystem();
|
||||
KDiskSystem(const char *name);
|
||||
virtual ~KDiskSystem();
|
||||
|
||||
virtual status_t Init();
|
||||
virtual status_t Init();
|
||||
|
||||
// void SetID(disk_system_id id);
|
||||
disk_system_id ID() const;
|
||||
const char *Name() const;
|
||||
const char *PrettyName();
|
||||
uint32 Flags() const;
|
||||
// void SetID(disk_system_id id);
|
||||
disk_system_id ID() const;
|
||||
|
||||
bool IsFileSystem() const;
|
||||
bool IsPartitioningSystem() const;
|
||||
const char* Name() const;
|
||||
const char* PrettyName();
|
||||
uint32 Flags() const;
|
||||
|
||||
void GetInfo(user_disk_system_info *info);
|
||||
bool IsFileSystem() const;
|
||||
bool IsPartitioningSystem() const;
|
||||
|
||||
void GetInfo(user_disk_system_info* info);
|
||||
|
||||
// manager will be locked
|
||||
status_t Load(); // load/unload -- can be nested
|
||||
void Unload(); //
|
||||
bool IsLoaded() const;
|
||||
status_t Load(); // load/unload -- can be nested
|
||||
void Unload(); //
|
||||
bool IsLoaded() const;
|
||||
|
||||
// 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);
|
||||
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.
|
||||
// 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).
|
||||
|
||||
#if 0
|
||||
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);
|
||||
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);
|
||||
virtual status_t SetParameters(KPartition *partition,
|
||||
const char *parameters,
|
||||
KDiskDeviceJob *job);
|
||||
virtual status_t SetContentParameters(KPartition *partition,
|
||||
const char *parameters,
|
||||
KDiskDeviceJob *job);
|
||||
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);
|
||||
// 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.
|
||||
#endif // 0
|
||||
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);
|
||||
|
||||
protected:
|
||||
virtual status_t LoadModule();
|
||||
virtual void UnloadModule();
|
||||
virtual status_t LoadModule();
|
||||
virtual void UnloadModule();
|
||||
|
||||
status_t SetPrettyName(const char *name);
|
||||
void SetFlags(uint32 flags);
|
||||
status_t SetPrettyName(const char* name);
|
||||
void SetFlags(uint32 flags);
|
||||
|
||||
static int32 _NextID();
|
||||
static int32 _NextID();
|
||||
|
||||
private:
|
||||
disk_system_id fID;
|
||||
char *fName;
|
||||
char *fPrettyName;
|
||||
uint32 fFlags;
|
||||
int32 fLoadCounter;
|
||||
disk_system_id fID;
|
||||
char* fName;
|
||||
char* fPrettyName;
|
||||
uint32 fFlags;
|
||||
int32 fLoadCounter;
|
||||
|
||||
static int32 fNextID;
|
||||
static int32 fNextID;
|
||||
};
|
||||
|
||||
|
||||
} // namespace DiskDevice
|
||||
} // namespace BPrivate
|
||||
|
||||
|
||||
Reference in New Issue
Block a user