32 void *find_segment_name(
const struct shm_arena *a,
33 const char *name,
size_t *user_size)
43 seg = get_seg_header(a, map_num, offset);
49 seg_name = get_seg_name(seg);
50 cmp = strcmp(name, seg_name);
59 return get_seg_ptr(seg);
68 const char *name, mapnum_t *mapnum)
80 seg = get_seg_header(a, map_num, offset);
86 seg_name = get_seg_name(seg);
87 cmp = strcmp(name, seg_name);
109 size_t size, mapnum_t *ret_mapnum)
113 int prev_mapnum = -1, mapnum;
120 seg = get_seg_header(a, mapnum, a_hdr->
free_offset);
126 len = seg->
length * CHUNK;
131 prev_mapnum = mapnum;
146 *ret_mapnum = prev_mapnum;
151 *ret_mapnum = mapnum;
161 height_t left_ht, right_ht;
167 left_ht = seg ? seg->
height : -1;
170 right_ht = seg ? seg->
height : -1;
172 return (left_ht - right_ht);
178 *_shm_check_free_segment(
const struct shm_arena *a,
179 mapnum_t mapnum, offset_t offset);
181 typedef int (*compare_func_t)(
const struct seg_header *, mapnum_t, offset_t,
182 const struct seg_header *, mapnum_t, offset_t);
185 int _shm_compare_free(
const struct seg_header *hdr1, mapnum_t mapnum1, offset_t top1,
186 const struct seg_header *hdr0, mapnum_t mapnum0, offset_t top0);
188 int _shm_compare_allocated(
const struct seg_header *hdr1,
196 void _shm_insert_node(
const struct shm_arena *a,
198 mapnum_t *parent_mapnum, offset_t *parent_offset,
199 compare_func_t compare_func);
214 ASSERT(get_seg_footer(seg)->
flags & IS_FREE);
230 _shm_insert_node(a, seg, mapnum,
248 ASSERT(!(get_seg_footer(seg)->
flags & IS_FREE));
267 _shm_insert_node(a, seg, mapnum,
269 _shm_compare_allocated);
struct arena_header * header
struct shm_mapping * mapping