blob: 603117e6093de4fc16590b888eea180435ce34b3 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
|
#include <al/types.h>
#include "backing.h"
AL_UNUSED_FUNCTION_PUSH
// TODO: cch_backing_remove_range.
//
// TODO: report overlap, don't unlock in backing_write() and handle fill in handler
static void cch_backing_fill_range(struct cch_backing *backing, off_t index, off_t size)
{
struct cch_range *range;
al_array_foreach_ptr(backing->available, i, range) {
if (index >= range->start && index <= range->end) {
range->end = MAX(index + size, range->end);
return;
}
}
al_array_push(backing->available, ((struct cch_range){ index, index + size }));
}
AL_UNUSED_FUNCTION_POP
|