2003-09-03 05:53:41 +04:00
|
|
|
/*
|
2005-02-11 06:11:19 +03:00
|
|
|
* Copyright 2003-2005, Axel Dörfler, axeld@pinc-software.de.
|
2004-11-15 20:56:55 +03:00
|
|
|
* Distributed under the terms of the MIT License.
|
|
|
|
*/
|
2003-09-03 05:53:41 +04:00
|
|
|
#ifndef KERNEL_BOOT_PARTITIONS_H
|
|
|
|
#define KERNEL_BOOT_PARTITIONS_H
|
|
|
|
|
|
|
|
|
|
|
|
#include <boot/vfs.h>
|
|
|
|
#include <disk_device_manager.h>
|
|
|
|
|
|
|
|
|
2005-10-14 15:34:18 +04:00
|
|
|
struct file_system_module_info;
|
|
|
|
|
2003-09-14 20:38:10 +04:00
|
|
|
namespace boot {
|
|
|
|
|
2003-10-14 04:26:04 +04:00
|
|
|
class Partition : public Node, public partition_data {
|
2003-09-14 20:38:10 +04:00
|
|
|
public:
|
|
|
|
Partition(int deviceFD);
|
|
|
|
virtual ~Partition();
|
|
|
|
|
|
|
|
virtual ssize_t ReadAt(void *cookie, off_t offset, void *buffer, size_t bufferSize);
|
|
|
|
virtual ssize_t WriteAt(void *cookie, off_t offset, const void *buffer, size_t bufferSize);
|
|
|
|
|
|
|
|
virtual off_t Size() const;
|
|
|
|
virtual int32 Type() const;
|
|
|
|
|
|
|
|
Partition *AddChild();
|
2003-10-01 05:00:53 +04:00
|
|
|
|
2005-10-14 15:34:18 +04:00
|
|
|
status_t Mount(Directory **_fileSystem = NULL, bool isBootDevice = false);
|
|
|
|
status_t Scan(bool mountFileSystems, bool isBootDevice = false);
|
2003-09-14 20:38:10 +04:00
|
|
|
|
2004-11-03 05:10:10 +03:00
|
|
|
void SetParent(Partition *parent) { fParent = parent; }
|
2003-09-14 20:38:10 +04:00
|
|
|
Partition *Parent() const { return fParent; }
|
2004-11-03 05:10:10 +03:00
|
|
|
|
2003-09-14 20:38:10 +04:00
|
|
|
bool IsFileSystem() const { return fIsFileSystem; }
|
2004-11-03 05:10:10 +03:00
|
|
|
bool IsPartitioningSystem() const { return fIsPartitioningSystem; }
|
2004-06-15 20:51:33 +04:00
|
|
|
const char *ModuleName() const { return fModuleName; }
|
2003-09-14 20:38:10 +04:00
|
|
|
|
2004-11-15 20:56:55 +03:00
|
|
|
int FD() const { return fFD; }
|
|
|
|
|
2003-09-14 20:38:10 +04:00
|
|
|
private:
|
2005-10-14 15:34:18 +04:00
|
|
|
status_t _Mount(file_system_module_info *module, Directory **_fileSystem);
|
|
|
|
|
2003-09-14 20:38:10 +04:00
|
|
|
int fFD;
|
2003-10-14 04:26:04 +04:00
|
|
|
NodeList fChildren;
|
2003-09-14 20:38:10 +04:00
|
|
|
Partition *fParent;
|
2004-11-03 05:10:10 +03:00
|
|
|
bool fIsFileSystem, fIsPartitioningSystem;
|
2004-06-15 20:51:33 +04:00
|
|
|
const char *fModuleName;
|
2003-09-14 20:38:10 +04:00
|
|
|
};
|
|
|
|
|
|
|
|
} // namespace boot
|
|
|
|
|
2003-09-03 05:53:41 +04:00
|
|
|
// DiskDeviceTypes we need/support in the boot loader
|
2003-09-09 06:12:06 +04:00
|
|
|
#define kPartitionTypeAmiga "Amiga RDB"
|
2005-03-31 15:22:02 +04:00
|
|
|
#define kPartitionTypeIntel "Intel Partition Map"
|
|
|
|
#define kPartitionTypeIntelExtended "Intel Extended Partition"
|
|
|
|
// Note: The naming of these two at least must be consistent with
|
|
|
|
// DiskDeviceTypes.cpp.
|
2003-09-09 06:12:06 +04:00
|
|
|
#define kPartitionTypeApple "Apple"
|
2003-09-03 05:53:41 +04:00
|
|
|
|
2003-09-09 06:12:06 +04:00
|
|
|
#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"
|
2005-02-11 06:11:19 +03:00
|
|
|
#define kPartitionTypeHFS "HFS Filesystem"
|
|
|
|
#define kPartitionTypeHFSPlus "HFS+ Filesystem"
|
2003-09-09 06:12:06 +04:00
|
|
|
#define kPartitionTypeISO9660 "ISO9660 Filesystem"
|
|
|
|
#define kPartitionTypeReiser "Reiser Filesystem"
|
2005-10-11 05:17:48 +04:00
|
|
|
#define kPartitionTypeTarFS "TAR Filesystem"
|
2003-09-09 06:12:06 +04:00
|
|
|
#define kPartitionTypeUDF "UDF Filesystem"
|
2003-09-08 06:39:24 +04:00
|
|
|
|
2003-09-09 06:12:06 +04:00
|
|
|
// structure definitions as used in the boot loader
|
2003-09-03 05:53:41 +04:00
|
|
|
struct partition_module_info;
|
|
|
|
extern partition_module_info gAmigaPartitionModule;
|
2003-09-08 06:39:24 +04:00
|
|
|
extern partition_module_info gIntelPartitionMapModule;
|
|
|
|
extern partition_module_info gIntelExtendedPartitionModule;
|
2003-09-03 05:53:41 +04:00
|
|
|
extern partition_module_info gApplePartitionModule;
|
|
|
|
|
2003-09-09 06:12:06 +04:00
|
|
|
// 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 {
|
2004-06-15 20:51:33 +04:00
|
|
|
const char *module_name;
|
2003-09-09 06:12:06 +04:00
|
|
|
const char *pretty_name;
|
2003-09-14 20:38:10 +04:00
|
|
|
status_t (*get_file_system)(boot::Partition *device, Directory **_root);
|
2003-09-09 06:12:06 +04:00
|
|
|
};
|
|
|
|
|
|
|
|
extern file_system_module_info gBFSFileSystemModule;
|
2003-09-16 06:28:21 +04:00
|
|
|
extern file_system_module_info gAmigaFFSFileSystemModule;
|
2005-10-11 05:17:48 +04:00
|
|
|
extern file_system_module_info gTarFileSystemModule;
|
2003-09-09 06:12:06 +04:00
|
|
|
|
2003-09-03 05:53:41 +04:00
|
|
|
#endif /* KERNEL_BOOT_PARTITIONS_H */
|