xref: /haiku/src/system/boot/loader/file_systems/fat/File.h (revision 4bd0c1066b227cec4b79883bdef697c7a27f2e90)
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 FILE_H
6 #define FILE_H
7 
8 
9 #include <boot/vfs.h>
10 
11 #include "Stream.h"
12 #include "Volume.h"
13 
14 
15 namespace FATFS {
16 
17 class File : public Node {
18 	public:
19 		File(Volume &volume, off_t dirEntryOffset, uint32 cluster, off_t size,
20 			const char *name);
21 		virtual ~File();
22 
23 		status_t InitCheck();
24 
25 		off_t DirEntryOffset() const	{ return fDirEntryOffset; }
26 
27 		virtual status_t Open(void **_cookie, int mode);
28 		virtual status_t Close(void *cookie);
29 
30 		virtual ssize_t ReadAt(void *cookie, off_t pos, void *buffer, size_t bufferSize);
31 		virtual ssize_t WriteAt(void *cookie, off_t pos, const void *buffer, size_t bufferSize);
32 
33 		virtual status_t GetName(char *nameBuffer, size_t bufferSize) const;
34 		virtual status_t GetFileMap(struct file_map_run *runs, int32 *count);
35 		virtual int32 Type() const;
36 		virtual off_t Size() const;
37 		virtual ino_t Inode() const;
38 
39 	private:
40 		Volume		&fVolume;
41 		//FileBlock	fNode;
42 		Stream		fStream;
43 		off_t		fDirEntryOffset;
44 };
45 
46 }	// namespace FATFS
47 
48 #endif	/* FILE_H */
49