btrfs: [] on the end of a struct field is a variable length array.
[haiku.git] / headers / private / storage / FdIO.h
blobca531d01d670d4e120e1a33d8aa1dda9add32162
1 /*
2 * Copyright 2014, Ingo Weinhold, ingo_weinhold@gmx.de.
3 * Distributed under the terms of the MIT License.
4 */
5 #ifndef _FD_IO_H_
6 #define _FD_IO_H_
9 #include <DataIO.h>
12 class BFdIO : public BPositionIO {
13 public:
14 BFdIO();
15 BFdIO(int fd, bool keepFd);
16 virtual ~BFdIO();
18 void SetTo(int fd, bool keepFd);
19 void Unset();
21 virtual ssize_t Read(void* buffer, size_t size);
22 virtual ssize_t Write(const void* buffer, size_t size);
24 virtual ssize_t ReadAt(off_t position, void* buffer,
25 size_t size);
26 virtual ssize_t WriteAt(off_t position, const void* buffer,
27 size_t size);
29 virtual off_t Seek(off_t position, uint32 seekMode);
30 virtual off_t Position() const;
32 virtual status_t SetSize(off_t size);
33 virtual status_t GetSize(off_t* _size) const;
35 private:
36 BFdIO(const BFdIO& other);
37 BFdIO& operator=(const BFdIO& other);
39 private:
40 int fFd;
41 bool fOwnsFd;
45 #endif // _FD_IO_H_