xref: /haiku/src/system/boot/platform/atari_m68k/Handle.cpp (revision e1c4049fed1047bdb957b0529e1921e97ef94770)
1 /*
2  * Copyright 2008-2010, François Revol, revol@free.fr. All rights reserved.
3  * Copyright 2003, Axel Dörfler, axeld@pinc-software.de. All rights reserved.
4  * Distributed under the terms of the MIT License.
5  */
6 
7 
8 #include <SupportDefs.h>
9 #include <platform/openfirmware/openfirmware.h>
10 #include <util/kernel_cpp.h>
11 
12 #include "Handle.h"
13 #include "toscalls.h"
14 
15 /*
16  * (X)BIOS supports char and block devices with a separate namespace
17  * for char devs handle is {DEV_PRINTER, ... DEV_CONSOLE, ...}
18  * for block devs handle is either:
19  * 		 - the partition number {0=A:, 2=C:...} in logical mode.
20  * 		 - the drive number {0=A:, 1=B:, 2=ACSI-0, 10=SCSI-0, ...}
21  *			in phys mode (RW_NOTRANSLATE).
22  * BlockHandle is in devices.cpp
23  *
24  * XXX: handle network devices ? not sure how TOS net extensions do this
25  * not sure it'll ever be supported anyway.
26  * XXX: BIOSDrive/BIOSHandle : public BlockHandle ?
27  */
28 
29 Handle::Handle(int handle)
30 	:
31 	fHandle((int16)handle)
32 {
33 }
34 
35 
36 Handle::Handle(void)
37 	:
38 	fHandle(DEV_CONSOLE)
39 {
40 }
41 
42 
43 Handle::~Handle()
44 {
45 }
46 
47 
48 void
49 Handle::SetHandle(int handle)
50 {
51 	fHandle = (int16)handle;
52 }
53 
54 
55 ssize_t
56 Handle::ReadAt(void *cookie, off_t pos, void *buffer, size_t bufferSize)
57 {
58 	return B_ERROR;
59 }
60 
61 
62 ssize_t
63 Handle::WriteAt(void *cookie, off_t pos, const void *buffer, size_t bufferSize)
64 {
65 	return B_ERROR;
66 }
67 
68 
69 off_t
70 Handle::Size() const
71 {
72 	// ToDo: fix this!
73 	return 1024LL * 1024 * 1024 * 1024;
74 		// 1024 GB
75 }
76