[haiku-commits] r43086 - haiku/trunk/src/system/kernel/slab

  • From: ingo_weinhold@xxxxxx
  • To: haiku-commits@xxxxxxxxxxxxx
  • Date: Tue, 1 Nov 2011 23:23:37 +0100 (CET)

Author: bonefish
Date: 2011-11-01 23:23:37 +0100 (Tue, 01 Nov 2011)
New Revision: 43086
Changeset: https://dev.haiku-os.org/changeset/43086

Modified:
   haiku/trunk/src/system/kernel/slab/ObjectCache.cpp
   haiku/trunk/src/system/kernel/slab/ObjectCache.h
Log:
mmlr + bonefish:
Add ObjectCache::ObjectAtIndex().


Modified: haiku/trunk/src/system/kernel/slab/ObjectCache.cpp
===================================================================
--- haiku/trunk/src/system/kernel/slab/ObjectCache.cpp  2011-11-01 22:22:14 UTC 
(rev 43085)
+++ haiku/trunk/src/system/kernel/slab/ObjectCache.cpp  2011-11-01 22:23:37 UTC 
(rev 43086)
@@ -141,7 +141,7 @@
 
        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 @@
 }
 
 
+void*
+ObjectCache::ObjectAtIndex(slab* source, int32 index) const
+{
+       return (uint8*)source->pages + source->offset + index * object_size;
+}
+
+
 #if PARANOID_KERNEL_FREE
 
 bool

Modified: haiku/trunk/src/system/kernel/slab/ObjectCache.h
===================================================================
--- haiku/trunk/src/system/kernel/slab/ObjectCache.h    2011-11-01 22:22:14 UTC 
(rev 43085)
+++ haiku/trunk/src/system/kernel/slab/ObjectCache.h    2011-11-01 22:23:37 UTC 
(rev 43086)
@@ -106,6 +106,7 @@
 
                        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); }


Other related posts:

  • » [haiku-commits] r43086 - haiku/trunk/src/system/kernel/slab - ingo_weinhold