xref: /haiku/src/apps/bootmanager/BootDrive.h (revision b76ca311d17d58bd6c3ac6948d839076558adc88)
1*b76ca311SAxel Dörfler /*
2*b76ca311SAxel Dörfler  * Copyright 2008-2010, Haiku, Inc. All rights reserved.
3*b76ca311SAxel Dörfler  * Distributed under the terms of the MIT License.
4*b76ca311SAxel Dörfler  *
5*b76ca311SAxel Dörfler  * Authors:
6*b76ca311SAxel Dörfler  *		Michael Pfeiffer <laplace@users.sourceforge.net>
7*b76ca311SAxel Dörfler  */
8*b76ca311SAxel Dörfler #ifndef BOOT_DRIVE_H
9*b76ca311SAxel Dörfler #define BOOT_DRIVE_H
10*b76ca311SAxel Dörfler 
11*b76ca311SAxel Dörfler 
12*b76ca311SAxel Dörfler #include <File.h>
13*b76ca311SAxel Dörfler #include <Message.h>
14*b76ca311SAxel Dörfler 
15*b76ca311SAxel Dörfler 
16*b76ca311SAxel Dörfler /*	Setting BMessage Format:
17*b76ca311SAxel Dörfler 
18*b76ca311SAxel Dörfler 	"disk" String (path to boot disk)
19*b76ca311SAxel Dörfler 
20*b76ca311SAxel Dörfler 	"partition" array of BMessage:
21*b76ca311SAxel Dörfler 		"show" bool (flag if entry should be added to boot menu)
22*b76ca311SAxel Dörfler 		"name" String (the name as shown in boot menu)
23*b76ca311SAxel Dörfler 		"type" String (short name of file system: bfs, dos)
24*b76ca311SAxel Dörfler 		"path" String (path to partition in /dev/...)
25*b76ca311SAxel Dörfler 		"size" long (size of partition in bytes)
26*b76ca311SAxel Dörfler */
27*b76ca311SAxel Dörfler 
28*b76ca311SAxel Dörfler 
29*b76ca311SAxel Dörfler enum {
30*b76ca311SAxel Dörfler 	// Not enough space free before first partition for boot loader
31*b76ca311SAxel Dörfler 	kErrorBootSectorTooSmall = B_ERRORS_END + 1,
32*b76ca311SAxel Dörfler };
33*b76ca311SAxel Dörfler 
34*b76ca311SAxel Dörfler 
35*b76ca311SAxel Dörfler class BootDrive {
36*b76ca311SAxel Dörfler public:
37*b76ca311SAxel Dörfler 								BootDrive() {}
38*b76ca311SAxel Dörfler 	virtual						~BootDrive() {}
39*b76ca311SAxel Dörfler 
40*b76ca311SAxel Dörfler 	virtual	bool				IsBootMenuInstalled(BMessage* settings) = 0;
41*b76ca311SAxel Dörfler 	virtual	status_t			ReadPartitions(BMessage* settings) = 0;
42*b76ca311SAxel Dörfler 	virtual	status_t			WriteBootMenu(BMessage* settings) = 0;
43*b76ca311SAxel Dörfler 	virtual	status_t			SaveMasterBootRecord(BMessage* settings,
44*b76ca311SAxel Dörfler 									BFile* file) = 0;
45*b76ca311SAxel Dörfler 	virtual	status_t			RestoreMasterBootRecord(BMessage* settings,
46*b76ca311SAxel Dörfler 									BFile* file) = 0;
47*b76ca311SAxel Dörfler 
48*b76ca311SAxel Dörfler 	// Converts the specified text into a text as it will be shown
49*b76ca311SAxel Dörfler 	// in the boot menu.
50*b76ca311SAxel Dörfler 	virtual	status_t			GetDisplayText(const char* text,
51*b76ca311SAxel Dörfler 									BString& displayText) = 0;
52*b76ca311SAxel Dörfler };
53*b76ca311SAxel Dörfler 
54*b76ca311SAxel Dörfler 
55*b76ca311SAxel Dörfler #endif	// BOOT_DRIVE_H
56