Added initial support for file systems. Not tested yet, but compiles.
New Directory class for use in file systems; file systems need to publish their root directory as a subclass of this class. git-svn-id: file:///srv/svn/repos/haiku/trunk/current@4587 a95241bf-73f2-0310-859d-f6bbb57e9c96
This commit is contained in:
parent
275186b598
commit
fd5b59d227
@ -11,17 +11,38 @@
|
||||
|
||||
|
||||
// DiskDeviceTypes we need/support in the boot loader
|
||||
#define kPartitionTypeAmiga "Amiga RDB"
|
||||
#define kPartitionTypeIntel "Intel"
|
||||
#define kPartitionTypeAmiga "Amiga RDB"
|
||||
#define kPartitionTypeIntel "Intel"
|
||||
#define kPartitionTypeIntelExtended "Intel Extended"
|
||||
#define kPartitionTypeApple "Apple"
|
||||
#define kPartitionTypeApple "Apple"
|
||||
|
||||
#define kPartitionTypeBFS "BFS"
|
||||
#define kPartitionTypeBFS "BFS Filesystem"
|
||||
#define kPartitionTypeAmigaFFS "AmigaFFS Filesystem"
|
||||
#define kPartitionTypeBFS "BFS Filesystem"
|
||||
#define kPartitionTypeEXT2 "EXT2 Filesystem"
|
||||
#define kPartitionTypeEXT3 "EXT3 Filesystem"
|
||||
#define kPartitionTypeFAT12 "FAT12 Filesystem"
|
||||
#define kPartitionTypeFAT32 "FAT32 Filesystem"
|
||||
#define kPartitionTypeISO9660 "ISO9660 Filesystem"
|
||||
#define kPartitionTypeReiser "Reiser Filesystem"
|
||||
#define kPartitionTypeUDF "UDF Filesystem"
|
||||
|
||||
// structure definitions as used in the boot loader
|
||||
struct partition_module_info;
|
||||
extern partition_module_info gAmigaPartitionModule;
|
||||
extern partition_module_info gIntelPartitionMapModule;
|
||||
extern partition_module_info gIntelExtendedPartitionModule;
|
||||
extern partition_module_info gApplePartitionModule;
|
||||
|
||||
// the file system module info is not a standard module info;
|
||||
// their modules are specifically written for the boot loader,
|
||||
// and hence, don't need to follow the standard module specs.
|
||||
|
||||
struct file_system_module_info {
|
||||
const char *pretty_name;
|
||||
status_t (*get_file_system)(Node *device, Directory **_root);
|
||||
};
|
||||
|
||||
extern file_system_module_info gBFSFileSystemModule;
|
||||
|
||||
#endif /* KERNEL_BOOT_PARTITIONS_H */
|
||||
|
@ -8,7 +8,7 @@
|
||||
|
||||
#include <SupportDefs.h>
|
||||
|
||||
#include <list.h>
|
||||
#include <util/list.h>
|
||||
#include <boot/stage2_args.h>
|
||||
|
||||
|
||||
@ -27,12 +27,36 @@ class Node {
|
||||
virtual ssize_t ReadAt(void *cookie, off_t pos, void *buffer, size_t bufferSize) = 0;
|
||||
virtual ssize_t WriteAt(void *cookie, off_t pos, const void *buffer, size_t bufferSize) = 0;
|
||||
|
||||
virtual status_t GetName(char *nameBuffer, size_t bufferSize) const;
|
||||
virtual int32 Type() const;
|
||||
virtual off_t Size() const;
|
||||
|
||||
status_t Acquire();
|
||||
status_t Release();
|
||||
|
||||
protected:
|
||||
list_link fLink;
|
||||
int32 fRefCount;
|
||||
};
|
||||
|
||||
|
||||
class Directory : public Node {
|
||||
public:
|
||||
Directory();
|
||||
|
||||
virtual ssize_t ReadAt(void *cookie, off_t pos, void *buffer, size_t bufferSize);
|
||||
virtual ssize_t WriteAt(void *cookie, off_t pos, const void *buffer, size_t bufferSize);
|
||||
|
||||
virtual int32 Type() const;
|
||||
|
||||
virtual Node *Lookup(const char *name, bool traverseLinks) = 0;
|
||||
|
||||
virtual status_t GetNextNode(void *cookie, Node **_node) = 0;
|
||||
virtual status_t Rewind(void *cookie) = 0;
|
||||
|
||||
virtual status_t AddNode(Node *node);
|
||||
};
|
||||
|
||||
/** The console based nodes don't need cookies for I/O, they
|
||||
* also don't support to change the stream position.
|
||||
* Live is simple in the boot loader :-)
|
||||
@ -46,6 +70,7 @@ class ConsoleNode : public Node {
|
||||
virtual ssize_t Write(const void *buffer, size_t bufferSize);
|
||||
};
|
||||
|
||||
extern Directory *gRoot;
|
||||
|
||||
extern "C" {
|
||||
#endif /* __cplusplus */
|
||||
@ -53,6 +78,7 @@ extern "C" {
|
||||
extern status_t vfs_init(stage2_args *args);
|
||||
extern status_t mount_boot_file_systems();
|
||||
extern status_t add_partitions_for(int fd);
|
||||
extern int open_node(Node *node, int mode);
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user