1 /* 2 * Copyright 2008, Ingo Weinhold, ingo_weinhold@gmx.de. 3 * Copyright 2004-2007, Axel Dörfler, axeld@pinc-software.de. 4 * Distributed under the terms of the MIT License. 5 */ 6 #ifndef VNODE_STORE_H 7 #define VNODE_STORE_H 8 9 10 #include <vm_types.h> 11 12 13 struct file_cache_ref; 14 15 16 class VMVnodeCache : public VMCache { 17 public: 18 status_t Init(struct vnode *vnode); 19 20 virtual bool HasPage(off_t offset); 21 22 virtual status_t Read(off_t offset, const iovec *vecs, size_t count, 23 uint32 flags, size_t *_numBytes); 24 virtual status_t Write(off_t offset, const iovec *vecs, size_t count, 25 uint32 flags, size_t *_numBytes); 26 virtual status_t WriteAsync(off_t offset, const iovec* vecs, 27 size_t count, size_t numBytes, uint32 flags, 28 AsyncIOCallback* callback); 29 30 virtual status_t Fault(struct vm_address_space *aspace, off_t offset); 31 32 virtual status_t AcquireUnreferencedStoreRef(); 33 virtual void AcquireStoreRef(); 34 virtual void ReleaseStoreRef(); 35 36 void SetFileCacheRef(file_cache_ref* ref) 37 { fFileCacheRef = ref; } 38 file_cache_ref* FileCacheRef() const 39 { return fFileCacheRef; } 40 41 private: 42 struct vnode* fVnode; 43 dev_t fDevice; 44 ino_t fInode; 45 file_cache_ref* fFileCacheRef; 46 }; 47 48 49 #endif /* VNODE_STORE_H */ 50