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 13*da42afdfSAxel Dörfler namespace boot { 14*da42afdfSAxel Dörfler 15*da42afdfSAxel Dörfler class Partition : public partition_data, public Node { 16*da42afdfSAxel Dörfler public: 17*da42afdfSAxel Dörfler Partition(int deviceFD); 18*da42afdfSAxel Dörfler virtual ~Partition(); 19*da42afdfSAxel Dörfler 20*da42afdfSAxel Dörfler virtual ssize_t ReadAt(void *cookie, off_t offset, void *buffer, size_t bufferSize); 21*da42afdfSAxel Dörfler virtual ssize_t WriteAt(void *cookie, off_t offset, const void *buffer, size_t bufferSize); 22*da42afdfSAxel Dörfler 23*da42afdfSAxel Dörfler virtual off_t Size() const; 24*da42afdfSAxel Dörfler virtual int32 Type() const; 25*da42afdfSAxel Dörfler 26*da42afdfSAxel Dörfler Partition *AddChild(); 27*da42afdfSAxel Dörfler status_t Scan(); 28*da42afdfSAxel Dörfler 29*da42afdfSAxel Dörfler Partition *Parent() const { return fParent; } 30*da42afdfSAxel Dörfler bool IsFileSystem() const { return fIsFileSystem; } 31*da42afdfSAxel Dörfler 32*da42afdfSAxel Dörfler static size_t LinkOffset() { return sizeof(partition_data); } 33*da42afdfSAxel Dörfler 34*da42afdfSAxel Dörfler private: 35*da42afdfSAxel Dörfler void SetParent(Partition *parent) { fParent = parent; } 36*da42afdfSAxel Dörfler 37*da42afdfSAxel Dörfler int fFD; 38*da42afdfSAxel Dörfler list fChildren; 39*da42afdfSAxel Dörfler Partition *fParent; 40*da42afdfSAxel Dörfler bool fIsFileSystem; 41*da42afdfSAxel Dörfler }; 42*da42afdfSAxel Dörfler 43*da42afdfSAxel Dörfler } // namespace boot 44*da42afdfSAxel 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; 75*da42afdfSAxel 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; 79fd5b59d2SAxel Dörfler 806f7c2dc6SAxel Dörfler #endif /* KERNEL_BOOT_PARTITIONS_H */ 81