16f7c2dc6SAxel Dörfler /* 26f7c2dc6SAxel Dörfler ** Copyright 2003, Axel Dörfler, axeld@pinc-software.de. All rights reserved. 36f7c2dc6SAxel Dörfler ** Distributed under the terms of the OpenBeOS 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 15*c3e36ff4SAxel 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 31da42afdfSAxel Dörfler Partition *Parent() const { return fParent; } 32da42afdfSAxel Dörfler bool IsFileSystem() const { return fIsFileSystem; } 33da42afdfSAxel Dörfler 34da42afdfSAxel Dörfler private: 35da42afdfSAxel Dörfler void SetParent(Partition *parent) { fParent = parent; } 36da42afdfSAxel Dörfler 37da42afdfSAxel Dörfler int fFD; 38*c3e36ff4SAxel Dörfler NodeList fChildren; 39da42afdfSAxel Dörfler Partition *fParent; 40da42afdfSAxel Dörfler bool fIsFileSystem; 41da42afdfSAxel Dörfler }; 42da42afdfSAxel Dörfler 43da42afdfSAxel Dörfler } // namespace boot 44da42afdfSAxel Dörfler 456f7c2dc6SAxel Dörfler // DiskDeviceTypes we need/support in the boot loader 466f7c2dc6SAxel Dörfler #define kPartitionTypeAmiga "Amiga RDB" 476f7c2dc6SAxel Dörfler #define kPartitionTypeIntel "Intel" 48e5d542baSAxel Dörfler #define kPartitionTypeIntelExtended "Intel Extended" 496f7c2dc6SAxel Dörfler #define kPartitionTypeApple "Apple" 506f7c2dc6SAxel Dörfler 51fd5b59d2SAxel Dörfler #define kPartitionTypeBFS "BFS Filesystem" 52fd5b59d2SAxel Dörfler #define kPartitionTypeAmigaFFS "AmigaFFS Filesystem" 53fd5b59d2SAxel Dörfler #define kPartitionTypeBFS "BFS Filesystem" 54fd5b59d2SAxel Dörfler #define kPartitionTypeEXT2 "EXT2 Filesystem" 55fd5b59d2SAxel Dörfler #define kPartitionTypeEXT3 "EXT3 Filesystem" 56fd5b59d2SAxel Dörfler #define kPartitionTypeFAT12 "FAT12 Filesystem" 57fd5b59d2SAxel Dörfler #define kPartitionTypeFAT32 "FAT32 Filesystem" 58fd5b59d2SAxel Dörfler #define kPartitionTypeISO9660 "ISO9660 Filesystem" 59fd5b59d2SAxel Dörfler #define kPartitionTypeReiser "Reiser Filesystem" 60fd5b59d2SAxel Dörfler #define kPartitionTypeUDF "UDF Filesystem" 61e5d542baSAxel Dörfler 62fd5b59d2SAxel Dörfler // structure definitions as used in the boot loader 636f7c2dc6SAxel Dörfler struct partition_module_info; 646f7c2dc6SAxel Dörfler extern partition_module_info gAmigaPartitionModule; 65e5d542baSAxel Dörfler extern partition_module_info gIntelPartitionMapModule; 66e5d542baSAxel Dörfler extern partition_module_info gIntelExtendedPartitionModule; 676f7c2dc6SAxel Dörfler extern partition_module_info gApplePartitionModule; 686f7c2dc6SAxel Dörfler 69fd5b59d2SAxel Dörfler // the file system module info is not a standard module info; 70fd5b59d2SAxel Dörfler // their modules are specifically written for the boot loader, 71fd5b59d2SAxel Dörfler // and hence, don't need to follow the standard module specs. 72fd5b59d2SAxel Dörfler 73fd5b59d2SAxel Dörfler struct file_system_module_info { 74fd5b59d2SAxel Dörfler const char *pretty_name; 75da42afdfSAxel Dörfler status_t (*get_file_system)(boot::Partition *device, Directory **_root); 76fd5b59d2SAxel Dörfler }; 77fd5b59d2SAxel Dörfler 78fd5b59d2SAxel Dörfler extern file_system_module_info gBFSFileSystemModule; 7969a8a407SAxel Dörfler extern file_system_module_info gAmigaFFSFileSystemModule; 80fd5b59d2SAxel Dörfler 816f7c2dc6SAxel Dörfler #endif /* KERNEL_BOOT_PARTITIONS_H */ 82