16d43a73bSAxel Dörfler/*
2c918a987SAxel Dörfler * Copyright 2003-2006, Axel D��rfler, axeld@pinc-software.de. All rights reserved.
3c918a987SAxel Dörfler * Distributed under the terms of the MIT License.
4c918a987SAxel Dörfler */
56d43a73bSAxel Dörfler#ifndef ROOT_FILE_SYSTEM_H
66d43a73bSAxel Dörfler#define ROOT_FILE_SYSTEM_H
76d43a73bSAxel Dörfler
86d43a73bSAxel Dörfler
96d43a73bSAxel Dörfler#include <boot/vfs.h>
104807cd86SAxel Dörfler#include <boot/partitions.h>
114807cd86SAxel Dörfler
124807cd86SAxel Dörflerusing namespace boot;
136d43a73bSAxel Dörfler
146d43a73bSAxel Dörfler
156d43a73bSAxel Dörflerclass RootFileSystem : public Directory {
166d43a73bSAxel Dörfler	public:
176d43a73bSAxel Dörfler		RootFileSystem();
186d43a73bSAxel Dörfler		virtual ~RootFileSystem();
196d43a73bSAxel Dörfler
206d43a73bSAxel Dörfler		virtual status_t Open(void **_cookie, int mode);
216d43a73bSAxel Dörfler		virtual status_t Close(void *cookie);
226d43a73bSAxel Dörfler
23cbc85916SIngo Weinhold		virtual Node* LookupDontTraverse(const char* name);
246d43a73bSAxel Dörfler
251a5a7098SAxel Dörfler		virtual status_t GetNextEntry(void *cookie, char *nameBuffer, size_t bufferSize);
266d43a73bSAxel Dörfler		virtual status_t GetNextNode(void *cookie, Node **_node);
276d43a73bSAxel Dörfler		virtual status_t Rewind(void *cookie);
281f0aeec0SAxel Dörfler		virtual bool IsEmpty();
296d43a73bSAxel Dörfler
304807cd86SAxel Dörfler		status_t AddVolume(Directory *volume, Partition *partition);
311aa6a4caSAxel Dörfler		status_t AddLink(const char *name, Directory *target);
326d43a73bSAxel Dörfler
334807cd86SAxel Dörfler		status_t GetPartitionFor(Directory *volume, Partition **_partition);
344807cd86SAxel Dörfler
356d43a73bSAxel Dörfler	private:
36c918a987SAxel Dörfler		struct entry : public DoublyLinkedListLinkImpl<entry> {
371aa6a4caSAxel Dörfler			const char	*name;
382d6751a0SAxel Dörfler			Directory	*root;
394807cd86SAxel Dörfler			Partition	*partition;
402d6751a0SAxel Dörfler		};
41c918a987SAxel Dörfler		typedef DoublyLinkedList<entry>::Iterator EntryIterator;
42c918a987SAxel Dörfler		typedef DoublyLinkedList<entry> EntryList;
432d6751a0SAxel Dörfler
442d6751a0SAxel Dörfler		EntryList fList;
451aa6a4caSAxel Dörfler		EntryList fLinks;
466d43a73bSAxel Dörfler};
476d43a73bSAxel Dörfler
481aa6a4caSAxel Dörflerextern RootFileSystem *gRoot;
496d43a73bSAxel Dörfler
506d43a73bSAxel Dörfler#endif	/* ROOT_FILE_SYSTEM_H */
51