X-Git-Url: https://git.ozlabs.org/?p=ccan;a=blobdiff_plain;f=ccan%2Ftdb2%2Fprivate.h;h=d32c7546e092d648e4a3a156c54358aaaa30c134;hp=09f447f9221d179377d3e25bddae3a45977c49b1;hb=587982955ca9c61363d6e3004622ee97eda80e4b;hpb=2491b65a6d10cd6ca1a3e05bf535eb0180047922 diff --git a/ccan/tdb2/private.h b/ccan/tdb2/private.h index 09f447f9..d32c7546 100644 --- a/ccan/tdb2/private.h +++ b/ccan/tdb2/private.h @@ -1,6 +1,6 @@ #ifndef TDB_PRIVATE_H #define TDB_PRIVATE_H - /* + /* Trivial Database 2: private types and prototypes Copyright (C) Rusty Russell 2010 @@ -37,7 +37,7 @@ #include #include #include -#ifdef HAVE_BYTESWAP_H +#if HAVE_BYTESWAP_H #include #endif @@ -325,13 +325,16 @@ struct tdb_context { int mmap_flags; /* Error code for last tdb error. */ - enum TDB_ERROR ecode; + enum TDB_ERROR ecode; /* the flags passed to tdb_open, for tdb_reopen. */ uint32_t flags; /* Logging function */ - tdb_logfn_t logfn; + void (*logfn)(struct tdb_context *tdb, + enum tdb_log_level level, + void *log_private, + const char *message); void *log_private; /* Hash function. */ @@ -361,13 +364,13 @@ struct tdb_context { /* Single list of all TDBs, to avoid multiple opens. */ struct tdb_context *next; - dev_t device; + dev_t device; ino_t inode; }; struct tdb_methods { - int (*read)(struct tdb_context *, tdb_off_t, void *, tdb_len_t); - int (*write)(struct tdb_context *, tdb_off_t, const void *, tdb_len_t); + int (*tread)(struct tdb_context *, tdb_off_t, void *, tdb_len_t); + int (*twrite)(struct tdb_context *, tdb_off_t, const void *, tdb_len_t); int (*oob)(struct tdb_context *, tdb_off_t, bool); int (*expand_file)(struct tdb_context *, tdb_len_t); void *(*direct)(struct tdb_context *, tdb_off_t, size_t, bool); @@ -474,11 +477,6 @@ tdb_off_t tdb_find_nonzero_off(struct tdb_context *tdb, tdb_off_t tdb_find_zero_off(struct tdb_context *tdb, tdb_off_t off, uint64_t num); -/* Even on files, we can get partial writes due to signals. */ -bool tdb_pwrite_all(int fd, const void *buf, size_t len, tdb_off_t off); -bool tdb_pread_all(int fd, void *buf, size_t len, tdb_off_t off); -bool tdb_read_all(int fd, void *buf, size_t len); - /* Allocate and make a copy of some offset. */ void *tdb_alloc_read(struct tdb_context *tdb, tdb_off_t offset, tdb_len_t len); @@ -555,7 +553,7 @@ bool tdb_needs_recovery(struct tdb_context *tdb); /* tdb.c: */ void COLD tdb_logerr(struct tdb_context *tdb, enum TDB_ERROR ecode, - enum tdb_debug_level level, + enum tdb_log_level level, const char *fmt, ...); #ifdef TDB_TRACE