loader: Drop the HashMap for partition lookup by id

The HashMap constructor was called before the heap is initialized,
ending up calling malloc from the OpenHashMap constructor.

Oddly it was still working on x86 but broke other platforms.

Instead we add a Lookup() static method to Partition,
which by default walks gPartitions for the id,
and recursively calls itself on the children lists.

This means we must add a partition even temporarily to gPartitions
before Scan()ing it though.

Signed-off-by: François Revol <[email protected]>
This commit is contained in:
François Revol
2016-09-02 19:02:33 +12:00
committed by Jessica Hamilton
parent 735f1daee9
commit 495efc382b
2 changed files with 34 additions and 10 deletions
+2
View File
@@ -30,6 +30,8 @@ class Partition : public Node, public partition_data {
status_t Mount(Directory **_fileSystem = NULL, bool isBootDevice = false);
status_t Scan(bool mountFileSystems, bool isBootDevice = false);
static Partition *Lookup(partition_id id, NodeList *list = NULL);
void SetParent(Partition *parent);
Partition *Parent() const;