diff options
author | Vito Caputo <vcaputo@pengaru.com> | 2021-09-03 15:59:53 -0700 |
---|---|---|
committer | Vito Caputo <vcaputo@pengaru.com> | 2021-09-03 16:13:29 -0700 |
commit | 473f9ed67cfe73ea6ea998abc8762df3e51b54da (patch) | |
tree | 94403a2cd408e2515c9424eb75ee24f2d74a26b4 /src/journals.h | |
parent | 2d8d2b3e71083001066483fcbb33a593b1b9e6a7 (diff) |
journals: privatize everything bufs added
This turns journal_t into a member of a new private _journal_t,
everything bufs-related resides in the outer _journal_t, and the
public journals API only passes around the journal_t member
pointer. The usual PIMPL in C paradigm; requires some
container_of() hoop-jumping in the journals.c code to compute the
private address from the public.
Diffstat (limited to 'src/journals.h')
-rw-r--r-- | src/journals.h | 22 |
1 files changed, 3 insertions, 19 deletions
diff --git a/src/journals.h b/src/journals.h index 1327a5e..a4ad97d 100644 --- a/src/journals.h +++ b/src/journals.h @@ -13,29 +13,13 @@ #include "upstream/journal-def.h" -/* TODO: the journal buf stuff should be made private to journals.c */ -#define JOURNAL_BUF_SIZE 8192 -#define JOURNAL_BUF_CNT 8 - typedef struct iou_t iou_t; typedef struct journals_t journals_t; -typedef struct journal_t journal_t; -typedef struct journal_buf_t journal_buf_t; - -struct journal_buf_t { - journal_buf_t *lru_prev, *lru_next; - uint64_t offset, length; - unsigned valid:1; - int idx; - uint8_t data[JOURNAL_BUF_SIZE]; -}; - -struct journal_t { + +typedef struct journal_t { char *name; int fd, idx; - journal_buf_t *lru_head, *lru_tail; - journal_buf_t bufs[JOURNAL_BUF_CNT]; -}; +} journal_t; THUNK_DECLARE(journals_open, iou_t *, iou, char **, machid, int, flags, journals_t **, journals, thunk_t *, closure); THUNK_DECLARE(journal_get_header, iou_t *, iou, journal_t **, journal, Header *, header, thunk_t *, closure); |