xref: /haiku/src/system/kernel/vm/VMAnonymousNoSwapCache.h (revision c0a12a6b7d697382511ff36e7815aad6a379b3a7)
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 
16*c0a12a6bSAugustin Cavalier 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 
GuardSize()28d1f280c8SHamish Morrison 	virtual	int32				GuardSize()	{ return fGuardedSize; }
SetGuardSize(int32 guardSize)29c6657ffeSHamish Morrison 	virtual	void				SetGuardSize(int32 guardSize)
30c6657ffeSHamish Morrison 									{ fGuardedSize = guardSize; }
31d1f280c8SHamish Morrison 
32bf77c152SAugustin Cavalier 	virtual	status_t			Read(off_t offset, const generic_io_vec *vecs,
33ab3d6a3eSIngo Weinhold 									size_t count,uint32 flags,
34bf77c152SAugustin Cavalier 									generic_size_t *_numBytes);
35bf77c152SAugustin Cavalier 	virtual	status_t			Write(off_t offset, const generic_io_vec *vecs,
36ab3d6a3eSIngo Weinhold 									size_t count, uint32 flags,
37bf77c152SAugustin Cavalier 									generic_size_t *_numBytes);
385c99d639SIngo Weinhold 
39ab3d6a3eSIngo Weinhold 	virtual	status_t			Fault(struct VMAddressSpace* aspace,
40ab3d6a3eSIngo Weinhold 									off_t offset);
415c99d639SIngo Weinhold 
425c99d639SIngo Weinhold 	virtual	void				MergeStore(VMCache* source);
435c99d639SIngo Weinhold 
44f8154d17SIngo Weinhold protected:
45f8154d17SIngo Weinhold 	virtual	void				DeleteObject();
46f8154d17SIngo Weinhold 
475c99d639SIngo Weinhold private:
485c99d639SIngo Weinhold 			bool				fCanOvercommit;
495c99d639SIngo Weinhold 			bool				fHasPrecommitted;
505c99d639SIngo Weinhold 			uint8				fPrecommittedPages;
515c99d639SIngo Weinhold 			int32				fGuardedSize;
525c99d639SIngo Weinhold };
535c99d639SIngo Weinhold 
545c99d639SIngo Weinhold 
55c586076dSIngo Weinhold #endif	/* _KERNEL_VM_STORE_ANONYMOUS_NO_SWAP_H */
56