16f7c2dc6SAxel Dörfler /* 2ab78c7cbSAxel Dörfler * Copyright 2003-2005, Axel Dörfler, axeld@pinc-software.de. 30c3888b9SAxel Dörfler * Distributed under the terms of the MIT License. 46f7c2dc6SAxel Dörfler */ 56f7c2dc6SAxel Dörfler #ifndef KERNEL_BOOT_PARTITIONS_H 66f7c2dc6SAxel Dörfler #define KERNEL_BOOT_PARTITIONS_H 76f7c2dc6SAxel Dörfler 86f7c2dc6SAxel Dörfler 96f7c2dc6SAxel Dörfler #include <boot/vfs.h> 106f7c2dc6SAxel Dörfler #include <disk_device_manager.h> 116f7c2dc6SAxel Dörfler 126f7c2dc6SAxel Dörfler 13da42afdfSAxel Dörfler namespace boot { 14da42afdfSAxel Dörfler 15c3e36ff4SAxel Dörfler class Partition : public Node, public partition_data { 16da42afdfSAxel Dörfler public: 17da42afdfSAxel Dörfler Partition(int deviceFD); 18da42afdfSAxel Dörfler virtual ~Partition(); 19da42afdfSAxel Dörfler 20da42afdfSAxel Dörfler virtual ssize_t ReadAt(void *cookie, off_t offset, void *buffer, size_t bufferSize); 21da42afdfSAxel Dörfler virtual ssize_t WriteAt(void *cookie, off_t offset, const void *buffer, size_t bufferSize); 22da42afdfSAxel Dörfler 23da42afdfSAxel Dörfler virtual off_t Size() const; 24da42afdfSAxel Dörfler virtual int32 Type() const; 25da42afdfSAxel Dörfler 26da42afdfSAxel Dörfler Partition *AddChild(); 27b337ddf6SAxel Dörfler 28b337ddf6SAxel Dörfler status_t Mount(Directory **_fileSystem = NULL); 29b337ddf6SAxel Dörfler status_t Scan(bool mountFileSystems); 30da42afdfSAxel Dörfler 31ec5d7064SAxel Dörfler void SetParent(Partition *parent) { fParent = parent; } 32da42afdfSAxel Dörfler Partition *Parent() const { return fParent; } 33ec5d7064SAxel Dörfler 34da42afdfSAxel Dörfler bool IsFileSystem() const { return fIsFileSystem; } 35ec5d7064SAxel Dörfler bool IsPartitioningSystem() const { return fIsPartitioningSystem; } 367765cbf6SAxel Dörfler const char *ModuleName() const { return fModuleName; } 37da42afdfSAxel Dörfler 380c3888b9SAxel Dörfler int FD() const { return fFD; } 390c3888b9SAxel Dörfler 40da42afdfSAxel Dörfler private: 41da42afdfSAxel Dörfler int fFD; 42c3e36ff4SAxel Dörfler NodeList fChildren; 43da42afdfSAxel Dörfler Partition *fParent; 44ec5d7064SAxel Dörfler bool fIsFileSystem, fIsPartitioningSystem; 457765cbf6SAxel Dörfler const char *fModuleName; 46da42afdfSAxel Dörfler }; 47da42afdfSAxel Dörfler 48da42afdfSAxel Dörfler } // namespace boot 49da42afdfSAxel Dörfler 506f7c2dc6SAxel Dörfler // DiskDeviceTypes we need/support in the boot loader 516f7c2dc6SAxel Dörfler #define kPartitionTypeAmiga "Amiga RDB" 52*d832aa7eSIngo Weinhold #define kPartitionTypeIntel "Intel Partition Map" 53*d832aa7eSIngo Weinhold #define kPartitionTypeIntelExtended "Intel Extended Partition" 54*d832aa7eSIngo Weinhold // Note: The naming of these two at least must be consistent with 55*d832aa7eSIngo Weinhold // DiskDeviceTypes.cpp. 566f7c2dc6SAxel Dörfler #define kPartitionTypeApple "Apple" 576f7c2dc6SAxel Dörfler 58fd5b59d2SAxel Dörfler #define kPartitionTypeBFS "BFS Filesystem" 59fd5b59d2SAxel Dörfler #define kPartitionTypeAmigaFFS "AmigaFFS Filesystem" 60fd5b59d2SAxel Dörfler #define kPartitionTypeBFS "BFS Filesystem" 61fd5b59d2SAxel Dörfler #define kPartitionTypeEXT2 "EXT2 Filesystem" 62fd5b59d2SAxel Dörfler #define kPartitionTypeEXT3 "EXT3 Filesystem" 63fd5b59d2SAxel Dörfler #define kPartitionTypeFAT12 "FAT12 Filesystem" 64fd5b59d2SAxel Dörfler #define kPartitionTypeFAT32 "FAT32 Filesystem" 65ab78c7cbSAxel Dörfler #define kPartitionTypeHFS "HFS Filesystem" 66ab78c7cbSAxel Dörfler #define kPartitionTypeHFSPlus "HFS+ Filesystem" 67fd5b59d2SAxel Dörfler #define kPartitionTypeISO9660 "ISO9660 Filesystem" 68fd5b59d2SAxel Dörfler #define kPartitionTypeReiser "Reiser Filesystem" 69fd5b59d2SAxel Dörfler #define kPartitionTypeUDF "UDF Filesystem" 70e5d542baSAxel Dörfler 71fd5b59d2SAxel Dörfler // structure definitions as used in the boot loader 726f7c2dc6SAxel Dörfler struct partition_module_info; 736f7c2dc6SAxel Dörfler extern partition_module_info gAmigaPartitionModule; 74e5d542baSAxel Dörfler extern partition_module_info gIntelPartitionMapModule; 75e5d542baSAxel Dörfler extern partition_module_info gIntelExtendedPartitionModule; 766f7c2dc6SAxel Dörfler extern partition_module_info gApplePartitionModule; 776f7c2dc6SAxel Dörfler 78fd5b59d2SAxel Dörfler // the file system module info is not a standard module info; 79fd5b59d2SAxel Dörfler // their modules are specifically written for the boot loader, 80fd5b59d2SAxel Dörfler // and hence, don't need to follow the standard module specs. 81fd5b59d2SAxel Dörfler 82fd5b59d2SAxel Dörfler struct file_system_module_info { 837765cbf6SAxel Dörfler const char *module_name; 84fd5b59d2SAxel Dörfler const char *pretty_name; 85da42afdfSAxel Dörfler status_t (*get_file_system)(boot::Partition *device, Directory **_root); 86fd5b59d2SAxel Dörfler }; 87fd5b59d2SAxel Dörfler 88fd5b59d2SAxel Dörfler extern file_system_module_info gBFSFileSystemModule; 8969a8a407SAxel Dörfler extern file_system_module_info gAmigaFFSFileSystemModule; 90fd5b59d2SAxel Dörfler 916f7c2dc6SAxel Dörfler #endif /* KERNEL_BOOT_PARTITIONS_H */ 92