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