* Added CreateChild().
* Added Publish/UnpublishDevice(). Not implemented yet. * small fixes git-svn-id: file:///srv/svn/repos/haiku/trunk/current@3479 a95241bf-73f2-0310-859d-f6bbb57e9c96
This commit is contained in:
@@ -31,12 +31,14 @@ public:
|
|||||||
|
|
||||||
// Reference counting. As long as there's at least one referrer, the
|
// Reference counting. As long as there's at least one referrer, the
|
||||||
// object won't be deleted.
|
// object won't be deleted.
|
||||||
// manager must be locked
|
// manager must be locked (Unregister() locks itself)
|
||||||
void Register();
|
void Register();
|
||||||
void Unregister();
|
void Unregister();
|
||||||
int32 CountReferences() const;
|
int32 CountReferences() const;
|
||||||
|
|
||||||
status_t Open(int flags, int *fd);
|
status_t Open(int flags, int *fd);
|
||||||
|
status_t PublishDevice();
|
||||||
|
status_t UnpublishDevice();
|
||||||
|
|
||||||
void SetBusy(bool busy);
|
void SetBusy(bool busy);
|
||||||
bool IsBusy() const;
|
bool IsBusy() const;
|
||||||
@@ -118,6 +120,8 @@ public:
|
|||||||
KPartition *Parent() const;
|
KPartition *Parent() const;
|
||||||
|
|
||||||
status_t AddChild(KPartition *partition, int32 index = -1);
|
status_t AddChild(KPartition *partition, int32 index = -1);
|
||||||
|
status_t CreateChild(partition_id id, int32 index,
|
||||||
|
KPartition **child = NULL);
|
||||||
KPartition *RemoveChild(int32 index);
|
KPartition *RemoveChild(int32 index);
|
||||||
KPartition *ChildAt(int32 index) const;
|
KPartition *ChildAt(int32 index) const;
|
||||||
int32 CountChildren() const;
|
int32 CountChildren() const;
|
||||||
|
|||||||
@@ -70,6 +70,7 @@ KPartition::Register()
|
|||||||
void
|
void
|
||||||
KPartition::Unregister()
|
KPartition::Unregister()
|
||||||
{
|
{
|
||||||
|
ManagerLocker locker(KDiskDeviceManager::Default());
|
||||||
fReferenceCount--;
|
fReferenceCount--;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -98,6 +99,22 @@ KPartition::Open(int flags, int *fd)
|
|||||||
return B_OK;
|
return B_OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// PublishDevice
|
||||||
|
status_t
|
||||||
|
KPartition::PublishDevice()
|
||||||
|
{
|
||||||
|
// not implemented
|
||||||
|
return B_ERROR;
|
||||||
|
}
|
||||||
|
|
||||||
|
// UnpublishDevice
|
||||||
|
status_t
|
||||||
|
KPartition::UnpublishDevice()
|
||||||
|
{
|
||||||
|
// not implemented
|
||||||
|
return B_ERROR;
|
||||||
|
}
|
||||||
|
|
||||||
// SetBusy
|
// SetBusy
|
||||||
void
|
void
|
||||||
KPartition::SetBusy(bool busy)
|
KPartition::SetBusy(bool busy)
|
||||||
@@ -339,6 +356,8 @@ KPartition::ID() const
|
|||||||
int32
|
int32
|
||||||
KPartition::ChangeCounter() const
|
KPartition::ChangeCounter() const
|
||||||
{
|
{
|
||||||
|
// not implemented
|
||||||
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
// GetPath
|
// GetPath
|
||||||
@@ -486,6 +505,29 @@ KPartition::AddChild(KPartition *partition, int32 index)
|
|||||||
return B_ERROR;
|
return B_ERROR;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// CreateChild
|
||||||
|
status_t
|
||||||
|
KPartition::CreateChild(partition_id id, int32 index, KPartition **_child)
|
||||||
|
{
|
||||||
|
// check parameters
|
||||||
|
int32 count = fPartitionData.child_count;
|
||||||
|
if (index == -1)
|
||||||
|
index = count;
|
||||||
|
if (index < 0 || index > count)
|
||||||
|
return B_BAD_VALUE;
|
||||||
|
// create and add partition
|
||||||
|
KPartition *child = new(nothrow) KPartition(id);
|
||||||
|
if (!child)
|
||||||
|
return B_NO_MEMORY;
|
||||||
|
status_t error = AddChild(child, index);
|
||||||
|
// cleanup / set result
|
||||||
|
if (error != B_OK)
|
||||||
|
delete child;
|
||||||
|
else if (_child)
|
||||||
|
*_child = child;
|
||||||
|
return error;
|
||||||
|
}
|
||||||
|
|
||||||
// RemoveChild
|
// RemoveChild
|
||||||
KPartition *
|
KPartition *
|
||||||
KPartition::RemoveChild(int32 index)
|
KPartition::RemoveChild(int32 index)
|
||||||
|
|||||||
Reference in New Issue
Block a user