Switched to new DoublyLinkedList class.

git-svn-id: file:///srv/svn/repos/haiku/trunk/current@11193 a95241bf-73f2-0310-859d-f6bbb57e9c96
This commit is contained in:
Ingo Weinhold 2005-02-02 02:35:16 +00:00
parent f42f300bd5
commit 164d84bb10
4 changed files with 11 additions and 12 deletions

View File

@ -16,7 +16,7 @@
/** This is the base class for all VFS nodes */ /** This is the base class for all VFS nodes */
class Node { class Node : public DoublyLinkedListLinkImpl<Node> {
public: public:
Node(); Node();
virtual ~Node(); virtual ~Node();
@ -35,14 +35,12 @@ class Node {
status_t Acquire(); status_t Acquire();
status_t Release(); status_t Release();
DoublyLinked::Link fLink;
protected: protected:
int32 fRefCount; int32 fRefCount;
}; };
typedef DoublyLinked::List<Node> NodeList; typedef DoublyLinkedList<Node> NodeList;
typedef DoublyLinked::Iterator<Node> NodeIterator; typedef NodeList::Iterator NodeIterator;
class Directory : public Node { class Directory : public Node {

View File

@ -227,7 +227,7 @@ Partition::Scan(bool mountFileSystems)
// now that we've found something, check our children // now that we've found something, check our children
// out as well! // out as well!
NodeIterator iterator = fChildren.Iterator(); NodeIterator iterator = fChildren.GetIterator();
Partition *child = NULL; Partition *child = NULL;
while ((child = (Partition *)iterator.Next()) != NULL) { while ((child = (Partition *)iterator.Next()) != NULL) {
@ -245,8 +245,10 @@ Partition::Scan(bool mountFileSystems)
// remove all unused children (we keep only file systems) // remove all unused children (we keep only file systems)
while ((child = (Partition *)fChildren.RemoveHead()) != NULL) while ((child = (Partition *)fChildren.Head()) != NULL) {
fChildren.Remove(child);
delete child; delete child;
}
// remember the module name that identified us // remember the module name that identified us
fModuleName = module->module.name; fModuleName = module->module.name;
@ -290,7 +292,7 @@ add_partitions_for(int fd, bool mountFileSystems)
// if not, we'll need to tell the children that their parent is gone // if not, we'll need to tell the children that their parent is gone
NodeIterator iterator = gPartitions.Iterator(); NodeIterator iterator = gPartitions.GetIterator();
Partition *child = NULL; Partition *child = NULL;
while ((child = (Partition *)iterator.Next()) != NULL) { while ((child = (Partition *)iterator.Next()) != NULL) {

View File

@ -68,7 +68,6 @@ Node::Node()
: :
fRefCount(1) fRefCount(1)
{ {
fLink.next = fLink.prev = NULL;
} }
@ -366,7 +365,7 @@ status_t
mount_file_systems(stage2_args *args) mount_file_systems(stage2_args *args)
{ {
// mount other partitions on boot device (if any) // mount other partitions on boot device (if any)
NodeIterator iterator = gPartitions.Iterator(); NodeIterator iterator = gPartitions.GetIterator();
Partition *partition = NULL; Partition *partition = NULL;
while ((partition = (Partition *)iterator.Next()) != NULL) { while ((partition = (Partition *)iterator.Next()) != NULL) {
@ -387,7 +386,7 @@ mount_file_systems(stage2_args *args)
if (status < B_OK) if (status < B_OK)
return status; return status;
iterator = gBootDevices.Iterator(); iterator = gBootDevices.GetIterator();
Node *device = NULL, *last = NULL; Node *device = NULL, *last = NULL;
while ((device = iterator.Next()) != NULL) { while ((device = iterator.Next()) != NULL) {
// don't scan former boot device again // don't scan former boot device again

View File

@ -442,7 +442,7 @@ platform_get_boot_partition(struct stage2_args *args, Node *bootDevice,
dprintf("boot partition offset: %Ld\n", offset); dprintf("boot partition offset: %Ld\n", offset);
NodeIterator iterator = list->Iterator(); NodeIterator iterator = list->GetIterator();
boot::Partition *partition = NULL; boot::Partition *partition = NULL;
while ((partition = (boot::Partition *)iterator.Next()) != NULL) { while ((partition = (boot::Partition *)iterator.Next()) != NULL) {
dprintf("partition offset = %Ld, size = %Ld\n", partition->offset, partition->size); dprintf("partition offset = %Ld, size = %Ld\n", partition->offset, partition->size);