* Added the partition size as parameter to the file and partitioning
system initialize() hooks. It's often the only info about the
partition one needs and thus locking the partition just to get it is
no longer necessary.
* intel partitioning system:
- Removed passing around block sizes. We require 512 byte sectors
anyway. In fact using the parent partition's block size was even
wrong.
- Simplified writing the partition map sector.
- Simplified and corrected the partition map initialization.
- We don't fail identifying a partition anymore, if the partition map
contains no partitions. We would never identify a freshly
initialized partition map before.
- Made pm_identify() more intelligent: It determines the priority to
return depending on whether the partition is the device itself and
whether we have recognized child partitions.
git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@22447 a95241bf-73f2-0310-859d-f6bbb57e9c96
This commit is contained in:
@@ -795,10 +795,12 @@ KPartitioningSystem::Initialize(KPartition *partition, const char *name,
|
||||
|
||||
// lock partition and open partition device
|
||||
KDiskDeviceManager *manager = KDiskDeviceManager::Default();
|
||||
// TODO: This looks overly complicated.
|
||||
KPartition *_partition = manager->WriteLockPartition(partition->ID());
|
||||
if (!_partition)
|
||||
return B_ERROR;
|
||||
int fd = -1;
|
||||
off_t partitionSize;
|
||||
{
|
||||
PartitionRegistrar registrar(_partition, true);
|
||||
PartitionRegistrar deviceRegistrar(_partition->Device(), true);
|
||||
@@ -808,12 +810,13 @@ KPartitioningSystem::Initialize(KPartition *partition, const char *name,
|
||||
status_t result = partition->Open(O_RDWR, &fd);
|
||||
if (result != B_OK)
|
||||
return result;
|
||||
|
||||
partitionSize = partition->Size();
|
||||
}
|
||||
|
||||
// let the module do its job
|
||||
// TODO: The partition must not be locked at this point!
|
||||
status_t result = fModule->initialize(fd, partition->ID(), name, parameters,
|
||||
job->ID());
|
||||
partitionSize, job->ID());
|
||||
|
||||
// cleanup and return
|
||||
close(fd);
|
||||
|
||||
Reference in New Issue
Block a user