typedef struct Context Context;
struct Window {
- MMapCache *cache;
+ MMapFileDescriptor *fd;
bool invalidated:1;
bool keep_always:1;
uint64_t offset;
size_t size;
- MMapFileDescriptor *fd;
-
- LIST_FIELDS(Window, by_fd);
+ LIST_FIELDS(Window, windows);
LIST_FIELDS(Window, unused);
LIST_HEAD(Context, contexts);
c->window = NULL;
}
- return LIST_REMOVE(by_fd, w->fd->windows, w);
+ return LIST_REMOVE(windows, w->fd->windows, w);
}
static void window_invalidate(Window *w) {
return NULL;
window_unlink(w);
- w->cache->n_windows--;
+ w->fd->cache->n_windows--;
return mfree(w);
}
w = window_unlink(m->last_unused);
*w = (Window) {
- .cache = m,
.fd = f,
.offset = offset,
.size = size,
.ptr = ptr,
};
- return LIST_PREPEND(by_fd, f->windows, w);
+ return LIST_PREPEND(windows, f->windows, w);
}
static void context_detach_window(MMapCache *m, Context *c) {
context_detach_window(m, c);
/* Search for a matching mmap */
- LIST_FOREACH(by_fd, i, f->windows)
+ LIST_FOREACH(windows, i, f->windows)
if (window_matches(i, f, offset, size)) {
m->n_window_list_hit++;
w = i;
ours = false;
HASHMAP_FOREACH(f, m->fds) {
- LIST_FOREACH(by_fd, w, f->windows) {
+ LIST_FOREACH(windows, w, f->windows) {
if ((uint8_t*) addr >= (uint8_t*) w->ptr &&
(uint8_t*) addr < (uint8_t*) w->ptr + w->size) {
found = ours = f->sigbus = true;
if (!f->sigbus)
continue;
- LIST_FOREACH(by_fd, w, f->windows)
+ LIST_FOREACH(windows, w, f->windows)
window_invalidate(w);
}
}