mirror of
https://github.com/systemd/systemd-stable.git
synced 2025-01-22 22:03:43 +03:00
journal: fix boolean handling in MMapCache
Let's use bitfields for our booleans, and don't try to apply binary OR or addition on them, because that's weird and we should instead use logical OR only.
This commit is contained in:
parent
1411b09467
commit
739731cdac
@ -40,9 +40,9 @@ typedef struct FileDescriptor FileDescriptor;
|
||||
struct Window {
|
||||
MMapCache *cache;
|
||||
|
||||
bool invalidated;
|
||||
bool keep_always;
|
||||
bool in_unused;
|
||||
bool invalidated:1;
|
||||
bool keep_always:1;
|
||||
bool in_unused:1;
|
||||
|
||||
int prot;
|
||||
void *ptr;
|
||||
@ -78,7 +78,6 @@ struct MMapCache {
|
||||
|
||||
unsigned n_hit, n_missed;
|
||||
|
||||
|
||||
Hashmap *fds;
|
||||
Context *contexts[MMAP_CACHE_MAX_CONTEXTS];
|
||||
|
||||
@ -408,7 +407,7 @@ static int try_context(
|
||||
if (c->window->fd->sigbus)
|
||||
return -EIO;
|
||||
|
||||
c->window->keep_always |= keep_always;
|
||||
c->window->keep_always = c->window->keep_always || keep_always;
|
||||
|
||||
*ret = (uint8_t*) c->window->ptr + (offset - c->window->offset);
|
||||
return 1;
|
||||
@ -454,7 +453,7 @@ static int find_mmap(
|
||||
return -ENOMEM;
|
||||
|
||||
context_attach_window(c, w);
|
||||
w->keep_always += keep_always;
|
||||
w->keep_always = w->keep_always || keep_always;
|
||||
|
||||
*ret = (uint8_t*) w->ptr + (offset - w->offset);
|
||||
return 1;
|
||||
|
Loading…
x
Reference in New Issue
Block a user