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 final : 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 virtual void SetGuardSize(int32 guardSize) 30 { fGuardedSize = guardSize; } 31 32 virtual status_t Read(off_t offset, const generic_io_vec *vecs, 33 size_t count,uint32 flags, 34 generic_size_t *_numBytes); 35 virtual status_t Write(off_t offset, const generic_io_vec *vecs, 36 size_t count, uint32 flags, 37 generic_size_t *_numBytes); 38 39 virtual status_t Fault(struct VMAddressSpace* aspace, 40 off_t offset); 41 42 virtual void MergeStore(VMCache* source); 43 44 protected: 45 virtual void DeleteObject(); 46 47 private: 48 bool fCanOvercommit; 49 bool fHasPrecommitted; 50 uint8 fPrecommittedPages; 51 int32 fGuardedSize; 52 }; 53 54 55 #endif /* _KERNEL_VM_STORE_ANONYMOUS_NO_SWAP_H */ 56