#pragma once #include #include "backing.h" // @TODO: // - cch_backing_remove_range(). // - Report overlap, don't unlock in backing_write() and handle fill in handler. AL_IGNORE_WARNING("-Wunused-function") 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_IGNORE_WARNING_END