* The shadow_changed() FS and partitioning system hooks take an

additional partition_data* child parameter now.
* _user_get_partitionable_spaces() doesn't need to copy the buffer into
  the kernel, since it is no input parameter. It also copies back the
  actual partitionable spaces count on error, now -- B_BUFFER_OVERFLOW
  is returned when the buffer was too small, but then the count must be
  returned too.
* Fixed several instances of syscall implementations that unloaded a disk
  system, although they didn't load it in the first place. This screwed
  up the load count with undesirable consequences.
* _user_create_child_partition() would set the size to the supplied
  offset.
* Fixed broken loop in KPhysicalPartition::CreateShadowPartition().
* KPartition::RemoveChild() notified the listeners about the wrong
  event.
* Intel partitioning module:
  - The *_get_partitionable_spaces() correctly return B_BUFFER_OVERFLOW
    now, if the supplied buffer is too small.
  - Implemented a part of pm_shadow_changed(), which creates and updates
    the PartitionMap, so that the validate_*() hooks have a chance to
    work at all.



git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@22475 a95241bf-73f2-0310-859d-f6bbb57e9c96
This commit is contained in:
Ingo Weinhold
2007-10-07 15:39:35 +00:00
parent a68ceab8df
commit bf95c9aee6
18 changed files with 335 additions and 88 deletions
@@ -386,17 +386,6 @@ PrimaryPartition::PrimaryPartition()
{
}
// constructor
PrimaryPartition::PrimaryPartition(const partition_descriptor *descriptor,
off_t ptsOffset)
: Partition(),
fHead(NULL),
fTail(NULL),
fLogicalPartitionCount(0)
{
SetTo(descriptor, ptsOffset);
}
// SetTo
void
PrimaryPartition::SetTo(const partition_descriptor *descriptor, off_t ptsOffset)
@@ -419,6 +408,34 @@ PrimaryPartition::Unset()
Partition::Unset();
}
// Assign
status_t
PrimaryPartition::Assign(const PrimaryPartition& other)
{
partition_descriptor descriptor;
other.GetPartitionDescriptor(&descriptor, 0);
SetTo(&descriptor, 0);
const LogicalPartition* otherLogical = other.fHead;
while (otherLogical) {
off_t ptsOffset = otherLogical->PTSOffset();
otherLogical->GetPartitionDescriptor(&descriptor, ptsOffset);
LogicalPartition* logical = new(nothrow) LogicalPartition(
&descriptor, ptsOffset, this);
if (!logical)
return B_NO_MEMORY;
AddLogicalPartition(logical);
otherLogical = otherLogical->Next();
}
return B_OK;
}
// LogicalPartitionAt
LogicalPartition *
PrimaryPartition::LogicalPartitionAt(int32 index) const
@@ -527,6 +544,8 @@ LogicalPartition::Unset()
// constructor
PartitionMap::PartitionMap()
{
for (int32 i = 0; i < 4; i++)
fPrimaries[i].SetIndex(i);
}
// destructor
@@ -542,6 +561,21 @@ PartitionMap::Unset()
fPrimaries[i].Unset();
}
// Assign
status_t
PartitionMap::Assign(const PartitionMap& other)
{
for (int32 i = 0; i < 4; i++) {
status_t error = fPrimaries[i].Assign(other.fPrimaries[i]);
if (error != B_OK)
return error;
}
return B_OK;
}
// PrimaryPartitionAt
PrimaryPartition *
PartitionMap::PrimaryPartitionAt(int32 index)
@@ -562,6 +596,7 @@ PartitionMap::PrimaryPartitionAt(int32 index) const
return partition;
}
// CountPartitions
int32
PartitionMap::CountPartitions() const