headers/bsd: Add sys/queue.h.
[haiku.git] / src / system / kernel / cache / vnode_store.h
blob8f3b3ed4e2b5f8d503dc2838a4ab9bc8f910767d
1 /*
2 * Copyright 2008-2016, 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
10 #include <vm/VMCache.h>
13 struct file_cache_ref;
16 class VMVnodeCache : public VMCache {
17 public:
18 status_t Init(struct vnode* vnode,
19 uint32 allocationFlags);
21 virtual bool HasPage(off_t offset);
23 virtual status_t Read(off_t offset, const generic_io_vec* vecs,
24 size_t count, uint32 flags,
25 generic_size_t* _numBytes);
26 virtual status_t Write(off_t offset, const generic_io_vec* vecs,
27 size_t count, uint32 flags,
28 generic_size_t* _numBytes);
29 virtual status_t WriteAsync(off_t offset,
30 const generic_io_vec* vecs, size_t count,
31 generic_size_t numBytes, uint32 flags,
32 AsyncIOCallback* callback);
33 virtual bool CanWritePage(off_t offset);
35 virtual status_t Fault(struct VMAddressSpace* aspace,
36 off_t offset);
38 virtual status_t AcquireUnreferencedStoreRef();
39 virtual void AcquireStoreRef();
40 virtual void ReleaseStoreRef();
42 virtual void Dump(bool showPages) const;
44 void SetFileCacheRef(file_cache_ref* ref)
45 { fFileCacheRef = ref; }
46 file_cache_ref* FileCacheRef() const
47 { return fFileCacheRef; }
49 void VnodeDeleted() { fVnodeDeleted = true; }
51 dev_t DeviceId() const
52 { return fDevice; }
53 ino_t InodeId() const
54 { return fInode; }
56 protected:
57 virtual void DeleteObject();
59 private:
60 struct vnode* fVnode;
61 file_cache_ref* fFileCacheRef;
62 ino_t fInode;
63 dev_t fDevice;
64 volatile bool fVnodeDeleted;
68 #endif /* VNODE_STORE_H */