enum { LogMagic = 0xDA7ACAFE, LogBlockSize = 512, }; typedef struct LogSuper LogSuper; typedef union LogEntry LogEntry; typedef struct Log Log; typedef struct Transaction Transaction; struct LogSuper { u32int magic; u32int u1; u64int start; u64int end; u64int u2[61]; }; enum { LBEGIN = 0xBEBEBEBE, LEND = 0xEDEDEDED, }; union LogEntry { struct { u64int type; u64int tid; u64int off; } hdr; uchar block[LogBlockSize]; }; struct Log { int fd; vlong blocks; LogSuper super; }; Log* logopen(char *logfile); void logclose(Log *l); int logreadsuper(Log *l); int logwritesuper(Log *l); long logwrite(Log *l, vlong off, void *data, int ndata); long logplay(Log *l); /* long writelog(Log *l, vlong off, void *data, int ndata); long commitlog(Log *l); Transaction *jstart(Log *l); int jend(Log *l, Transaction *t); long tblockwrite(Transaction *t); */