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
29Handle::Handle(int handle)
30	:
31	fHandle((int16)handle)
32{
33}
34
35
36Handle::Handle(void)
37	:
38	fHandle(DEV_CONSOLE)
39{
40}
41
42
43Handle::~Handle()
44{
45}
46
47
48void
49Handle::SetHandle(int handle)
50{
51	fHandle = (int16)handle;
52}
53
54
55ssize_t
56Handle::ReadAt(void *cookie, off_t pos, void *buffer, size_t bufferSize)
57{
58	return B_ERROR;
59}
60
61
62ssize_t
63Handle::WriteAt(void *cookie, off_t pos, const void *buffer, size_t bufferSize)
64{
65	return B_ERROR;
66}
67
68
69off_t
70Handle::Size() const
71{
72	// ToDo: fix this!
73	return 1024LL * 1024 * 1024 * 1024;
74		// 1024 GB
75}
76