• Home
  • Raw
  • Download

Lines Matching refs:dsh

31 	lws_dsh_t	*dsh;  member
38 _lws_dsh_alloc_tail(lws_dsh_t *dsh, int kind, const void *src1, size_t size1,
57 lws_dsh_t *dsh; in lws_dsh_create() local
65 dsh = lws_malloc(sizeof(lws_dsh_t) + buf_len + oha_len, __func__); in lws_dsh_create()
66 if (!dsh) in lws_dsh_create()
71 dsh->oha = (lws_dsh_obj_head_t *)&dsh[1]; in lws_dsh_create()
72 dsh->buf = ((uint8_t *)dsh->oha) + oha_len; in lws_dsh_create()
73 dsh->count_kinds = count_kinds; in lws_dsh_create()
74 dsh->buffer_size = buf_len; in lws_dsh_create()
75 dsh->being_destroyed = 0; in lws_dsh_create()
79 memset(dsh->oha, 0, oha_len); in lws_dsh_create()
81 dsh->oha[n].kind = n; in lws_dsh_create()
82 dsh->oha[n].total_size = 0; in lws_dsh_create()
87 obj = (lws_dsh_obj_t *)dsh->buf; in lws_dsh_create()
91 lws_dll2_add_head(&obj->list, &dsh->oha[0].owner); in lws_dsh_create()
93 dsh->locally_free = obj->asize; in lws_dsh_create()
94 dsh->locally_in_use = 0; in lws_dsh_create()
96 lws_dll2_clear(&dsh->list); in lws_dsh_create()
98 lws_dll2_add_head(&dsh->list, owner); in lws_dsh_create()
102 return dsh; in lws_dsh_create()
117 s->dsh = s->this_dsh; in search_best_free()
126 lws_dsh_t *dsh = *pdsh; in lws_dsh_destroy() local
128 if (!dsh) in lws_dsh_destroy()
131 dsh->being_destroyed = 1; in lws_dsh_destroy()
133 lws_dll2_remove(&dsh->list); in lws_dsh_destroy()
141 lws_dsh_get_size(struct lws_dsh *dsh, int kind) in lws_dsh_get_size() argument
144 assert(kind < dsh->count_kinds); in lws_dsh_get_size()
146 return dsh->oha[kind].total_size; in lws_dsh_get_size()
150 _lws_dsh_alloc_tail(lws_dsh_t *dsh, int kind, const void *src1, size_t size1, in _lws_dsh_alloc_tail() argument
158 assert(!dsh || kind < dsh->count_kinds); in _lws_dsh_alloc_tail()
168 s.this_dsh = dsh; in _lws_dsh_alloc_tail()
170 if (dsh && !dsh->being_destroyed) in _lws_dsh_alloc_tail()
171 lws_dll2_foreach_safe(&dsh->oha[0].owner, &s, search_best_free); in _lws_dsh_alloc_tail()
191 s.best->dsh = s.dsh; in _lws_dsh_alloc_tail()
207 if (dsh) { in _lws_dsh_alloc_tail()
209 lws_dll2_add_tail(&s.best->list, &dsh->oha[kind].owner); in _lws_dsh_alloc_tail()
212 assert(s.dsh->locally_free >= s.best->asize); in _lws_dsh_alloc_tail()
213 s.dsh->locally_free -= s.best->asize; in _lws_dsh_alloc_tail()
214 s.dsh->locally_in_use += s.best->asize; in _lws_dsh_alloc_tail()
215 dsh->oha[kind].total_size += s.best->asize; in _lws_dsh_alloc_tail()
216 assert(s.dsh->locally_in_use <= s.dsh->buffer_size); in _lws_dsh_alloc_tail()
237 obj->dsh = s.dsh; in _lws_dsh_alloc_tail()
255 if (dsh) { in _lws_dsh_alloc_tail()
257 lws_dll2_add_tail(&obj->list, &dsh->oha[kind].owner); in _lws_dsh_alloc_tail()
260 assert(s.dsh->locally_free >= asize); in _lws_dsh_alloc_tail()
261 s.dsh->locally_free -= asize; in _lws_dsh_alloc_tail()
262 s.dsh->locally_in_use += asize; in _lws_dsh_alloc_tail()
263 dsh->oha[kind].total_size += asize; in _lws_dsh_alloc_tail()
264 assert(s.dsh->locally_in_use <= s.dsh->buffer_size); in _lws_dsh_alloc_tail()
273 lws_dsh_alloc_tail(lws_dsh_t *dsh, int kind, const void *src1, size_t size1, in lws_dsh_alloc_tail() argument
276 return _lws_dsh_alloc_tail(dsh, kind, src1, size1, src2, size2, NULL); in lws_dsh_alloc_tail()
290 lws_dsh_t *dsh = _o->dsh; in lws_dsh_free() local
303 assert(dsh->locally_in_use >= _o->asize); in lws_dsh_free()
304 dsh->locally_free += _o->asize; in lws_dsh_free()
305 dsh->locally_in_use -= _o->asize; in lws_dsh_free()
306 dsh->oha[_o->kind].total_size -= _o->asize; /* account for usage by kind */ in lws_dsh_free()
307 assert(dsh->locally_in_use <= dsh->buffer_size); in lws_dsh_free()
316 lws_dll2_add_sorted(&_o->list, &_o->dsh->oha[0].owner, buf_compare); in lws_dsh_free()
358 lws_dsh_get_head(lws_dsh_t *dsh, int kind, void **obj, size_t *size) in lws_dsh_get_head() argument
362 if (!dsh) in lws_dsh_get_head()
365 _obj = (lws_dsh_obj_t *)lws_dll2_get_head(&dsh->oha[kind + 1].owner); in lws_dsh_get_head()
392 obj->dsh, obj->size, obj->asize); in describe_kind()
398 lws_dsh_describe(lws_dsh_t *dsh, const char *desc) in lws_dsh_describe() argument
403 __func__, dsh, dsh->buffer_size, dsh->count_kinds, in lws_dsh_describe()
404 dsh->locally_free, dsh->locally_in_use, desc); in lws_dsh_describe()
406 for (n = 0; n < dsh->count_kinds; n++) { in lws_dsh_describe()
408 lws_dll2_foreach_safe(&dsh->oha[n].owner, dsh, describe_kind); in lws_dsh_describe()