Update NEWS for 1.6.22
[pkg-k5-afs_openafs.git] / src / mcas / osi_mcas_obj_cache.c
blobf1c269aab49555913d6dab016d77dac8b75f69a9
1 #include "osi_mcas_obj_cache.h"
2 #include <osi/osi_includes.h>
3 #include <osi/osi_types.h>
4 #include <afs/afsutil.h>
6 void
7 osi_mcas_obj_cache_create(osi_mcas_obj_cache_t * gc_id, size_t size,
8 char *tag)
10 ViceLog(7,
11 ("osi_mcas_obj_cache_create: size, adjsize %d\n", size,
12 size + sizeof(int *)));
14 *(int *)gc_id = gc_add_allocator(size + sizeof(int *), tag);
17 void gc_trace(int alloc_id);
18 int gc_get_tag(int alloc_id);
19 int gc_get_blocksize(int alloc_id);
21 void *
22 osi_mcas_obj_cache_alloc(osi_mcas_obj_cache_t gc_id)
24 ptst_t *ptst;
25 void *obj;
27 ptst = critical_enter();
28 obj = (void *)gc_alloc(ptst, gc_id);
29 critical_exit(ptst);
31 ViceLog(11,
32 ("GC: osi_mcas_obj_cache_alloc: block of size %d "
33 #if OSI_DATAMODEL_IS(OSI_ILP32_ENV)
34 "0x%lx"
35 #else
36 "0x%llx"
37 #endif
38 " (%s)\n",
39 gc_get_blocksize(gc_id),
40 obj,
41 gc_get_tag(gc_id)));
43 return (obj);
46 void
47 osi_mcas_obj_cache_free(osi_mcas_obj_cache_t gc_id, void *obj)
49 ptst_t *ptst;
51 ViceLog(11,
52 ("GC: osi_mcas_obj_cache_free: block of size %d "
53 #if OSI_DATAMODEL_IS(OSI_ILP32_ENV)
54 "0x%lx"
55 #else
56 "0x%llx"
57 #endif
58 " (%s)\n",
59 gc_get_blocksize(gc_id),
60 obj,
61 gc_get_tag(gc_id)));
63 ptst = critical_enter();
64 gc_free(ptst, (void *)obj, gc_id);
65 critical_exit(ptst);
68 void
69 osi_mcas_obj_cache_destroy(osi_mcas_obj_cache_t gc_id)
71 /* TODO: implement, will need to implement gc_remove_allocator and related
72 * modifications in gc.c */
73 return;