xref: /haiku/src/system/kernel/cache/vnode_store.h (revision b06a48ab8f30b45916a9c157b992827779182163)
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 							size_t *_numBytes);
24 	virtual	status_t	Write(off_t offset, const iovec *vecs, size_t count,
25 							size_t *_numBytes);
26 
27 	virtual	status_t	Fault(struct vm_address_space *aspace, off_t offset);
28 
29 	virtual	status_t	AcquireUnreferencedStoreRef();
30 	virtual	void		AcquireStoreRef();
31 	virtual	void		ReleaseStoreRef();
32 
33 			void		SetFileCacheRef(file_cache_ref* ref)
34 							{ fFileCacheRef = ref; }
35 	file_cache_ref*		FileCacheRef() const
36 							{ return fFileCacheRef; }
37 
38 private:
39 	struct vnode*	fVnode;
40 	dev_t			fDevice;
41 	ino_t			fInode;
42 	file_cache_ref*	fFileCacheRef;
43 };
44 
45 
46 #endif	/* VNODE_STORE_H */
47