Author: bonefish Date: 2009-12-07 15:28:56 +0100 (Mon, 07 Dec 2009) New Revision: 34536 Changeset: http://dev.haiku-os.org/changeset/34536/haiku Modified: haiku/trunk/headers/private/kernel/vm/VMCache.h Log: Style changes Modified: haiku/trunk/headers/private/kernel/vm/VMCache.h =================================================================== --- haiku/trunk/headers/private/kernel/vm/VMCache.h 2009-12-07 14:14:21 UTC (rev 34535) +++ haiku/trunk/headers/private/kernel/vm/VMCache.h 2009-12-07 14:28:56 UTC (rev 34536) @@ -57,109 +57,110 @@ 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(); + virtual status_t AcquireUnreferencedStoreRef(); + virtual void AcquireStoreRef(); + virtual void ReleaseStoreRef(); -private: - inline bool _IsMergeable() const; - - void _MergeWithOnlyConsumer(); - void _RemoveConsumer(VMCache* consumer); - 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; };