mmlr + bonefish:
Add ObjectCache::ObjectAtIndex(). git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@43086 a95241bf-73f2-0310-859d-f6bbb57e9c96
This commit is contained in:
@@ -141,7 +141,7 @@ ObjectCache::InitSlab(slab* slab, void* pages, size_t byteCount, uint32 flags)
|
||||
|
||||
CREATE_PARANOIA_CHECK_SET(slab, "slab");
|
||||
|
||||
|
||||
|
||||
for (size_t i = 0; i < slab->size; i++) {
|
||||
status_t status = B_OK;
|
||||
if (constructor)
|
||||
@@ -245,6 +245,13 @@ ObjectCache::ReturnObjectToSlab(slab* source, void* object, uint32 flags)
|
||||
}
|
||||
|
||||
|
||||
void*
|
||||
ObjectCache::ObjectAtIndex(slab* source, int32 index) const
|
||||
{
|
||||
return (uint8*)source->pages + source->offset + index * object_size;
|
||||
}
|
||||
|
||||
|
||||
#if PARANOID_KERNEL_FREE
|
||||
|
||||
bool
|
||||
|
||||
@@ -106,6 +106,7 @@ public:
|
||||
|
||||
void ReturnObjectToSlab(slab* source, void* object,
|
||||
uint32 flags);
|
||||
void* ObjectAtIndex(slab* source, int32 index) const;
|
||||
|
||||
bool Lock() { return mutex_lock(&lock) == B_OK; }
|
||||
void Unlock() { mutex_unlock(&lock); }
|
||||
|
||||
Reference in New Issue
Block a user