vfs: check userland buffers before reading them.
[haiku.git] / src / system / boot / loader / file_systems / bfs / File.h
blobaf9b842d86ec1ab619a04dd111cfe8532398f7ec
1 /*
2 ** Copyright 2003-2004, 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
9 #include <boot/vfs.h>
11 #include "Volume.h"
12 #include "Stream.h"
15 namespace BFS {
17 class File : public Node {
18 public:
19 File(Volume &volume, block_run run);
20 File(Volume &volume, off_t id);
21 File(const Stream &stream);
22 virtual ~File();
24 status_t InitCheck();
26 virtual ssize_t ReadAt(void *cookie, off_t pos, void *buffer, size_t bufferSize);
27 virtual ssize_t WriteAt(void *cookie, off_t pos, const void *buffer, size_t bufferSize);
29 virtual status_t GetName(char *nameBuffer, size_t bufferSize) const;
30 virtual int32 Type() const;
31 virtual off_t Size() const;
32 virtual ino_t Inode() const;
34 protected:
35 Stream fStream;
38 } // namespace BFS
40 #endif /* FILE_H */