2007-04-26 03:41:24 +00:00
|
|
|
/*
|
|
|
|
* Copyright 2007, Hugo Santos. All Rights Reserved.
|
|
|
|
* Distributed under the terms of the MIT License.
|
|
|
|
*
|
|
|
|
* Authors:
|
|
|
|
* Hugo Santos, hugosantos@gmail.com
|
|
|
|
*/
|
|
|
|
#ifndef _SLAB_DEPOT_H_
|
|
|
|
#define _SLAB_DEPOT_H_
|
|
|
|
|
|
|
|
#include <lock.h>
|
2007-04-28 21:35:23 +00:00
|
|
|
#include <KernelExport.h>
|
2007-04-26 03:41:24 +00:00
|
|
|
|
|
|
|
#ifdef __cplusplus
|
|
|
|
extern "C" {
|
|
|
|
#endif
|
|
|
|
|
2007-04-28 21:35:23 +00:00
|
|
|
typedef struct object_depot {
|
2007-04-26 03:41:24 +00:00
|
|
|
benaphore lock;
|
2007-04-28 18:53:58 +00:00
|
|
|
struct depot_magazine *full, *empty;
|
2007-04-26 03:41:24 +00:00
|
|
|
size_t full_count, empty_count;
|
2007-04-28 18:53:58 +00:00
|
|
|
struct depot_cpu_store *stores;
|
2007-04-26 03:41:24 +00:00
|
|
|
|
2007-04-28 21:35:23 +00:00
|
|
|
void (*return_object)(struct object_depot *depot, void *object);
|
|
|
|
} object_depot;
|
2007-04-26 03:41:24 +00:00
|
|
|
|
2007-04-28 18:53:58 +00:00
|
|
|
|
2007-04-29 02:23:37 +00:00
|
|
|
status_t object_depot_init(object_depot *depot, uint32 flags,
|
2007-04-28 21:35:23 +00:00
|
|
|
void (*return_object)(object_depot *, void *));
|
|
|
|
void object_depot_destroy(object_depot *depot);
|
2007-04-28 18:53:58 +00:00
|
|
|
|
2007-04-28 21:35:23 +00:00
|
|
|
void *object_depot_obtain(object_depot *depot);
|
|
|
|
int object_depot_store(object_depot *depot, void *object);
|
2007-04-26 03:41:24 +00:00
|
|
|
|
2007-04-28 21:35:23 +00:00
|
|
|
void object_depot_make_empty(object_depot *depot);
|
2007-04-26 03:41:24 +00:00
|
|
|
|
|
|
|
#ifdef __cplusplus
|
|
|
|
}
|
|
|
|
#endif
|
|
|
|
|
|
|
|
#endif
|