* Implemented what was left to do for KDiskDevice and KPartition
management regarding removal and deletion of objects. * Fixed the file disk system related stuff. KFileDiskSystem now uses the virtualdrive driver. The former method was seemed simple and brilliant, but the B_SET_PARTITION ioctl wouldn't work. git-svn-id: file:///srv/svn/repos/haiku/trunk/current@3650 a95241bf-73f2-0310-859d-f6bbb57e9c96
This commit is contained in:
@@ -36,8 +36,10 @@ public:
|
||||
// manager lock owners can be sure, that it won't change.
|
||||
bool ReadLock();
|
||||
void ReadUnlock();
|
||||
bool IsReadLocked(bool orWriteLocked = true);
|
||||
bool WriteLock();
|
||||
void WriteUnlock();
|
||||
bool IsWriteLocked();
|
||||
|
||||
virtual void SetID(partition_id id);
|
||||
|
||||
|
||||
@@ -53,7 +53,7 @@ public:
|
||||
KFileDiskDevice *RegisterFileDevice(const char *filePath,
|
||||
bool noShadow = true);
|
||||
|
||||
status_t CreateFileDevice(const char *filePath, int32 *device = 0);
|
||||
status_t CreateFileDevice(const char *filePath, partition_id *device = 0);
|
||||
status_t DeleteFileDevice(const char *filePath);
|
||||
|
||||
// manager must be locked
|
||||
@@ -62,6 +62,7 @@ public:
|
||||
|
||||
bool PartitionAdded(KPartition *partition); // implementation internal
|
||||
bool PartitionRemoved(KPartition *partition); //
|
||||
bool DeletePartition(KPartition *partition); //
|
||||
|
||||
// Jobs
|
||||
|
||||
@@ -106,9 +107,10 @@ private:
|
||||
status_t _ScanPartition(KPartition *partition);
|
||||
|
||||
BLocker fLock;
|
||||
List<KDiskDevice*> fDevices; // TODO: Optimize!
|
||||
List<KPartition*> fPartitions; //
|
||||
List<KDiskSystem*> fDiskSystems; //
|
||||
List<KDiskDevice*> fDevices; // TODO: Optimize!
|
||||
List<KPartition*> fPartitions; //
|
||||
List<KDiskSystem*> fDiskSystems; //
|
||||
List<KPartition*> fObsoletePartitions; //
|
||||
|
||||
static KDiskDeviceManager *fDefaultManager;
|
||||
};
|
||||
|
||||
@@ -26,9 +26,9 @@ public:
|
||||
|
||||
// virtual void Dump(bool deep = true, int32 level = 0);
|
||||
|
||||
protected:
|
||||
virtual status_t GetMediaStatus(status_t *mediaStatus);
|
||||
virtual status_t GetGeometry(device_geometry *geometry);
|
||||
private:
|
||||
static status_t _RegisterDevice(const char *file, const char *device);
|
||||
static status_t _UnregisterDevice(const char *device);
|
||||
|
||||
private:
|
||||
char *fFilePath;
|
||||
|
||||
@@ -36,6 +36,13 @@ public:
|
||||
void Unregister();
|
||||
int32 CountReferences() const;
|
||||
|
||||
void MarkObsolete();
|
||||
// called by the manager only
|
||||
bool IsObsolete() const;
|
||||
|
||||
virtual bool PrepareForRemoval();
|
||||
virtual bool PrepareForDeletion();
|
||||
|
||||
status_t Open(int flags, int *fd);
|
||||
virtual status_t PublishDevice();
|
||||
virtual status_t UnpublishDevice();
|
||||
@@ -122,7 +129,9 @@ public:
|
||||
status_t AddChild(KPartition *partition, int32 index = -1);
|
||||
status_t CreateChild(partition_id id, int32 index,
|
||||
KPartition **child = NULL);
|
||||
KPartition *RemoveChild(int32 index);
|
||||
bool RemoveChild(int32 index);
|
||||
bool RemoveChild(KPartition *child);
|
||||
bool RemoveAllChildren();
|
||||
KPartition *ChildAt(int32 index) const;
|
||||
int32 CountChildren() const;
|
||||
|
||||
@@ -137,7 +146,6 @@ public:
|
||||
|
||||
void SetDiskSystem(KDiskSystem *diskSystem);
|
||||
KDiskSystem *DiskSystem() const;
|
||||
void SetParentDiskSystem(KDiskSystem *diskSystem);
|
||||
KDiskSystem *ParentDiskSystem() const;
|
||||
// When setting a disk system, it must already be loaded.
|
||||
// The partition will load it too, hence it won't be unloaded before
|
||||
@@ -161,8 +169,8 @@ protected:
|
||||
KDiskDevice *fDevice;
|
||||
KPartition *fParent;
|
||||
KDiskSystem *fDiskSystem;
|
||||
KDiskSystem *fParentDiskSystem;
|
||||
int32 fReferenceCount;
|
||||
bool fObsolete;
|
||||
static int32 fNextID;
|
||||
};
|
||||
|
||||
|
||||
Reference in New Issue
Block a user