Style changes

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