Implemented some more bits of KPartition. Added a very useful Open() method.

git-svn-id: file:///srv/svn/repos/haiku/trunk/current@3463 a95241bf-73f2-0310-859d-f6bbb57e9c96
This commit is contained in:
Ingo Weinhold
2003-06-10 22:37:43 +00:00
parent af4c45d5d8
commit 0b6c74bbe3
2 changed files with 103 additions and 50 deletions
@@ -6,12 +6,6 @@
#include "disk_device_manager.h"
#include "List.h"
namespace BPrivate {
namespace DiskDevice {
class KDiskDevice;
class KDiskSystem;
// partition flags
// TODO: move to another header (must be accessible from userland API impl.)
enum {
@@ -24,17 +18,26 @@ enum {
B_PARTITION_DESCENDANT_BUSY = 0x40,
};
namespace BPrivate {
namespace DiskDevice {
class KDiskDevice;
class KDiskSystem;
class KPartition {
public:
KPartition(partition_id id = -1);
virtual ~KPartition();
// Reference counting. As long as there's at least one referrer, the
// object won't be deleted.
// manager must be locked
bool Register();
bool Unregister();
void Register();
void Unregister();
int32 CountReferences() const;
status_t Open(int flags, int *fd);
void SetBusy(bool busy);
bool IsBusy() const;
// == jobs which may affect this partition are scheduled/in progress
@@ -84,7 +87,7 @@ class KPartition {
partition_data *PartitionData();
const partition_data *PartitionData() const;
void SetID(partition_id id);
virtual void SetID(partition_id id);
partition_id ID() const;
int32 ChangeCounter() const;
@@ -139,6 +142,9 @@ class KPartition {
void SetContentCookie(void *cookie);
void *ContentCookie() const;
private:
void _UpdateChildIndices(int32 index);
protected:
partition_data fPartitionData;
List<KPartition*> fChildren;