1/*
2 * Copyright 2008-2011, Haiku, Inc. All rights reserved.
3 * Distributed under the terms of the MIT License.
4 *
5 * Authors:
6 *		Axel Dörfler, axeld@pinc-software.de
7 *		Michael Pfeiffer <laplace@users.sourceforge.net>
8 */
9#ifndef LEGACY_BOOT_MENU_H
10#define LEGACY_BOOT_MENU_H
11
12
13#include "BootMenu.h"
14
15#include <SupportDefs.h>
16
17
18struct MasterBootRecord;
19
20
21class LegacyBootMenu : public BootMenu {
22public:
23								LegacyBootMenu();
24	virtual						~LegacyBootMenu();
25
26	virtual	bool				IsInstalled(const BootDrive& drive);
27	virtual	status_t			CanBeInstalled(const BootDrive& drive);
28
29	virtual	status_t			CollectPartitions(const BootDrive& drive,
30									BMessage& settings);
31
32	virtual	status_t			Install(const BootDrive& drive,
33									BMessage& settings);
34	virtual	status_t			SaveMasterBootRecord(BMessage* settings,
35									BFile* file);
36	virtual	status_t			RestoreMasterBootRecord(BMessage* settings,
37									BFile* file);
38	virtual	status_t			GetDisplayText(const char* text,
39									BString& displayText);
40
41private:
42			bool				_ConvertToBIOSText(const char* text,
43									BString& biosText);
44			status_t			_GetBIOSDrive(const char* device,
45									int8& drive);
46			status_t			_ReadBlocks(int fd, uint8* buffer, size_t size);
47			status_t			_WriteBlocks(int fd, const uint8* buffer,
48									size_t size);
49			void				_CopyPartitionTable(
50									MasterBootRecord* destination,
51									const MasterBootRecord* source);
52			bool				_IsValid(const MasterBootRecord* mbr);
53};
54
55
56#endif	// LEGACY_BOOT_MENU_H
57