Style changes
git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@34536 a95241bf-73f2-0310-859d-f6bbb57e9c96
This commit is contained in:
parent
be7328a9f6
commit
6440406a59
@ -57,109 +57,110 @@ typedef IteratableSplayTree<VMCachePagesTreeDefinition> VMCachePagesTree;
|
||||
|
||||
struct VMCache {
|
||||
public:
|
||||
VMCache();
|
||||
virtual ~VMCache();
|
||||
VMCache();
|
||||
virtual ~VMCache();
|
||||
|
||||
status_t Init(uint32 cacheType);
|
||||
status_t Init(uint32 cacheType);
|
||||
|
||||
virtual void Delete();
|
||||
virtual void Delete();
|
||||
|
||||
bool Lock()
|
||||
{ return mutex_lock(&fLock) == B_OK; }
|
||||
bool TryLock()
|
||||
{ return mutex_trylock(&fLock) == B_OK; }
|
||||
bool SwitchLock(mutex* from)
|
||||
{ return mutex_switch_lock(from, &fLock)
|
||||
== B_OK; }
|
||||
void Unlock();
|
||||
void AssertLocked()
|
||||
{ ASSERT_LOCKED_MUTEX(&fLock); }
|
||||
bool Lock()
|
||||
{ return mutex_lock(&fLock) == B_OK; }
|
||||
bool TryLock()
|
||||
{ return mutex_trylock(&fLock) == B_OK; }
|
||||
bool SwitchLock(mutex* from)
|
||||
{ return mutex_switch_lock(from, &fLock)
|
||||
== B_OK; }
|
||||
void Unlock();
|
||||
void AssertLocked()
|
||||
{ ASSERT_LOCKED_MUTEX(&fLock); }
|
||||
|
||||
void AcquireRefLocked();
|
||||
void AcquireRef();
|
||||
void ReleaseRefLocked();
|
||||
void ReleaseRef();
|
||||
void ReleaseRefAndUnlock()
|
||||
{ ReleaseRefLocked(); Unlock(); }
|
||||
void AcquireRefLocked();
|
||||
void AcquireRef();
|
||||
void ReleaseRefLocked();
|
||||
void ReleaseRef();
|
||||
void ReleaseRefAndUnlock()
|
||||
{ ReleaseRefLocked(); Unlock(); }
|
||||
|
||||
vm_page* LookupPage(off_t offset);
|
||||
void InsertPage(vm_page* page, off_t offset);
|
||||
void RemovePage(vm_page* page);
|
||||
vm_page* LookupPage(off_t offset);
|
||||
void InsertPage(vm_page* page, off_t offset);
|
||||
void RemovePage(vm_page* page);
|
||||
|
||||
void AddConsumer(VMCache* consumer);
|
||||
void AddConsumer(VMCache* consumer);
|
||||
|
||||
status_t InsertAreaLocked(VMArea* area);
|
||||
status_t RemoveArea(VMArea* area);
|
||||
status_t InsertAreaLocked(VMArea* area);
|
||||
status_t RemoveArea(VMArea* area);
|
||||
|
||||
status_t WriteModified();
|
||||
status_t SetMinimalCommitment(off_t commitment);
|
||||
status_t Resize(off_t newSize);
|
||||
status_t WriteModified();
|
||||
status_t SetMinimalCommitment(off_t commitment);
|
||||
status_t Resize(off_t newSize);
|
||||
|
||||
status_t FlushAndRemoveAllPages();
|
||||
status_t FlushAndRemoveAllPages();
|
||||
|
||||
// for debugging only
|
||||
mutex* GetLock()
|
||||
{ return &fLock; }
|
||||
int32 RefCount() const
|
||||
{ return fRefCount; }
|
||||
mutex* GetLock()
|
||||
{ return &fLock; }
|
||||
int32 RefCount() const
|
||||
{ return fRefCount; }
|
||||
|
||||
// backing store operations
|
||||
virtual status_t Commit(off_t size);
|
||||
virtual bool HasPage(off_t offset);
|
||||
virtual status_t Commit(off_t size);
|
||||
virtual bool HasPage(off_t offset);
|
||||
|
||||
virtual status_t Read(off_t offset, const iovec *vecs, size_t count,
|
||||
uint32 flags, size_t *_numBytes);
|
||||
virtual status_t Write(off_t offset, const iovec *vecs, size_t count,
|
||||
uint32 flags, size_t *_numBytes);
|
||||
virtual status_t WriteAsync(off_t offset, const iovec* vecs,
|
||||
size_t count, size_t numBytes, uint32 flags,
|
||||
AsyncIOCallback* callback);
|
||||
virtual bool CanWritePage(off_t offset);
|
||||
virtual status_t Read(off_t offset, const iovec *vecs,
|
||||
size_t count,uint32 flags,
|
||||
size_t *_numBytes);
|
||||
virtual status_t Write(off_t offset, const iovec *vecs, size_t count,
|
||||
uint32 flags, size_t *_numBytes);
|
||||
virtual status_t WriteAsync(off_t offset, const iovec* vecs,
|
||||
size_t count, size_t numBytes, uint32 flags,
|
||||
AsyncIOCallback* callback);
|
||||
virtual bool CanWritePage(off_t offset);
|
||||
|
||||
virtual int32 MaxPagesPerWrite() const
|
||||
{ return -1; } // no restriction
|
||||
virtual int32 MaxPagesPerAsyncWrite() const
|
||||
{ return -1; } // no restriction
|
||||
virtual int32 MaxPagesPerWrite() const
|
||||
{ return -1; } // no restriction
|
||||
virtual int32 MaxPagesPerAsyncWrite() const
|
||||
{ return -1; } // no restriction
|
||||
|
||||
virtual status_t Fault(struct VMAddressSpace *aspace,
|
||||
off_t offset);
|
||||
virtual status_t Fault(struct VMAddressSpace *aspace,
|
||||
off_t offset);
|
||||
|
||||
virtual void Merge(VMCache* source);
|
||||
virtual void Merge(VMCache* source);
|
||||
|
||||
virtual status_t AcquireUnreferencedStoreRef();
|
||||
virtual void AcquireStoreRef();
|
||||
virtual void ReleaseStoreRef();
|
||||
|
||||
private:
|
||||
inline bool _IsMergeable() const;
|
||||
|
||||
void _MergeWithOnlyConsumer();
|
||||
void _RemoveConsumer(VMCache* consumer);
|
||||
virtual status_t AcquireUnreferencedStoreRef();
|
||||
virtual void AcquireStoreRef();
|
||||
virtual void ReleaseStoreRef();
|
||||
|
||||
public:
|
||||
struct VMArea* areas;
|
||||
struct list_link consumer_link;
|
||||
struct list consumers;
|
||||
// list of caches that use this cache as a source
|
||||
VMCachePagesTree pages;
|
||||
VMCache* source;
|
||||
off_t virtual_base;
|
||||
off_t virtual_end;
|
||||
off_t committed_size;
|
||||
// TODO: Remove!
|
||||
uint32 page_count;
|
||||
uint32 temporary : 1;
|
||||
uint32 scan_skip : 1;
|
||||
uint32 type : 6;
|
||||
VMArea* areas;
|
||||
list_link consumer_link;
|
||||
list consumers;
|
||||
// list of caches that use this cache as a source
|
||||
VMCachePagesTree pages;
|
||||
VMCache* source;
|
||||
off_t virtual_base;
|
||||
off_t virtual_end;
|
||||
off_t committed_size;
|
||||
// TODO: Remove!
|
||||
uint32 page_count;
|
||||
uint32 temporary : 1;
|
||||
uint32 scan_skip : 1;
|
||||
uint32 type : 6;
|
||||
|
||||
#if DEBUG_CACHE_LIST
|
||||
struct VMCache* debug_previous;
|
||||
struct VMCache* debug_next;
|
||||
VMCache* debug_previous;
|
||||
VMCache* debug_next;
|
||||
#endif
|
||||
|
||||
private:
|
||||
int32 fRefCount;
|
||||
mutex fLock;
|
||||
inline bool _IsMergeable() const;
|
||||
|
||||
void _MergeWithOnlyConsumer();
|
||||
void _RemoveConsumer(VMCache* consumer);
|
||||
|
||||
private:
|
||||
int32 fRefCount;
|
||||
mutex fLock;
|
||||
};
|
||||
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user