X-Git-Url: https://git.ozlabs.org/?p=ccan;a=blobdiff_plain;f=ccan%2Ftdb%2Ftdb.h;h=01ff905ae2af29a8ff4e6e2d4ea7872b4013def5;hp=020cf050b803cd02db67d7d34aaa7cd8e042da33;hb=c4c5fed020ba44b9930119672a36a1cb33aff090;hpb=95bf6d3f652c031e1bf4a2ef5df187b6f34a4c01;ds=sidebyside diff --git a/ccan/tdb/tdb.h b/ccan/tdb/tdb.h index 020cf050..01ff905a 100644 --- a/ccan/tdb/tdb.h +++ b/ccan/tdb/tdb.h @@ -38,6 +38,7 @@ extern "C" { /* For sig_atomic_t. */ #include #endif +#include /* flags to tdb_store() */ #define TDB_REPLACE 1 /* Unused */ @@ -65,6 +66,9 @@ enum TDB_ERROR {TDB_SUCCESS=0, TDB_ERR_CORRUPT, TDB_ERR_IO, TDB_ERR_LOCK, TDB_ERR_NOEXIST, TDB_ERR_EINVAL, TDB_ERR_RDONLY, TDB_ERR_NESTING}; +/* flags for tdb_summary. Logical or to combine. */ +enum tdb_summary_flags { TDB_SUMMARY_HISTOGRAMS = 1 }; + /* debugging uses one of the following levels */ enum tdb_debug_level {TDB_DEBUG_FATAL = 0, TDB_DEBUG_ERROR, TDB_DEBUG_WARNING, TDB_DEBUG_TRACE}; @@ -74,18 +78,6 @@ typedef struct TDB_DATA { size_t dsize; } TDB_DATA; -#ifndef PRINTF_ATTRIBUTE -#if (__GNUC__ >= 3) -/** Use gcc attribute to check printf fns. a1 is the 1-based index of - * the parameter containing the format, and a2 the index of the first - * argument. Note that some gcc 2.x versions don't handle this - * properly **/ -#define PRINTF_ATTRIBUTE(a1, a2) __attribute__ ((format (__printf__, a1, a2))) -#else -#define PRINTF_ATTRIBUTE(a1, a2) -#endif -#endif - /* this is the context structure that is returned from a db open */ typedef struct tdb_context TDB_CONTEXT; @@ -175,6 +167,7 @@ void tdb_dump_all(struct tdb_context *tdb); int tdb_printfreelist(struct tdb_context *tdb); int tdb_validate_freelist(struct tdb_context *tdb, int *pnum_entries); int tdb_freelist_size(struct tdb_context *tdb); +char *tdb_summary(struct tdb_context *tdb, enum tdb_summary_flags flags); extern TDB_DATA tdb_null;