xref: /haiku/src/system/boot/platform/atari_m68k/Handle.h (revision 239222b2369c39dc52df52b0a7cdd6cc0a91bc92)
1 /*
2  * Copyright 2003, Axel Dörfler, axeld@pinc-software.de. All rights reserved.
3  * Distributed under the terms of the MIT License.
4  */
5 #ifndef HANDLE_H
6 #define HANDLE_H
7 
8 
9 #include <boot/vfs.h>
10 
11 
12 #ifdef __cplusplus
13 
14 class Handle : public ConsoleNode {
15 	public:
16 		Handle(int handle);
17 		Handle();
18 		virtual ~Handle();
19 
20 		void SetHandle(int handle);
21 
22 		virtual ssize_t ReadAt(void *cookie, off_t pos, void *buffer, size_t bufferSize);
23 		virtual ssize_t WriteAt(void *cookie, off_t pos, const void *buffer, size_t bufferSize);
24 
25 		virtual off_t Size() const;
26 
27 	protected:
28 		int16		fHandle;
29 };
30 
31 /* character devices */
32 class CharHandle : public Handle {
33 	public:
34 		CharHandle(int handle);
35 		CharHandle();
36 		virtual ~CharHandle();
37 
38 		virtual ssize_t ReadAt(void *cookie, off_t pos, void *buffer, size_t bufferSize);
39 		virtual ssize_t WriteAt(void *cookie, off_t pos, const void *buffer, size_t bufferSize);
40 
41 	protected:
42 };
43 
44 /* block devices */
45 /* cf. devices.cpp */
46 
47 #endif	/* __cplusplus */
48 
49 #endif	/* HANDLE_H */
50