xref: /haiku/src/system/kernel/vm/VMAnonymousNoSwapCache.h (revision bf77c15232b2dbc93fca01ca95a0fcdf955ce600)
15c99d639SIngo Weinhold /*
2f8154d17SIngo Weinhold  * Copyright 2008-2011, Ingo Weinhold, ingo_weinhold@gmx.de.
35c99d639SIngo Weinhold  * Copyright 2004-2007, Axel Dörfler, axeld@pinc-software.de.
45c99d639SIngo Weinhold  * Distributed under the terms of the MIT License.
55c99d639SIngo Weinhold  *
65c99d639SIngo Weinhold  * Copyright 2001-2002, Travis Geiselbrecht. All rights reserved.
75c99d639SIngo Weinhold  * Distributed under the terms of the NewOS License.
85c99d639SIngo Weinhold  */
9c586076dSIngo Weinhold #ifndef _KERNEL_VM_STORE_ANONYMOUS_NO_SWAP_H
10c586076dSIngo Weinhold #define _KERNEL_VM_STORE_ANONYMOUS_NO_SWAP_H
115c99d639SIngo Weinhold 
12be7328a9SIngo Weinhold 
13be7328a9SIngo Weinhold #include <vm/VMCache.h>
145c99d639SIngo Weinhold 
155c99d639SIngo Weinhold 
165c99d639SIngo Weinhold class VMAnonymousNoSwapCache : public VMCache {
175c99d639SIngo Weinhold public:
185c99d639SIngo Weinhold 	virtual						~VMAnonymousNoSwapCache();
195c99d639SIngo Weinhold 
20ab3d6a3eSIngo Weinhold 			status_t			Init(bool canOvercommit,
21ab3d6a3eSIngo Weinhold 									int32 numPrecommittedPages,
22ab3d6a3eSIngo Weinhold 				   					int32 numGuardPages,
23ab3d6a3eSIngo Weinhold 				   					uint32 allocationFlags);
245c99d639SIngo Weinhold 
25cff6e9e4SIngo Weinhold 	virtual	status_t			Commit(off_t size, int priority);
265c99d639SIngo Weinhold 	virtual	bool				HasPage(off_t offset);
275c99d639SIngo Weinhold 
28d1f280c8SHamish Morrison 	virtual	int32				GuardSize()	{ return fGuardedSize; }
29d1f280c8SHamish Morrison 
30*bf77c152SAugustin Cavalier 	virtual	status_t			Read(off_t offset, const generic_io_vec *vecs,
31ab3d6a3eSIngo Weinhold 									 size_t count,uint32 flags,
32*bf77c152SAugustin Cavalier 									 generic_size_t *_numBytes);
33*bf77c152SAugustin Cavalier 	virtual	status_t			Write(off_t offset, const generic_io_vec *vecs,
34ab3d6a3eSIngo Weinhold 									  size_t count, uint32 flags,
35*bf77c152SAugustin Cavalier 									  generic_size_t *_numBytes);
365c99d639SIngo Weinhold 
37ab3d6a3eSIngo Weinhold 	virtual	status_t			Fault(struct VMAddressSpace* aspace,
38ab3d6a3eSIngo Weinhold 									off_t offset);
395c99d639SIngo Weinhold 
405c99d639SIngo Weinhold 	virtual	void				MergeStore(VMCache* source);
415c99d639SIngo Weinhold 
42f8154d17SIngo Weinhold protected:
43f8154d17SIngo Weinhold 	virtual	void				DeleteObject();
44f8154d17SIngo Weinhold 
455c99d639SIngo Weinhold private:
465c99d639SIngo Weinhold 			bool				fCanOvercommit;
475c99d639SIngo Weinhold 			bool				fHasPrecommitted;
485c99d639SIngo Weinhold 			uint8				fPrecommittedPages;
495c99d639SIngo Weinhold 			int32				fGuardedSize;
505c99d639SIngo Weinhold };
515c99d639SIngo Weinhold 
525c99d639SIngo Weinhold 
53c586076dSIngo Weinhold #endif	/* _KERNEL_VM_STORE_ANONYMOUS_NO_SWAP_H */
54