From 473f9ed67cfe73ea6ea998abc8762df3e51b54da Mon Sep 17 00:00:00 2001 From: Vito Caputo Date: Fri, 3 Sep 2021 15:59:53 -0700 Subject: 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. --- src/journals.h | 22 +++------------------- 1 file changed, 3 insertions(+), 19 deletions(-) (limited to 'src/journals.h') 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); -- cgit v1.2.3