Rev 1428 | Rev 1702 | Go to most recent revision | Show entire file | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed
| Rev 1428 | Rev 1576 | ||
|---|---|---|---|
| Line 76... | Line 76... | ||
| 76 | typedef struct { |
76 | typedef struct { |
| 77 | char *name; |
77 | char *name; |
| 78 | 78 | ||
| 79 | link_t link; |
79 | link_t link; |
| 80 | /* Configuration */ |
80 | /* Configuration */ |
| 81 | size_t size; /**< Size of SLAB position - align_up(sizeof(obj)) */ |
81 | size_t size; /**< Size of slab position - align_up(sizeof(obj)) */ |
| 82 | int (*constructor)(void *obj, int kmflag); |
82 | int (*constructor)(void *obj, int kmflag); |
| 83 | int (*destructor)(void *obj); |
83 | int (*destructor)(void *obj); |
| 84 | int flags; /**< Flags changing behaviour of cache */ |
84 | int flags; /**< Flags changing behaviour of cache */ |
| 85 | 85 | ||
| 86 | /* Computed values */ |
86 | /* Computed values */ |
| Line 89... | Line 89... | ||
| 89 | 89 | ||
| 90 | /* Statistics */ |
90 | /* Statistics */ |
| 91 | atomic_t allocated_slabs; |
91 | atomic_t allocated_slabs; |
| 92 | atomic_t allocated_objs; |
92 | atomic_t allocated_objs; |
| 93 | atomic_t cached_objs; |
93 | atomic_t cached_objs; |
| 94 | atomic_t magazine_counter; /*<< How many magazines in magazines list */ |
94 | atomic_t magazine_counter; /**< How many magazines in magazines list */ |
| 95 | 95 | ||
| 96 | /* Slabs */ |
96 | /* Slabs */ |
| 97 | link_t full_slabs; /**< List of full slabs */ |
97 | link_t full_slabs; /**< List of full slabs */ |
| 98 | link_t partial_slabs; /**< List of partial slabs */ |
98 | link_t partial_slabs; /**< List of partial slabs */ |
| 99 | SPINLOCK_DECLARE(slablock); |
99 | SPINLOCK_DECLARE(slablock); |
| Line 115... | Line 115... | ||
| 115 | 115 | ||
| 116 | extern void * slab_alloc(slab_cache_t *cache, int flags); |
116 | extern void * slab_alloc(slab_cache_t *cache, int flags); |
| 117 | extern void slab_free(slab_cache_t *cache, void *obj); |
117 | extern void slab_free(slab_cache_t *cache, void *obj); |
| 118 | extern count_t slab_reclaim(int flags); |
118 | extern count_t slab_reclaim(int flags); |
| 119 | 119 | ||
| 120 | /** Initialize SLAB subsytem */ |
120 | /** Initialize slab subsytem */ |
| 121 | extern void slab_cache_init(void); |
121 | extern void slab_cache_init(void); |
| 122 | extern void slab_enable_cpucache(void); |
122 | extern void slab_enable_cpucache(void); |
| 123 | 123 | ||
| 124 | /* KConsole debug */ |
124 | /* kconsole debug */ |
| 125 | extern void slab_print_list(void); |
125 | extern void slab_print_list(void); |
| 126 | 126 | ||
| 127 | /* Malloc support */ |
127 | /* malloc support */ |
| 128 | extern void * malloc(unsigned int size, int flags); |
128 | extern void * malloc(unsigned int size, int flags); |
| 129 | extern void free(void *obj); |
129 | extern void free(void *obj); |
| 130 | #endif |
130 | #endif |