diff options
Diffstat (limited to 'src/vmod-binlog.h')
-rw-r--r-- | src/vmod-binlog.h | 21 |
1 files changed, 4 insertions, 17 deletions
diff --git a/src/vmod-binlog.h b/src/vmod-binlog.h index db6c7f0..06d517d 100644 --- a/src/vmod-binlog.h +++ b/src/vmod-binlog.h @@ -38,5 +38,4 @@ struct binlog_record { - long nid; /* node ID */ - long aid; /* article ID */ time_t ts; /* timestamp */ + char data[1]; /* payload */ }; @@ -51,21 +50,9 @@ struct binlog_file_header { uint32_t version; + size_t hdrsize; size_t recsize; size_t recnum; +/* char dataspec[X];*/ }; -#define BINLOG_HEADER_SIZE \ - ((sizeof(struct binlog_file_header) + sizeof(struct binlog_record) - 1) / \ - sizeof(struct binlog_record)) - -union binlog_header { - struct binlog_file_header hdr; - struct binlog_record pad[BINLOG_HEADER_SIZE]; -}; - -#define binlog_size(conf) \ - (sizeof(union binlog_header) + \ - (conf)->recidx * sizeof(struct binlog_record)) -#define binlog_recnum(conf) \ - (((conf)->size - sizeof(union binlog_header)) / \ - sizeof(struct binlog_record)) +#define binlog_size(hdr) ((hdr)->hdrsize + (hdr)->recnum * (hdr)->recsize) |