xref: /haiku/src/system/kernel/vm/VMAnonymousNoSwapCache.h (revision c42868a015daa160e093679b2637b1cf9f0b26ba)
1 /*
2  * Copyright 2008-2011, 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  * Copyright 2001-2002, Travis Geiselbrecht. All rights reserved.
7  * Distributed under the terms of the NewOS License.
8  */
9 #ifndef _KERNEL_VM_STORE_ANONYMOUS_NO_SWAP_H
10 #define _KERNEL_VM_STORE_ANONYMOUS_NO_SWAP_H
11 
12 
13 #include <vm/VMCache.h>
14 
15 
16 class VMAnonymousNoSwapCache : public VMCache {
17 public:
18 	virtual						~VMAnonymousNoSwapCache();
19 
20 			status_t			Init(bool canOvercommit,
21 									int32 numPrecommittedPages,
22 				   					int32 numGuardPages,
23 				   					uint32 allocationFlags);
24 
25 	virtual	status_t			Commit(off_t size, int priority);
26 	virtual	bool				HasPage(off_t offset);
27 
28 	virtual	int32				GuardSize()	{ return fGuardedSize; }
29 
30 	virtual	status_t			Read(off_t offset, const generic_io_vec *vecs,
31 									 size_t count,uint32 flags,
32 									 generic_size_t *_numBytes);
33 	virtual	status_t			Write(off_t offset, const generic_io_vec *vecs,
34 									  size_t count, uint32 flags,
35 									  generic_size_t *_numBytes);
36 
37 	virtual	status_t			Fault(struct VMAddressSpace* aspace,
38 									off_t offset);
39 
40 	virtual	void				MergeStore(VMCache* source);
41 
42 protected:
43 	virtual	void				DeleteObject();
44 
45 private:
46 			bool				fCanOvercommit;
47 			bool				fHasPrecommitted;
48 			uint8				fPrecommittedPages;
49 			int32				fGuardedSize;
50 };
51 
52 
53 #endif	/* _KERNEL_VM_STORE_ANONYMOUS_NO_SWAP_H */
54