Implemented a preliminary disk device scanning in KDiskDeviceManager.
Some changes to KPartition, KDiskDevice, KDiskSystem on this way. Still missing is KPartition::Publish() and its invocation in KDiskDeviceManager. Then everything should be in place to start with porting the scanning parts of our disk system modules. git-svn-id: file:///srv/svn/repos/haiku/trunk/current@3486 a95241bf-73f2-0310-859d-f6bbb57e9c96
This commit is contained in:
@@ -23,7 +23,10 @@ public:
|
||||
KDiskDevice(partition_id id = -1);
|
||||
virtual ~KDiskDevice();
|
||||
|
||||
status_t SetTo(const char *path);
|
||||
void Unset();
|
||||
status_t InitCheck() const;
|
||||
// TODO: probably superfluous
|
||||
|
||||
// A read lock owner can be sure that the device (incl. all of its
|
||||
// partitions won't be changed).
|
||||
@@ -64,6 +67,8 @@ public:
|
||||
team_id ShadowOwner() const;
|
||||
|
||||
private:
|
||||
void _InitPartitionData();
|
||||
|
||||
disk_device_data fDeviceData;
|
||||
RWLocker fLocker;
|
||||
int fFD;
|
||||
|
||||
@@ -44,12 +44,13 @@ public:
|
||||
|
||||
KDiskDevice *RegisterDevice(const char *path, bool noShadow = true);
|
||||
KDiskDevice *RegisterDevice(partition_id id, bool noShadow = true);
|
||||
KDiskDevice *RegisterNextDevice(int32 *cookie);
|
||||
KPartition *RegisterPartition(const char *path, bool noShadow = true);
|
||||
KPartition *RegisterPartition(partition_id id, bool noShadow = true);
|
||||
|
||||
// manager must be locked
|
||||
int32 CountDiskDevices();
|
||||
KDiskDevice *DiskDeviceAt(int32 index);
|
||||
int32 CountDevices();
|
||||
KDiskDevice *DeviceAt(int32 index);
|
||||
|
||||
bool PartitionAdded(KPartition *partition); // implementation internal
|
||||
bool PartitionRemoved(KPartition *partition); //
|
||||
@@ -74,16 +75,24 @@ public:
|
||||
int32 CountDiskSystems();
|
||||
KDiskSystem *DiskSystemAt(int32 index);
|
||||
|
||||
KDiskSystem *LoadDiskSystem(disk_system_id id);
|
||||
KDiskSystem *LoadNextDiskSystem(int32 *cookie);
|
||||
|
||||
// Watching
|
||||
|
||||
// TODO: Watching service for the kernel. The userland watching is handled
|
||||
// by the registrar.
|
||||
|
||||
status_t InitialDeviceScan();
|
||||
|
||||
private:
|
||||
status_t _AddPartitioningSystem(const char *name);
|
||||
status_t _AddFileSystem(const char *name);
|
||||
status_t _AddDiskSystem(KDiskSystem *diskSystem);
|
||||
|
||||
status_t _Scan(const char *path);
|
||||
status_t _ScanPartition(KPartition *partition);
|
||||
|
||||
BLocker fLock;
|
||||
List<KDiskDevice*> fDevices; // TODO: Optimize!
|
||||
List<KPartition*> fPartitions; //
|
||||
|
||||
@@ -26,6 +26,7 @@ public:
|
||||
virtual bool IsFileSystem() const;
|
||||
bool IsPartitioningSystem() const;
|
||||
|
||||
// manager will be locked
|
||||
status_t Load(); // load/unload -- can be nested
|
||||
void Unload(); //
|
||||
bool IsLoaded() const;
|
||||
|
||||
@@ -139,6 +139,9 @@ public:
|
||||
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
|
||||
// it is unset here.
|
||||
|
||||
void SetCookie(void *cookie);
|
||||
void *Cookie() const;
|
||||
@@ -148,6 +151,7 @@ public:
|
||||
|
||||
private:
|
||||
void _UpdateChildIndices(int32 index);
|
||||
static int32 _NextID();
|
||||
|
||||
protected:
|
||||
partition_data fPartitionData;
|
||||
@@ -157,6 +161,7 @@ protected:
|
||||
KDiskSystem *fDiskSystem;
|
||||
KDiskSystem *fParentDiskSystem;
|
||||
int32 fReferenceCount;
|
||||
static int32 fNextID;
|
||||
};
|
||||
|
||||
} // namespace DiskDevice
|
||||
|
||||
Reference in New Issue
Block a user