xref: /haiku/headers/private/kernel/boot/partitions.h (revision ec5d7064928d6e309f6c3465c30006c21ccda7e5)
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 
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 
31*ec5d7064SAxel Dörfler 		void SetParent(Partition *parent) { fParent = parent; }
32da42afdfSAxel Dörfler 		Partition *Parent() const { return fParent; }
33*ec5d7064SAxel Dörfler 
34da42afdfSAxel Dörfler 		bool IsFileSystem() const { return fIsFileSystem; }
35*ec5d7064SAxel Dörfler 		bool IsPartitioningSystem() const { return fIsPartitioningSystem; }
367765cbf6SAxel Dörfler 		const char *ModuleName() const { return fModuleName; }
37da42afdfSAxel Dörfler 
38da42afdfSAxel Dörfler 	private:
39da42afdfSAxel Dörfler 		int			fFD;
40c3e36ff4SAxel Dörfler 		NodeList	fChildren;
41da42afdfSAxel Dörfler 		Partition	*fParent;
42*ec5d7064SAxel Dörfler 		bool		fIsFileSystem, fIsPartitioningSystem;
437765cbf6SAxel Dörfler 		const char	*fModuleName;
44da42afdfSAxel Dörfler };
45da42afdfSAxel Dörfler 
46da42afdfSAxel Dörfler }	// namespace boot
47da42afdfSAxel Dörfler 
486f7c2dc6SAxel Dörfler // DiskDeviceTypes we need/support in the boot loader
496f7c2dc6SAxel Dörfler #define kPartitionTypeAmiga		"Amiga RDB"
506f7c2dc6SAxel Dörfler #define kPartitionTypeIntel		"Intel"
51e5d542baSAxel Dörfler #define kPartitionTypeIntelExtended "Intel Extended"
526f7c2dc6SAxel Dörfler #define kPartitionTypeApple		"Apple"
536f7c2dc6SAxel Dörfler 
54fd5b59d2SAxel Dörfler #define kPartitionTypeBFS		"BFS Filesystem"
55fd5b59d2SAxel Dörfler #define kPartitionTypeAmigaFFS	"AmigaFFS Filesystem"
56fd5b59d2SAxel Dörfler #define kPartitionTypeBFS		"BFS Filesystem"
57fd5b59d2SAxel Dörfler #define kPartitionTypeEXT2		"EXT2 Filesystem"
58fd5b59d2SAxel Dörfler #define kPartitionTypeEXT3		"EXT3 Filesystem"
59fd5b59d2SAxel Dörfler #define kPartitionTypeFAT12		"FAT12 Filesystem"
60fd5b59d2SAxel Dörfler #define kPartitionTypeFAT32		"FAT32 Filesystem"
61fd5b59d2SAxel Dörfler #define kPartitionTypeISO9660	"ISO9660 Filesystem"
62fd5b59d2SAxel Dörfler #define kPartitionTypeReiser	"Reiser Filesystem"
63fd5b59d2SAxel Dörfler #define kPartitionTypeUDF		"UDF Filesystem"
64e5d542baSAxel Dörfler 
65fd5b59d2SAxel Dörfler // structure definitions as used in the boot loader
666f7c2dc6SAxel Dörfler struct partition_module_info;
676f7c2dc6SAxel Dörfler extern partition_module_info gAmigaPartitionModule;
68e5d542baSAxel Dörfler extern partition_module_info gIntelPartitionMapModule;
69e5d542baSAxel Dörfler extern partition_module_info gIntelExtendedPartitionModule;
706f7c2dc6SAxel Dörfler extern partition_module_info gApplePartitionModule;
716f7c2dc6SAxel Dörfler 
72fd5b59d2SAxel Dörfler // the file system module info is not a standard module info;
73fd5b59d2SAxel Dörfler // their modules are specifically written for the boot loader,
74fd5b59d2SAxel Dörfler // and hence, don't need to follow the standard module specs.
75fd5b59d2SAxel Dörfler 
76fd5b59d2SAxel Dörfler struct file_system_module_info {
777765cbf6SAxel Dörfler 	const char	*module_name;
78fd5b59d2SAxel Dörfler 	const char	*pretty_name;
79da42afdfSAxel Dörfler 	status_t	(*get_file_system)(boot::Partition *device, Directory **_root);
80fd5b59d2SAxel Dörfler };
81fd5b59d2SAxel Dörfler 
82fd5b59d2SAxel Dörfler extern file_system_module_info gBFSFileSystemModule;
8369a8a407SAxel Dörfler extern file_system_module_info gAmigaFFSFileSystemModule;
84fd5b59d2SAxel Dörfler 
856f7c2dc6SAxel Dörfler #endif	/* KERNEL_BOOT_PARTITIONS_H */
86