* Cleanup, no functional change - this is now a pure C++ header.

git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@33596 a95241bf-73f2-0310-859d-f6bbb57e9c96
This commit is contained in:
Axel Dörfler
2009-10-15 10:13:02 +00:00
parent 8f10aa5da6
commit 9b912c694a
+21 -15
View File
@@ -1,5 +1,5 @@
/* /*
* Copyright 2002-2008, Axel Dörfler, [email protected]. * Copyright 2002-2009, Axel Dörfler, [email protected].
* Distributed under the terms of the MIT License. * Distributed under the terms of the MIT License.
* *
* Copyright 2001-2002, Travis Geiselbrecht. All rights reserved. * Copyright 2001-2002, Travis Geiselbrecht. All rights reserved.
@@ -15,21 +15,19 @@
#include <kernel.h> #include <kernel.h>
#include <lock.h> #include <lock.h>
#include <util/DoublyLinkedQueue.h> #include <util/DoublyLinkedQueue.h>
#include <util/SplayTree.h>
#include <sys/uio.h> #include <sys/uio.h>
#include "kernel_debug_config.h" #include "kernel_debug_config.h"
#ifdef __cplusplus
#include <util/SplayTree.h>
class AsyncIOCallback; class AsyncIOCallback;
struct vm_page_mapping; struct vm_page_mapping;
struct VMCache; struct VMCache;
typedef DoublyLinkedListLink<vm_page_mapping> vm_page_mapping_link; typedef DoublyLinkedListLink<vm_page_mapping> vm_page_mapping_link;
typedef struct vm_page_mapping { typedef struct vm_page_mapping {
vm_page_mapping_link page_link; vm_page_mapping_link page_link;
vm_page_mapping_link area_link; vm_page_mapping_link area_link;
@@ -44,7 +42,8 @@ class DoublyLinkedPageLink {
return &element->page_link; return &element->page_link;
} }
inline const vm_page_mapping_link *operator()(const vm_page_mapping *element) const inline const vm_page_mapping_link *operator()(
const vm_page_mapping *element) const
{ {
return &element->page_link; return &element->page_link;
} }
@@ -57,14 +56,17 @@ class DoublyLinkedAreaLink {
return &element->area_link; return &element->area_link;
} }
inline const vm_page_mapping_link *operator()(const vm_page_mapping *element) const inline const vm_page_mapping_link *operator()(
const vm_page_mapping *element) const
{ {
return &element->area_link; return &element->area_link;
} }
}; };
typedef class DoublyLinkedQueue<vm_page_mapping, DoublyLinkedPageLink> vm_page_mappings; typedef class DoublyLinkedQueue<vm_page_mapping, DoublyLinkedPageLink>
typedef class DoublyLinkedQueue<vm_page_mapping, DoublyLinkedAreaLink> vm_area_mappings; vm_page_mappings;
typedef class DoublyLinkedQueue<vm_page_mapping, DoublyLinkedAreaLink>
vm_area_mappings;
typedef uint32 page_num_t; typedef uint32 page_num_t;
@@ -171,7 +173,8 @@ public:
bool TryLock() bool TryLock()
{ return mutex_trylock(&fLock) == B_OK; } { return mutex_trylock(&fLock) == B_OK; }
bool SwitchLock(mutex* from) bool SwitchLock(mutex* from)
{ return mutex_switch_lock(from, &fLock) == B_OK; } { return mutex_switch_lock(from, &fLock)
== B_OK; }
void Unlock(); void Unlock();
void AssertLocked() void AssertLocked()
{ ASSERT_LOCKED_MUTEX(&fLock); } { ASSERT_LOCKED_MUTEX(&fLock); }
@@ -222,7 +225,8 @@ public:
virtual int32 MaxPagesPerAsyncWrite() const virtual int32 MaxPagesPerAsyncWrite() const
{ return -1; } // no restriction { return -1; } // no restriction
virtual status_t Fault(struct vm_address_space *aspace, off_t offset); virtual status_t Fault(struct vm_address_space *aspace,
off_t offset);
virtual void Merge(VMCache* source); virtual void Merge(VMCache* source);
@@ -277,8 +281,10 @@ public:
static status_t CreateAnonymousCache(VMCache*& cache, static status_t CreateAnonymousCache(VMCache*& cache,
bool canOvercommit, int32 numPrecommittedPages, bool canOvercommit, int32 numPrecommittedPages,
int32 numGuardPages, bool swappable); int32 numGuardPages, bool swappable);
static status_t CreateVnodeCache(VMCache*& cache, struct vnode* vnode); static status_t CreateVnodeCache(VMCache*& cache,
static status_t CreateDeviceCache(VMCache*& cache, addr_t baseAddress); struct vnode* vnode);
static status_t CreateDeviceCache(VMCache*& cache,
addr_t baseAddress);
static status_t CreateNullCache(VMCache*& cache); static status_t CreateNullCache(VMCache*& cache);
}; };
@@ -306,7 +312,6 @@ struct vm_area {
struct vm_area* hash_next; struct vm_area* hash_next;
}; };
#endif // __cplusplus
enum { enum {
VM_ASPACE_STATE_NORMAL = 0, VM_ASPACE_STATE_NORMAL = 0,
@@ -328,4 +333,5 @@ struct vm_address_space {
struct vm_address_space* hash_next; struct vm_address_space* hash_next;
}; };
#endif /* _KERNEL_VM_TYPES_H */
#endif // _KERNEL_VM_TYPES_H