Lines Matching full:region

2  * region.c --- code which manages allocations within a region.
38 region_t region; in region_create() local
40 region = malloc(sizeof(struct region_struct)); in region_create()
41 if (!region) in region_create()
43 memset(region, 0, sizeof(struct region_struct)); in region_create()
44 region->min = min; in region_create()
45 region->max = max; in region_create()
46 region->last = NULL; in region_create()
47 return region; in region_create()
50 void region_free(region_t region) in region_free() argument
54 for (r = region->allocated; r; r = next) { in region_free()
58 memset(region, 0, sizeof(struct region_struct)); in region_free()
59 free(region); in region_free()
62 int region_allocate(region_t region, region_addr_t start, int n) in region_allocate() argument
68 if ((start < region->min) || (end > region->max)) in region_allocate()
73 if (region->last && region->last->end == start && in region_allocate()
74 !region->last->next) { in region_allocate()
75 region->last->end = end; in region_allocate()
78 if (region->last && start > region->last->end && in region_allocate()
79 !region->last->next) { in region_allocate()
81 prev = region->last; in region_allocate()
88 * 1; if we can find an existing region which we can grow, do in region_allocate()
90 * insert a new region element into the linked list. in region_allocate()
92 for (r = region->allocated, prev=NULL; r; prev = r, r = r->next) { in region_allocate()
110 region->last = r; in region_allocate()
121 * Insert a new region element structure into the linked list in region_allocate()
131 region->last = new_region; in region_allocate()
135 region->allocated = new_region; in region_allocate()
176 void region_print(region_t region, FILE *f) in region_print() argument
181 fprintf(f, "Printing region (min=%llu. max=%llu)\n\t", region->min, in region_print()
182 region->max); in region_print()
183 for (r = region->allocated; r; r = r->next) { in region_print()
205 printf("Creating region with args(%llu, %llu)\n", in main()
209 fprintf(stderr, "Couldn't create region.\n"); in main()