1 /* 2 * Copyright 2003-2006, Axel Dörfler, axeld@pinc-software.de. All rights reserved. 3 * Distributed under the terms of the MIT License. 4 */ 5 #ifndef ROOT_FILE_SYSTEM_H 6 #define ROOT_FILE_SYSTEM_H 7 8 9 #include <boot/vfs.h> 10 #include <boot/partitions.h> 11 12 using namespace boot; 13 14 15 class RootFileSystem : public Directory { 16 public: 17 RootFileSystem(); 18 virtual ~RootFileSystem(); 19 20 virtual status_t Open(void **_cookie, int mode); 21 virtual status_t Close(void *cookie); 22 23 virtual Node* LookupDontTraverse(const char* name); 24 25 virtual status_t GetNextEntry(void *cookie, char *nameBuffer, size_t bufferSize); 26 virtual status_t GetNextNode(void *cookie, Node **_node); 27 virtual status_t Rewind(void *cookie); 28 virtual bool IsEmpty(); 29 30 status_t AddVolume(Directory *volume, Partition *partition); 31 status_t AddLink(const char *name, Directory *target); 32 33 status_t GetPartitionFor(Directory *volume, Partition **_partition); 34 35 private: 36 struct entry : public DoublyLinkedListLinkImpl<entry> { 37 const char *name; 38 Directory *root; 39 Partition *partition; 40 }; 41 typedef DoublyLinkedList<entry>::Iterator EntryIterator; 42 typedef DoublyLinkedList<entry> EntryList; 43 44 EntryList fList; 45 EntryList fLinks; 46 }; 47 48 extern RootFileSystem *gRoot; 49 50 #endif /* ROOT_FILE_SYSTEM_H */ 51