diff options
author | Vito Caputo <vito.caputo@coreos.com> | 2016-02-05 02:43:00 -0800 |
---|---|---|
committer | Vito Caputo <vito.caputo@coreos.com> | 2016-02-05 07:43:42 -0800 |
commit | 6a49149028ded22d5eec6d96314a78ed4e8c79b0 (patch) | |
tree | 1e514cd7b3e434ce39f860c7789fe4409690e26a /src/journal | |
parent | 784b22eef5005309a43400e9ab43d37281b1290c (diff) |
journal: move window initialization to window_add
Diffstat (limited to 'src/journal')
-rw-r--r-- | src/journal/mmap-cache.c | 23 |
1 files changed, 12 insertions, 11 deletions
diff --git a/src/journal/mmap-cache.c b/src/journal/mmap-cache.c index a69672ce21..0a10fe36cc 100644 --- a/src/journal/mmap-cache.c +++ b/src/journal/mmap-cache.c @@ -173,10 +173,11 @@ _pure_ static bool window_matches(Window *w, int fd, int prot, uint64_t offset, offset + size <= w->offset + w->size; } -static Window *window_add(MMapCache *m) { +static Window *window_add(MMapCache *m, FileDescriptor *fd, int prot, bool keep_always, uint64_t offset, size_t size, void *ptr) { Window *w; assert(m); + assert(fd); if (!m->last_unused || m->n_windows <= WINDOWS_MIN) { @@ -194,6 +195,15 @@ static Window *window_add(MMapCache *m) { } w->cache = m; + w->fd = fd; + w->prot = prot; + w->keep_always = keep_always; + w->offset = offset; + w->size = size; + w->ptr = ptr; + + LIST_PREPEND(by_fd, fd->windows, w); + return w; } @@ -534,19 +544,10 @@ static int add_mmap( if (!f) goto outofmem; - w = window_add(m); + w = window_add(m, f, prot, keep_always, woffset, wsize, d); if (!w) goto outofmem; - w->keep_always = keep_always; - w->ptr = d; - w->offset = woffset; - w->prot = prot; - w->size = wsize; - w->fd = f; - - LIST_PREPEND(by_fd, f->windows, w); - context_detach_window(c); c->window = w; LIST_PREPEND(by_window, w->contexts, c); |