Introduce BootVolume abstraction class

BootVolume is initialized from a root directory of a volume. It finds
the system directory, and -- not implemented yet -- mounts the system
package, if the system is packaged, replacing the system directory with
it. Adjusted several functionality (main(), the loader functions,
user_menu()) to use BootVolume instead of the root directory.
This commit is contained in:
Ingo Weinhold
2011-07-17 16:54:13 +02:00
parent 624b7c8958
commit d11ea2b5ed
7 changed files with 182 additions and 48 deletions
+31 -1
View File
@@ -99,11 +99,41 @@ class MemoryDisk : public Node {
};
class BootVolume {
public:
BootVolume();
~BootVolume();
status_t SetTo(Directory* rootDirectory);
void Unset();
bool IsValid() const
{ return fRootDirectory != NULL; }
Directory* RootDirectory() const
{ return fRootDirectory; }
Directory* SystemDirectory() const
{ return fSystemDirectory; }
bool IsPackaged() const
{ return fPackaged; }
private:
Directory* fRootDirectory;
// root directory of the volume
Directory* fSystemDirectory;
// "system" directory of the volume; if packaged the root
// directory of the mounted packagefs
bool fPackaged;
// indicates whether the boot volume's system is packaged
};
/* function prototypes */
extern status_t vfs_init(stage2_args *args);
extern status_t register_boot_file_system(Directory *directory);
extern Directory *get_boot_file_system(stage2_args *args);
extern status_t get_boot_file_system(stage2_args* args,
BootVolume& _bootVolume);
extern status_t mount_file_systems(stage2_args *args);
extern int open_node(Node *node, int mode);
extern int open_from(Directory *directory, const char *path, int mode,