19a44fdc9SAxel Dörfler/*
28c5a0accSAxel Dörfler * Copyright 2006-2011, Haiku, Inc. All Rights Reserved.
39a44fdc9SAxel Dörfler * Distributed under the terms of the MIT License.
49a44fdc9SAxel Dörfler *
59a44fdc9SAxel Dörfler * Authors:
69a44fdc9SAxel Dörfler *		Axel D��rfler, axeld@pinc-software.de
79a44fdc9SAxel Dörfler */
89a44fdc9SAxel Dörfler#ifndef SERVER_MEMORY_ALLOCATOR_H
99a44fdc9SAxel Dörfler#define SERVER_MEMORY_ALLOCATOR_H
109a44fdc9SAxel Dörfler
119a44fdc9SAxel Dörfler
129a44fdc9SAxel Dörfler#include <OS.h>
139a44fdc9SAxel Dörfler#include <List.h>
149a44fdc9SAxel Dörfler
15cefef1c3SAxel Dörfler
169a44fdc9SAxel Dörflernamespace BPrivate {
179a44fdc9SAxel Dörfler
18cefef1c3SAxel Dörfler
199a44fdc9SAxel Dörflerclass ServerMemoryAllocator {
20cefef1c3SAxel Dörflerpublic:
21cefef1c3SAxel Dörfler								ServerMemoryAllocator();
22cefef1c3SAxel Dörfler								~ServerMemoryAllocator();
239a44fdc9SAxel Dörfler
24cefef1c3SAxel Dörfler			status_t			InitCheck();
259a44fdc9SAxel Dörfler
26cefef1c3SAxel Dörfler			status_t			AddArea(area_id serverArea, area_id& _localArea,
27cefef1c3SAxel Dörfler									uint8*& _base, size_t size,
28cefef1c3SAxel Dörfler									bool readOnly = false);
29cefef1c3SAxel Dörfler			void				RemoveArea(area_id serverArea);
309a44fdc9SAxel Dörfler
31cefef1c3SAxel Dörfler			status_t			AreaAndBaseFor(area_id serverArea,
32cefef1c3SAxel Dörfler									area_id& area, uint8*& base);
339a44fdc9SAxel Dörfler
34cefef1c3SAxel Dörflerprivate:
35cefef1c3SAxel Dörfler			BList				fAreas;
369a44fdc9SAxel Dörfler};
379a44fdc9SAxel Dörfler
38cefef1c3SAxel Dörfler
399a44fdc9SAxel Dörfler}	// namespace BPrivate
409a44fdc9SAxel Dörfler
41cefef1c3SAxel Dörfler
42cefef1c3SAxel Dörfler#endif	// SERVER_MEMORY_ALLOCATOR_H
43