xref: /haiku/src/system/boot/loader/RootFileSystem.h (revision 4f00613311d0bd6b70fa82ce19931c41f071ea4e)
1 /*
2 ** Copyright 2003-2004, Axel Dörfler, axeld@pinc-software.de. All rights reserved.
3 ** Distributed under the terms of the OpenBeOS 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 *Lookup(const char *name, bool traverseLinks);
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 {
37 			DoublyLinked::Link	link;
38 			const char	*name;
39 			Directory	*root;
40 			Partition	*partition;
41 		};
42 		typedef DoublyLinked::Iterator<entry, &entry::link> EntryIterator;
43 		typedef DoublyLinked::List<entry, &entry::link> EntryList;
44 
45 		EntryList fList;
46 		EntryList fLinks;
47 };
48 
49 extern RootFileSystem *gRoot;
50 
51 #endif	/* ROOT_FILE_SYSTEM_H */
52