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 class Handle : public Node { 13 public: 14 Handle(intptr_t handle, bool takeOwnership = true); 15 Handle(); 16 virtual ~Handle(); 17 18 void SetHandle(intptr_t handle, bool takeOwnership = true); 19 20 virtual ssize_t ReadAt(void *cookie, off_t pos, void *buffer, size_t bufferSize); 21 virtual ssize_t WriteAt(void *cookie, off_t pos, const void *buffer, size_t bufferSize); 22 23 virtual off_t Size() const; 24 25 protected: 26 intptr_t fHandle; 27 bool fOwnHandle; 28 }; 29 30 #endif /* HANDLE_H */ 31