xref: /haiku/src/system/kernel/vm/VMUserArea.h (revision 2c1886aeae1be8dc6bb9656701b2aab5bf3311ca)
1 /*
2  * Copyright 2009, Ingo Weinhold, ingo_weinhold@gmx.de.
3  * Distributed under the terms of the NewOS License.
4  */
5 #ifndef VM_USER_AREA_H
6 #define VM_USER_AREA_H
7 
8 
9 #include <vm/VMArea.h>
10 
11 
12 struct VMUserAddressSpace;
13 
14 
15 struct VMUserArea : VMArea {
16 								VMUserArea(VMAddressSpace* addressSpace,
17 									uint32 wiring, uint32 protection);
18 								~VMUserArea();
19 
20 	static	VMUserArea*			Create(VMAddressSpace* addressSpace,
21 									const char* name, uint32 wiring,
22 									uint32 protection);
23 	static	VMUserArea*			CreateReserved(VMAddressSpace* addressSpace,
24 									uint32 flags);
25 
26 			DoublyLinkedListLink<VMUserArea>& AddressSpaceLink()
27 									{ return fAddressSpaceLink; }
28 			const DoublyLinkedListLink<VMUserArea>& AddressSpaceLink() const
29 									{ return fAddressSpaceLink; }
30 
31 private:
32 			DoublyLinkedListLink<VMUserArea> fAddressSpaceLink;
33 };
34 
35 
36 struct VMUserAreaGetLink {
37     inline DoublyLinkedListLink<VMUserArea>* operator()(
38 		VMUserArea* area) const
39     {
40         return &area->AddressSpaceLink();
41     }
42 
43     inline const DoublyLinkedListLink<VMUserArea>* operator()(
44 		const VMUserArea* area) const
45     {
46         return &area->AddressSpaceLink();
47     }
48 };
49 
50 typedef DoublyLinkedList<VMUserArea, VMUserAreaGetLink> VMUserAreaList;
51 
52 
53 #endif	// VM_USER_AREA_H
54