浏览代码

Renamed bibop to bitmap

Ioannis Koutras 12 年之前
父节点
当前提交
48747ab568

+ 3 - 3
DefineOptions.cmake

@@ -1,5 +1,5 @@
 set(WITH_SYSTEM_CALLS "none" CACHE STRING "Choose what system calls can be used, options are: none, sbrk, mmap")
-set(RAW_BLOCKS_TYPE "bibop" CACHE STRING "Choose what raw blocks can be used, options are: freelist, bibop")
+set(RAW_BLOCKS_TYPE "bitmap" CACHE STRING "Choose what raw blocks can be used, options are: freelist, bitmap")
 option(HAVE_LOCKS "Build with POSIX locking mechanisms" ON)
 option(WITH_REALLOC "Build with realloc" OFF)
 option(WITH_EXAMPLES "Build with examples" OFF)
@@ -81,8 +81,8 @@ endif (LINUXTEST)
 
 if(RAW_BLOCKS_TYPE STREQUAL "freelist")
   set(FL_RB_ONLY ON)
-elseif(RAW_BLOCKS_TYPE STREQUAL "bibop")
-  set(BIBOP_RB_ONLY ON)
+elseif(RAW_BLOCKS_TYPE STREQUAL "bitmap")
+  set(BITMAP_RB_ONLY ON)
 endif(RAW_BLOCKS_TYPE STREQUAL "freelist")
 
 if(COALESCE_AFTER_SPLIT)

+ 1 - 1
dmm_config.h.in

@@ -2,7 +2,7 @@
 #define DMM_CONFIG_H
 
 #cmakedefine FL_RB_ONLY
-#cmakedefine BIBOP_RB_ONLY
+#cmakedefine BITMAP_RB_ONLY
 #cmakedefine SYS_ALLOC_SIZE @SYS_ALLOC_SIZE@
 #cmakedefine HAVE_LOCKS
 

+ 0 - 32
private-include/bibop/bibop_free.h

@@ -1,32 +0,0 @@
-/*
- *   Copyright 2012 Institute of Communication and Computer Systems (ICCS) 
- *
- *   Licensed under the Apache License, Version 2.0 (the "License");
- *   you may not use this file except in compliance with the License.
- *   You may obtain a copy of the License at
- *
- *       http://www.apache.org/licenses/LICENSE-2.0
- *
- *   Unless required by applicable law or agreed to in writing, software
- *   distributed under the License is distributed on an "AS IS" BASIS,
- *   WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- *   See the License for the specific language governing permissions and
- *   limitations under the License.
- *
- */
-
-/**
- * @file    bibop_free.h
- * @author  Ilias Pliotas (hpliotas@gmail.com), Ioannis Koutras
- * (joko@microlab.ntua.gr)
- * @brief   Memory de-allocation for BiBoP-organized raw blocks
- */
-
-#ifndef BIBOP_FREE_H
-#define BIBOP_FREE_H
-
-#include "dmmlib/raw_block.h"
-
-void bibop_free(raw_block_header_t *raw_block, void *ptr);
-
-#endif /* BIBOP_FREE_H */

+ 11 - 14
private-include/bibop/bibop_malloc.h

@@ -16,27 +16,24 @@
  */
 
 /**
- * @file   bibop_malloc.h
+ * @file   bitmap.h
  * @author Ioannis Koutras (joko@microlab.ntua.gr)
- * @brief  Memory allocation for BiBoP-organized raw blocks
+ * @brief  Memory allocation for bitmap-organized raw blocks
  */
 
-#ifndef BIBOP_MALLOC_H
-#define BIBOP_MALLOC_H
+#ifndef BITMAP_H
+#define BITMAP_H
 #include "dmm_config.h"
 
 #include "dmmlib/raw_block.h"
 
-#ifdef BIBOP_RB_ONLY
-#define dmmlib_malloc(raw_block, size) bibop_malloc(raw_block, size)
-#endif /* BIBOP_RB_ONLY */
+#ifdef BITMAP_RB_ONLY
+#define dmmlib_malloc(raw_block, size) bitmap_malloc(raw_block, size)
+#define dmmlib_free(raw_block, size) bitmap_free(raw_block, size)
+#endif /* BITMAP_RB_ONLY */
 
-void * bibop_malloc(raw_block_header_t *raw_block, size_t size);
+void * bitmap_malloc(raw_block_header_t *raw_block, size_t size);
 
-#ifdef BIBOP_RB_ONLY
-#define dmmlib_free(raw_block, size) bibop_free(raw_block, size)
-#endif /* BIBOP_RB_ONLY */
+void bitmap_free(raw_block_header_t *raw_block, void *ptr);
 
-void bibop_free(raw_block_header_t *raw_block, void *ptr);
-
-#endif /* BIBOP_MALLOC_H */
+#endif /* BITMAP_H */

+ 7 - 7
private-include/bibop/bibop_other.h

@@ -16,17 +16,17 @@
  */
 
 /**
- * @file   bibop_other.h
+ * @file   bitmap_other.h
  * @author Ilias Pliotas, Ioannis Koutras
- * @date   September, 2012
- * @brief  Helping functions for BiBoP raw blocks
+ * @date   September 2012
+ * @brief  Helping functions for bitmap-organized raw blocks
  */
 
-#ifndef BIBOP_OTHER_H
-#define BIBOP_OTHER_H
+#ifndef BITMAP_OTHER_H
+#define BITMAP_OTHER_H
 #include "dmm_config.h"
 
-#include "bibop/bibop_rb.h"
+#include "bitmap/bitmap_rb.h"
 
 void copy_array(BMAP_EL_TYPE *dest, BMAP_EL_TYPE *src);
 
@@ -38,4 +38,4 @@ size_t prev_pow2(size_t n);
 
 BMAP_EL_TYPE make_bit_mask(size_t start_pos, size_t length);
 
-#endif /* BIBOP_OTHER_H */
+#endif /* BITMAP_OTHER_H */

+ 8 - 8
private-include/bibop/bibop_rb.h

@@ -16,14 +16,14 @@
  */
 
 /**
- * @file   bibop_rb.h
+ * @file   bitmap_rb.h
  * @author Ioannis Koutras (joko@microlab.ntua.gr)
  * @date   September 2012
- * @brief  BiBoP raw block structure and creation function.
+ * @brief  Bitmap-organized raw block structure and creation function.
  */
 
-#ifndef BIBOP_RB_H
-#define BIBOP_RB_H
+#ifndef BITMAP_RB_H
+#define BITMAP_RB_H
 #include "dmm_config.h"
 
 #include <inttypes.h>
@@ -34,18 +34,18 @@
 
 #define BMAP_INDEX_NUM 20
 
-/** BiBoP raw block header data structure */
-typedef struct bibop_rb_s {
+/** Bitmap-organized raw block header data structure */
+typedef struct bitmap_rb_s {
     BMAP_EL_TYPE bmap_array[BMAP_INDEX_NUM];
     BMAP_EL_TYPE bmap_array2[BMAP_INDEX_NUM];
     BMAP_EL_TYPE bmap_array3[BMAP_INDEX_NUM];
     size_t bytes_per_cell; /* FIXME - As long as the bitmap arrays are
                               fixed-sized, this is also fixed */
-} bibop_rb_t;
+} bitmap_rb_t;
 
 /** Chunk header data structure */
 typedef struct chunk_header_s {
     size_t num_of_cells; /**< The number of occupied cells. */
 } chunk_header_t;
 
-#endif /* BIBOP_RB_H */
+#endif /* BITMAP_RB_H */

+ 4 - 4
src/CMakeLists.txt

@@ -82,13 +82,13 @@ if(RAW_BLOCKS_TYPE STREQUAL "freelist")
       )
   endif(SPLITTING_FIXED OR SPLITTING_VARIABLE)
 
-elseif(RAW_BLOCKS_TYPE STREQUAL "bibop")
+elseif(RAW_BLOCKS_TYPE STREQUAL "bitmap")
 
   set(dmmlib_SRCS
     ${dmmlib_SRCS}
-    bibop/bibop_other.c
-    bibop/bibop_malloc.c
-    bibop/bibop_free.c
+    bitmap/bitmap_other.c
+    bitmap/bitmap_malloc.c
+    bitmap/bitmap_free.c
     )
 
 endif(RAW_BLOCKS_TYPE STREQUAL "freelist")

+ 10 - 10
src/bibop/bibop_free.c

@@ -16,31 +16,31 @@
  */
 
 /**
- * @file   bibop_free.c
+ * @file   bitmap_free.c
  * @author Ilias Pliotas, Ioannis Koutras
  * @date   September 2012
- * @brief  free() implementation for BiBoP raw blocks
+ * @brief  free() implementation for bitmap-organized raw blocks
  */
 
-#include "bibop/bibop_free.h"
-#include "bibop/bibop_rb.h"
-#include "bibop/bibop_other.h"
+#include "bitmap/bitmap.h"
+#include "bitmap/bitmap_rb.h"
+#include "bitmap/bitmap_other.h"
 
 #ifdef HAVE_LOCKS
 #include <pthread.h>
 #endif /* HAVE_LOCKS */
 
-/** Frees the memory block inside of a specific BiBoP organized raw block.
+/** Frees the memory block inside of a specific bitmap-organized raw block.
  * @param raw_block The pointer of the raw block.
  * @param ptr       The pointer of the memory block to be freed.
  */
-void bibop_free(raw_block_header_t *raw_block, void *ptr) {
-    bibop_rb_t *rb_header;
+void bitmap_free(raw_block_header_t *raw_block, void *ptr) {
+    bitmap_rb_t *rb_header;
     chunk_header_t *chunk_header;
     size_t cells_used, cell_no, bmap_index, start_pos;
     BMAP_EL_TYPE mask1, mask2;
 
-    rb_header = (bibop_rb_t *)((char *)raw_block + sizeof(raw_block_header_t));
+    rb_header = (bitmap_rb_t *)((char *)raw_block + sizeof(raw_block_header_t));
     chunk_header = (chunk_header_t *)((char *)ptr - sizeof(chunk_header_t));
 
 #ifdef HAVE_LOCKS
@@ -49,7 +49,7 @@ void bibop_free(raw_block_header_t *raw_block, void *ptr) {
 
     cells_used = chunk_header->num_of_cells;
 
-    cell_no = ((char *)chunk_header - ((char *)rb_header + sizeof(bibop_rb_t)))
+    cell_no = ((char *)chunk_header - ((char *)rb_header + sizeof(bitmap_rb_t)))
         / rb_header->bytes_per_cell;
 
     bmap_index = cell_no / BMAP_EL_SIZE_BITS;

+ 9 - 9
src/bibop/bibop_malloc.c

@@ -16,36 +16,36 @@
  */
 
 /**
- * @file   bibop_malloc.c
+ * @file   bitmap_malloc.c
  * @author Ilias Pliotas, Ioannis Koutras
  * @date   September, 2012
- * @brief  malloc() implementation for BiBoP raw blocks
+ * @brief  malloc() implementation for bitmap-organized raw blocks
  */
 
-#include "bibop/bibop_malloc.h"
-#include "bibop/bibop_rb.h"
-#include "bibop/bibop_other.h"
+#include "bitmap/bitmap.h"
+#include "bitmap/bitmap_rb.h"
+#include "bitmap/bitmap_other.h"
 
 #ifdef HAVE_LOCKS
 #include <pthread.h>
 #endif /* HAVE_LOCKS */
 
 /**
- * Returns a memory block from a BiBoP-organized raw block
+ * Returns a memory block from a bitmap-organized raw block
  *
  * @param  raw_block The pointer of the raw block.
  * @param  req_size  The requested memory size.
  * @retval           The address to serve the request.
  * @retval NULL      No available memory space.
  */
-void * bibop_malloc(raw_block_header_t *raw_block, size_t req_size) { 
-    bibop_rb_t *rb_header;
+void * bitmap_malloc(raw_block_header_t *raw_block, size_t req_size) { 
+    bitmap_rb_t *rb_header;
     size_t cells, stop, i, found;
     void *ret;
     BMAP_EL_TYPE mask1, mask2;
     chunk_header_t *chunk_address;
 
-    rb_header = (bibop_rb_t *)((char *)raw_block + sizeof(raw_block_header_t));
+    rb_header = (bitmap_rb_t *)((char *)raw_block + sizeof(raw_block_header_t));
 
     ret = NULL;
 

+ 3 - 3
src/bibop/bibop_other.c

@@ -16,13 +16,13 @@
  */
 
 /**
- * @file   bibop_other.c
+ * @file   bitmap_other.c
  * @author Ilias Pliotas, Ioannis Koutras
  * @date   September, 2012
- * @brief  Helping functions for BiBoP raw blocks
+ * @brief  Helping functions for bitmap-organized raw blocks
  */
 
-#include "bibop/bibop_other.h"
+#include "bitmap/bitmap_other.h"
 
 /** Copy the elements of one bitmap array to another.
  *

+ 7 - 7
src/dmmlib.c

@@ -27,10 +27,10 @@
 #ifdef FL_RB_ONLY
 #include "freelist/freelist_malloc.h"
 #endif /* FL_RB_ONLY */
-#ifdef BIBOP_RB_ONLY
-#include "bibop/bibop_malloc.h"
-#include "bibop/bibop_rb.h"
-#endif /* BIBOP_RB_ONLY */
+#ifdef BITMAP_RB_ONLY
+#include "bitmap/bitmap.h"
+#include "bitmap/bitmap_rb.h"
+#endif /* BITMAP_RB_ONLY */
 #include <stdbool.h>
 #include <string.h> /* for memset() */
 
@@ -57,10 +57,10 @@ void * malloc(size_t size) {
         allocation_size = size + sizeof(raw_block_header_t) +
             sizeof(freelist_rb_t);
 #endif /* FL_RB_ONLY */
-#ifdef BIBOP_RB_ONLY
+#ifdef BITMAP_RB_ONLY
         allocation_size = size + sizeof(raw_block_header_t) +
-            sizeof(bibop_rb_t);
-#endif /* BIBOP_RB_ONLY */
+            sizeof(bitmap_rb_t);
+#endif /* BITMAP_RB_ONLY */
 
         if(allocation_size < SYS_ALLOC_SIZE) {
             allocation_size = SYS_ALLOC_SIZE;

+ 10 - 10
src/raw_block.c

@@ -24,9 +24,9 @@
 #ifdef FL_RB_ONLY
 #include "freelist/freelist_rb.h"
 #endif /* FL_RB_ONLY */
-#ifdef BIBOP_RB_ONLY
-#include "bibop/bibop_rb.h"
-#endif /* BIBOP_RB_ONLY */
+#ifdef BITMAP_RB_ONLY
+#include "bitmap/bitmap_rb.h"
+#endif /* BITMAP_RB_ONLY */
 
 raw_block_header_t *create_new_raw_block(size_t raw_block_size) {
     void *ptr;
@@ -47,17 +47,17 @@ raw_block_header_t *create_new_raw_block(size_t raw_block_size) {
     fl_rb->free_list_head = NULL;
 #endif /* FL_RB_ONLY */
 
-#ifdef BIBOP_RB_ONLY
-    bibop_rb_t *bibop_rb;
-    bibop_rb = (bibop_rb_t *)((char *)ptr + sizeof(raw_block_header_t));
-    bibop_rb->bytes_per_cell = (raw_block_size - sizeof(raw_block_header_t) -
-        sizeof(bibop_rb_t)) / (BMAP_INDEX_NUM * BMAP_EL_SIZE_BITS);
+#ifdef BITMAP_RB_ONLY
+    bitmap_rb_t *bitmap_rb;
+    bitmap_rb = (bitmap_rb_t *)((char *)ptr + sizeof(raw_block_header_t));
+    bitmap_rb->bytes_per_cell = (raw_block_size - sizeof(raw_block_header_t) -
+        sizeof(bitmap_rb_t)) / (BMAP_INDEX_NUM * BMAP_EL_SIZE_BITS);
     for(int i = 0; i < BMAP_INDEX_NUM; i++) {
         // initialize for 32 bit bmap elements,
         // should be 0xFFFFFFFFFFFFFFFF for 64 bit bmap elements
-        bibop_rb->bmap_array[i] = 0xFFFFFFFF;
+        bitmap_rb->bmap_array[i] = 0xFFFFFFFF;
     }
-#endif /* BIBOP_RB_ONLY */
+#endif /* BITMAP_RB_ONLY */
 
 #ifdef HAVE_LOCKS
     pthread_mutex_init(&((raw_block_header_t *)ptr)->mutex, NULL);