Lines Matching refs:append
37 struct memobj_append *append = (struct memobj_append*) memobj;
47 if (append->vregion) {
51 append->vregion = vregion;
64 struct memobj_append *append = (struct memobj_append*) memobj;
67 if (append->vregion != vregion) {
83 append->vregion = NULL;
103 struct memobj_append *append = (struct memobj_append *) memobj;
120 } else if (offset == 0 && range > append->offsets[append->first_free_frame-1]) {
122 for (int i = 0; i < append->first_free_frame && range; i++) {
123 size_t fsize = append->frame_sizes[i];
130 err = invoke_frame_modify_flags(append->frames[i], 0,
145 int imax = append->first_free_frame - 1;
151 genvaddr_t mid_offset = append->offsets[imid];
169 first_idx < append->first_free_frame && append->offsets[first_idx] < offset;
177 for (int i = 0; i < append->first_free_frame; i++) {
178 debug_printf("offsets[%d] = %"PRIxGENVADDR"\n", i, append->offsets[i]);
181 append->offsets[first_idx], first_idx < append->first_free_frame-1 ? append->offsets[first_idx+1] : 0x0);
185 size_t fsize = append->frame_sizes[first_idx] - (offset - append->offsets[first_idx]);
192 err = invoke_frame_modify_flags(append->frames[i], 0,
255 struct memobj_append *append = (struct memobj_append*) memobj;
257 size_t slot = append->first_free_frame;
258 assert(slot <= append->frame_count);
261 if (offset > 0 && offset < append->offsets[slot-1]) {
265 if (slot == append->frame_count) {
267 size_t new_count = append->frame_count * 2;
268 void *f = realloc(append->frames, new_count * sizeof(struct capref));
269 void *o = realloc(append->offsets, new_count * sizeof(genvaddr_t));
270 void *s = realloc(append->frame_sizes, new_count * sizeof(size_t));
271 void *fo = realloc(append->frame_offsets, new_count * sizeof(size_t));
275 append->frames = f;
276 append->offsets = o;
277 append->frame_sizes = s;
278 append->frame_offsets = fo;
279 memset(&append->frames[append->first_free_frame],
280 0, append->frame_count * sizeof(struct capref));
281 memset(&append->offsets[append->first_free_frame],
282 0, append->frame_count * sizeof(genvaddr_t));
283 memset(&append->frame_sizes[append->first_free_frame],
284 0, append->frame_count * sizeof(size_t));
285 memset(&append->frame_offsets[append->first_free_frame],
286 0, append->frame_count * sizeof(size_t));
287 append->frame_count = new_count;
290 if (!capref_is_null((append->frames[slot]))) {
298 append->frames[slot] = frame;
299 append->offsets[slot] = offset;
300 append->frame_sizes[slot] = fi.bytes;
301 append->frame_offsets[slot] = frame_offset;
302 append->first_free_frame++;
341 struct memobj_append *append = (struct memobj_append*) memobj;
344 assert(offset == append->already_faulted);
346 size_t first_unfaulted = append->first_unfaulted;
348 if (capref_is_null(append->frames[first_unfaulted])) {
360 err = pmap->f.map(pmap, base + offset, append->frames[first_unfaulted],
361 append->frame_offsets[first_unfaulted],
362 append->frame_sizes[first_unfaulted], flags,
368 append->first_unfaulted++;
369 append->already_faulted += retsize;
402 errval_t memobj_create_append(struct memobj_append *append,
406 struct memobj *memobj = &append->m;
425 append->vregion = NULL;
428 size_t count = append->frame_count = INIT_FRAME_COUNT;
429 append->first_free_frame = 0;
430 append->first_unfaulted = 0;
432 append->frames = malloc(count * sizeof(struct capref));
433 if (!append->frames) {
436 memset(append->frames, 0, count * sizeof(struct capref));
438 append->offsets = malloc(count * sizeof(genvaddr_t));
439 if (!append->offsets) {
440 free(append->frames);
443 memset(append->offsets, 0, count * sizeof(genvaddr_t));
445 append->frame_sizes = malloc(count * sizeof(size_t));
446 if (!append->frame_sizes) {
447 free(append->frames);
448 free(append->offsets);
451 memset(append->frame_sizes, 0, count * sizeof(size_t));
453 append->frame_offsets = malloc(count * sizeof(size_t));
454 if (!append->frame_offsets) {
455 free(append->frames);
456 free(append->offsets);
457 free(append->frame_sizes);
460 memset(append->frame_offsets, 0, count * sizeof(size_t));