Now stores a link to the partition of a volume, and adds a new method
GetPartitionFor() to retrieve that information again. git-svn-id: file:///srv/svn/repos/haiku/trunk/current@7990 a95241bf-73f2-0310-859d-f6bbb57e9c96
This commit is contained in:
@@ -129,7 +129,7 @@ RootFileSystem::IsEmpty()
|
|||||||
|
|
||||||
|
|
||||||
status_t
|
status_t
|
||||||
RootFileSystem::AddVolume(Directory *volume)
|
RootFileSystem::AddVolume(Directory *volume, Partition *partition)
|
||||||
{
|
{
|
||||||
struct entry *entry = new RootFileSystem::entry();
|
struct entry *entry = new RootFileSystem::entry();
|
||||||
if (entry == NULL)
|
if (entry == NULL)
|
||||||
@@ -138,6 +138,7 @@ RootFileSystem::AddVolume(Directory *volume)
|
|||||||
volume->Acquire();
|
volume->Acquire();
|
||||||
entry->name = NULL;
|
entry->name = NULL;
|
||||||
entry->root = volume;
|
entry->root = volume;
|
||||||
|
entry->partition = partition;
|
||||||
|
|
||||||
fList.Add(entry);
|
fList.Add(entry);
|
||||||
|
|
||||||
@@ -161,3 +162,20 @@ RootFileSystem::AddLink(const char *name, Directory *target)
|
|||||||
return B_OK;
|
return B_OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
status_t
|
||||||
|
RootFileSystem::GetPartitionFor(Directory *volume, Partition **_partition)
|
||||||
|
{
|
||||||
|
EntryIterator iterator = fList.Iterator();
|
||||||
|
struct entry *entry;
|
||||||
|
|
||||||
|
while ((entry = iterator.Next()) != NULL) {
|
||||||
|
if (entry->root == volume) {
|
||||||
|
*_partition = entry->partition;
|
||||||
|
return B_OK;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return B_ENTRY_NOT_FOUND;
|
||||||
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
/*
|
/*
|
||||||
** Copyright 2003, Axel Dörfler, [email protected]. All rights reserved.
|
** Copyright 2003-2004, Axel Dörfler, [email protected]. All rights reserved.
|
||||||
** Distributed under the terms of the OpenBeOS License.
|
** Distributed under the terms of the OpenBeOS License.
|
||||||
*/
|
*/
|
||||||
#ifndef ROOT_FILE_SYSTEM_H
|
#ifndef ROOT_FILE_SYSTEM_H
|
||||||
@@ -7,6 +7,9 @@
|
|||||||
|
|
||||||
|
|
||||||
#include <boot/vfs.h>
|
#include <boot/vfs.h>
|
||||||
|
#include <boot/partitions.h>
|
||||||
|
|
||||||
|
using namespace boot;
|
||||||
|
|
||||||
|
|
||||||
class RootFileSystem : public Directory {
|
class RootFileSystem : public Directory {
|
||||||
@@ -24,14 +27,17 @@ class RootFileSystem : public Directory {
|
|||||||
virtual status_t Rewind(void *cookie);
|
virtual status_t Rewind(void *cookie);
|
||||||
virtual bool IsEmpty();
|
virtual bool IsEmpty();
|
||||||
|
|
||||||
status_t AddVolume(Directory *volume);
|
status_t AddVolume(Directory *volume, Partition *partition);
|
||||||
status_t AddLink(const char *name, Directory *target);
|
status_t AddLink(const char *name, Directory *target);
|
||||||
|
|
||||||
|
status_t GetPartitionFor(Directory *volume, Partition **_partition);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
struct entry {
|
struct entry {
|
||||||
DoublyLinked::Link link;
|
DoublyLinked::Link link;
|
||||||
const char *name;
|
const char *name;
|
||||||
Directory *root;
|
Directory *root;
|
||||||
|
Partition *partition;
|
||||||
};
|
};
|
||||||
typedef DoublyLinked::Iterator<entry, &entry::link> EntryIterator;
|
typedef DoublyLinked::Iterator<entry, &entry::link> EntryIterator;
|
||||||
typedef DoublyLinked::List<entry, &entry::link> EntryList;
|
typedef DoublyLinked::List<entry, &entry::link> EntryList;
|
||||||
|
|||||||
Reference in New Issue
Block a user