private.h 17 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572
  1. #ifndef TDB_PRIVATE_H
  2. #define TDB_PRIVATE_H
  3. /*
  4. Trivial Database 2: private types and prototypes
  5. Copyright (C) Rusty Russell 2010
  6. This library is free software; you can redistribute it and/or
  7. modify it under the terms of the GNU Lesser General Public
  8. License as published by the Free Software Foundation; either
  9. version 3 of the License, or (at your option) any later version.
  10. This library is distributed in the hope that it will be useful,
  11. but WITHOUT ANY WARRANTY; without even the implied warranty of
  12. MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
  13. Lesser General Public License for more details.
  14. You should have received a copy of the GNU Lesser General Public
  15. License along with this library; if not, see <http://www.gnu.org/licenses/>.
  16. */
  17. #define _XOPEN_SOURCE 500
  18. #define _FILE_OFFSET_BITS 64
  19. #include <stdint.h>
  20. #include <stdbool.h>
  21. #include <stdlib.h>
  22. #include <stddef.h>
  23. #include <sys/time.h>
  24. #include <sys/mman.h>
  25. #include <unistd.h>
  26. #include <fcntl.h>
  27. #include <string.h>
  28. #include <errno.h>
  29. #include <stdio.h>
  30. #include <utime.h>
  31. #include <unistd.h>
  32. #include "config.h"
  33. #include <ccan/tdb2/tdb2.h>
  34. #include <ccan/likely/likely.h>
  35. #include <ccan/compiler/compiler.h>
  36. #ifdef HAVE_BYTESWAP_H
  37. #include <byteswap.h>
  38. #endif
  39. #ifndef TEST_IT
  40. #define TEST_IT(cond)
  41. #endif
  42. /* #define TDB_TRACE 1 */
  43. #ifndef __STRING
  44. #define __STRING(x) #x
  45. #endif
  46. #ifndef __STRINGSTRING
  47. #define __STRINGSTRING(x) __STRING(x)
  48. #endif
  49. #ifndef __location__
  50. #define __location__ __FILE__ ":" __STRINGSTRING(__LINE__)
  51. #endif
  52. typedef uint64_t tdb_len_t;
  53. typedef uint64_t tdb_off_t;
  54. #define TDB_MAGIC_FOOD "TDB file\n"
  55. #define TDB_VERSION ((uint64_t)(0x26011967 + 7))
  56. #define TDB_MAGIC ((uint64_t)0x1999)
  57. #define TDB_FREE_MAGIC ((uint64_t)0xFE)
  58. #define TDB_HASH_MAGIC (0xA1ABE11A01092008ULL)
  59. #define TDB_RECOVERY_MAGIC (0xf53bc0e7ad124589ULL)
  60. #define TDB_RECOVERY_INVALID_MAGIC (0x0ULL)
  61. #define TDB_OFF_ERR ((tdb_off_t)-1)
  62. /* Prevent others from opening the file. */
  63. #define TDB_OPEN_LOCK 0
  64. /* Doing a transaction. */
  65. #define TDB_TRANSACTION_LOCK 1
  66. /* Expanding file. */
  67. #define TDB_EXPANSION_LOCK 2
  68. /* Hash chain locks. */
  69. #define TDB_HASH_LOCK_START 3
  70. /* Range for hash locks. */
  71. #define TDB_HASH_LOCK_RANGE_BITS 30
  72. #define TDB_HASH_LOCK_RANGE (1 << TDB_HASH_LOCK_RANGE_BITS)
  73. /* We have 1024 entries in the top level. */
  74. #define TDB_TOPLEVEL_HASH_BITS 10
  75. /* And 64 entries in each sub-level: thus 64 bits exactly after 9 levels. */
  76. #define TDB_SUBLEVEL_HASH_BITS 6
  77. /* And 8 entries in each group, ie 8 groups per sublevel. */
  78. #define TDB_HASH_GROUP_BITS 3
  79. /* Extend file by least 100 times larger than needed. */
  80. #define TDB_EXTENSION_FACTOR 100
  81. /* We steal bits from the offsets to store hash info. */
  82. #define TDB_OFF_HASH_GROUP_MASK ((1ULL << TDB_HASH_GROUP_BITS) - 1)
  83. /* We steal this many upper bits, giving a maximum offset of 64 exabytes. */
  84. #define TDB_OFF_UPPER_STEAL 8
  85. #define TDB_OFF_UPPER_STEAL_EXTRA 7
  86. /* The bit number where we store extra hash bits. */
  87. #define TDB_OFF_HASH_EXTRA_BIT 57
  88. #define TDB_OFF_UPPER_STEAL_SUBHASH_BIT 56
  89. /* The bit number where we store the extra hash bits. */
  90. /* Convenience mask to get actual offset. */
  91. #define TDB_OFF_MASK \
  92. (((1ULL << (64 - TDB_OFF_UPPER_STEAL)) - 1) - TDB_OFF_HASH_GROUP_MASK)
  93. /* How many buckets in a free list: see size_to_bucket(). */
  94. #define TDB_FREE_BUCKETS (64 - TDB_OFF_UPPER_STEAL)
  95. /* We have to be able to fit a free record here. */
  96. #define TDB_MIN_DATA_LEN \
  97. (sizeof(struct tdb_free_record) - sizeof(struct tdb_used_record))
  98. /* Indicates this entry is not on an flist (can happen during coalescing) */
  99. #define TDB_FLIST_NONE ((1ULL << TDB_OFF_UPPER_STEAL) - 1)
  100. #if !HAVE_BSWAP_64
  101. static inline uint64_t bswap_64(uint64_t x)
  102. {
  103. return (((x&0x000000FFULL)<<56)
  104. | ((x&0x0000FF00ULL)<<48)
  105. | ((x&0x00FF0000ULL)<<40)
  106. | ((x&0xFF000000ULL)<<32)
  107. | ((x>>8)&0xFF000000ULL)
  108. | ((x>>16)&0x00FF0000ULL)
  109. | ((x>>24)&0x0000FF00ULL)
  110. | ((x>>32)&0x000000FFULL));
  111. }
  112. #endif
  113. struct tdb_used_record {
  114. /* For on-disk compatibility, we avoid bitfields:
  115. magic: 16, (highest)
  116. key_len_bits: 5,
  117. extra_padding: 32
  118. hash_bits: 11
  119. */
  120. uint64_t magic_and_meta;
  121. /* The bottom key_len_bits*2 are key length, rest is data length. */
  122. uint64_t key_and_data_len;
  123. };
  124. static inline unsigned rec_key_bits(const struct tdb_used_record *r)
  125. {
  126. return ((r->magic_and_meta >> 43) & ((1 << 5)-1)) * 2;
  127. }
  128. static inline uint64_t rec_key_length(const struct tdb_used_record *r)
  129. {
  130. return r->key_and_data_len & ((1ULL << rec_key_bits(r)) - 1);
  131. }
  132. static inline uint64_t rec_data_length(const struct tdb_used_record *r)
  133. {
  134. return r->key_and_data_len >> rec_key_bits(r);
  135. }
  136. static inline uint64_t rec_extra_padding(const struct tdb_used_record *r)
  137. {
  138. return (r->magic_and_meta >> 11) & 0xFFFFFFFF;
  139. }
  140. static inline uint32_t rec_hash(const struct tdb_used_record *r)
  141. {
  142. return r->magic_and_meta & ((1 << 11) - 1);
  143. }
  144. static inline uint16_t rec_magic(const struct tdb_used_record *r)
  145. {
  146. return (r->magic_and_meta >> 48);
  147. }
  148. struct tdb_free_record {
  149. uint64_t magic_and_prev; /* TDB_OFF_UPPER_STEAL bits magic, then prev */
  150. uint64_t flist_and_len; /* Len not counting these two fields. */
  151. /* This is why the minimum record size is 8 bytes. */
  152. uint64_t next;
  153. };
  154. static inline uint64_t frec_prev(const struct tdb_free_record *f)
  155. {
  156. return f->magic_and_prev & ((1ULL << (64 - TDB_OFF_UPPER_STEAL)) - 1);
  157. }
  158. static inline uint64_t frec_magic(const struct tdb_free_record *f)
  159. {
  160. return f->magic_and_prev >> (64 - TDB_OFF_UPPER_STEAL);
  161. }
  162. static inline uint64_t frec_len(const struct tdb_free_record *f)
  163. {
  164. return f->flist_and_len & ((1ULL << (64 - TDB_OFF_UPPER_STEAL))-1);
  165. }
  166. static inline unsigned frec_flist(const struct tdb_free_record *f)
  167. {
  168. return f->flist_and_len >> (64 - TDB_OFF_UPPER_STEAL);
  169. }
  170. struct tdb_recovery_record {
  171. uint64_t magic;
  172. /* Length of record. */
  173. uint64_t max_len;
  174. /* Length used. */
  175. uint64_t len;
  176. /* Old length of file before transaction. */
  177. uint64_t eof;
  178. };
  179. /* this is stored at the front of every database */
  180. struct tdb_header {
  181. char magic_food[64]; /* for /etc/magic */
  182. /* FIXME: Make me 32 bit? */
  183. uint64_t version; /* version of the code */
  184. uint64_t hash_test; /* result of hashing HASH_MAGIC. */
  185. uint64_t hash_seed; /* "random" seed written at creation time. */
  186. tdb_off_t free_list; /* (First) free list. */
  187. tdb_off_t recovery; /* Transaction recovery area. */
  188. tdb_off_t reserved[26];
  189. /* Top level hash table. */
  190. tdb_off_t hashtable[1ULL << TDB_TOPLEVEL_HASH_BITS];
  191. };
  192. struct tdb_freelist {
  193. struct tdb_used_record hdr;
  194. tdb_off_t next;
  195. tdb_off_t buckets[TDB_FREE_BUCKETS];
  196. };
  197. /* Information about a particular (locked) hash entry. */
  198. struct hash_info {
  199. /* Full hash value of entry. */
  200. uint64_t h;
  201. /* Start and length of lock acquired. */
  202. tdb_off_t hlock_start;
  203. tdb_len_t hlock_range;
  204. /* Start of hash group. */
  205. tdb_off_t group_start;
  206. /* Bucket we belong in. */
  207. unsigned int home_bucket;
  208. /* Bucket we (or an empty space) were found in. */
  209. unsigned int found_bucket;
  210. /* How many bits of the hash are already used. */
  211. unsigned int hash_used;
  212. /* Current working group. */
  213. tdb_off_t group[1 << TDB_HASH_GROUP_BITS];
  214. };
  215. struct traverse_info {
  216. struct traverse_level {
  217. tdb_off_t hashtable;
  218. /* We ignore groups here, and treat it as a big array. */
  219. unsigned entry;
  220. unsigned int total_buckets;
  221. } levels[64 / TDB_SUBLEVEL_HASH_BITS];
  222. unsigned int num_levels;
  223. unsigned int toplevel_group;
  224. /* This makes delete-everything-inside-traverse work as expected. */
  225. tdb_off_t prev;
  226. };
  227. enum tdb_lock_flags {
  228. /* WAIT == F_SETLKW, NOWAIT == F_SETLK */
  229. TDB_LOCK_NOWAIT = 0,
  230. TDB_LOCK_WAIT = 1,
  231. /* If set, don't log an error on failure. */
  232. TDB_LOCK_PROBE = 2,
  233. /* If set, don't check for recovery (used by recovery code). */
  234. TDB_LOCK_NOCHECK = 4,
  235. };
  236. struct tdb_lock_type {
  237. uint32_t off;
  238. uint32_t count;
  239. uint32_t ltype;
  240. };
  241. struct tdb_context {
  242. /* Filename of the database. */
  243. const char *name;
  244. /* Mmap (if any), or malloc (for TDB_INTERNAL). */
  245. void *map_ptr;
  246. /* Are we accessing directly? (debugging check). */
  247. int direct_access;
  248. /* Open file descriptor (undefined for TDB_INTERNAL). */
  249. int fd;
  250. /* How much space has been mapped (<= current file size) */
  251. tdb_len_t map_size;
  252. /* Operating read-only? (Opened O_RDONLY, or in traverse_read) */
  253. bool read_only;
  254. /* mmap read only? */
  255. int mmap_flags;
  256. /* Error code for last tdb error. */
  257. enum TDB_ERROR ecode;
  258. /* the flags passed to tdb_open, for tdb_reopen. */
  259. uint32_t flags;
  260. /* Logging function */
  261. tdb_logfn_t logfn;
  262. void *log_private;
  263. /* Hash function. */
  264. tdb_hashfn_t khash;
  265. void *hash_priv;
  266. uint64_t hash_seed;
  267. /* Set if we are in a transaction. */
  268. struct tdb_transaction *transaction;
  269. /* What freelist are we using? */
  270. uint64_t flist_off;
  271. unsigned int flist;
  272. /* IO methods: changes for transactions. */
  273. const struct tdb_methods *methods;
  274. /* Lock information */
  275. struct tdb_lock_type allrecord_lock;
  276. size_t num_lockrecs;
  277. struct tdb_lock_type *lockrecs;
  278. struct tdb_attribute_stats *stats;
  279. /* Single list of all TDBs, to avoid multiple opens. */
  280. struct tdb_context *next;
  281. dev_t device;
  282. ino_t inode;
  283. };
  284. struct tdb_methods {
  285. int (*read)(struct tdb_context *, tdb_off_t, void *, tdb_len_t);
  286. int (*write)(struct tdb_context *, tdb_off_t, const void *, tdb_len_t);
  287. int (*oob)(struct tdb_context *, tdb_off_t, bool);
  288. int (*expand_file)(struct tdb_context *, tdb_len_t);
  289. void *(*direct)(struct tdb_context *, tdb_off_t, size_t);
  290. };
  291. /*
  292. internal prototypes
  293. */
  294. /* hash.c: */
  295. void tdb_hash_init(struct tdb_context *tdb);
  296. /* Hash random memory. */
  297. uint64_t tdb_hash(struct tdb_context *tdb, const void *ptr, size_t len);
  298. /* Hash on disk. */
  299. uint64_t hash_record(struct tdb_context *tdb, tdb_off_t off);
  300. /* Find and lock a hash entry (or where it would be). */
  301. tdb_off_t find_and_lock(struct tdb_context *tdb,
  302. struct tdb_data key,
  303. int ltype,
  304. struct hash_info *h,
  305. struct tdb_used_record *rec,
  306. struct traverse_info *tinfo);
  307. int replace_in_hash(struct tdb_context *tdb,
  308. struct hash_info *h,
  309. tdb_off_t new_off);
  310. int add_to_hash(struct tdb_context *tdb, struct hash_info *h,
  311. tdb_off_t new_off);
  312. int delete_from_hash(struct tdb_context *tdb, struct hash_info *h);
  313. /* For tdb_check */
  314. bool is_subhash(tdb_off_t val);
  315. /* free.c: */
  316. int tdb_flist_init(struct tdb_context *tdb);
  317. /* check.c needs these to iterate through free lists. */
  318. tdb_off_t first_flist(struct tdb_context *tdb);
  319. tdb_off_t next_flist(struct tdb_context *tdb, tdb_off_t flist);
  320. /* If this fails, try tdb_expand. */
  321. tdb_off_t alloc(struct tdb_context *tdb, size_t keylen, size_t datalen,
  322. uint64_t hash, bool growing);
  323. /* Put this record in a free list. */
  324. int add_free_record(struct tdb_context *tdb,
  325. tdb_off_t off, tdb_len_t len_with_header);
  326. /* Set up header for a used record. */
  327. int set_used_header(struct tdb_context *tdb,
  328. struct tdb_used_record *rec,
  329. uint64_t keylen, uint64_t datalen,
  330. uint64_t actuallen, unsigned hashlow);
  331. /* Used by tdb_check to verify. */
  332. unsigned int size_to_bucket(tdb_len_t data_len);
  333. tdb_off_t bucket_off(tdb_off_t flist_off, unsigned bucket);
  334. /* Used by tdb_summary */
  335. size_t dead_space(struct tdb_context *tdb, tdb_off_t off);
  336. /* io.c: */
  337. /* Initialize tdb->methods. */
  338. void tdb_io_init(struct tdb_context *tdb);
  339. /* Convert endian of the buffer if required. */
  340. void *tdb_convert(const struct tdb_context *tdb, void *buf, tdb_len_t size);
  341. /* Unmap and try to map the tdb. */
  342. void tdb_munmap(struct tdb_context *tdb);
  343. void tdb_mmap(struct tdb_context *tdb);
  344. /* Either alloc a copy, or give direct access. Release frees or noop. */
  345. const void *tdb_access_read(struct tdb_context *tdb,
  346. tdb_off_t off, tdb_len_t len, bool convert);
  347. void *tdb_access_write(struct tdb_context *tdb,
  348. tdb_off_t off, tdb_len_t len, bool convert);
  349. /* Is this pointer direct? (Otherwise it's malloced) */
  350. bool is_direct(const struct tdb_context *tdb, const void *p);
  351. /* Release result of tdb_access_read/write. */
  352. void tdb_access_release(struct tdb_context *tdb, const void *p);
  353. /* Commit result of tdb_acces_write. */
  354. int tdb_access_commit(struct tdb_context *tdb, void *p);
  355. /* Convenience routine to get an offset. */
  356. tdb_off_t tdb_read_off(struct tdb_context *tdb, tdb_off_t off);
  357. /* Write an offset at an offset. */
  358. int tdb_write_off(struct tdb_context *tdb, tdb_off_t off, tdb_off_t val);
  359. /* Clear an ondisk area. */
  360. int zero_out(struct tdb_context *tdb, tdb_off_t off, tdb_len_t len);
  361. /* Return a non-zero offset between >= start < end in this array (or end). */
  362. tdb_off_t tdb_find_nonzero_off(struct tdb_context *tdb,
  363. tdb_off_t base,
  364. uint64_t start,
  365. uint64_t end);
  366. /* Return a zero offset in this array, or num. */
  367. tdb_off_t tdb_find_zero_off(struct tdb_context *tdb, tdb_off_t off,
  368. uint64_t num);
  369. /* Even on files, we can get partial writes due to signals. */
  370. bool tdb_pwrite_all(int fd, const void *buf, size_t len, tdb_off_t off);
  371. bool tdb_pread_all(int fd, void *buf, size_t len, tdb_off_t off);
  372. bool tdb_read_all(int fd, void *buf, size_t len);
  373. /* Allocate and make a copy of some offset. */
  374. void *tdb_alloc_read(struct tdb_context *tdb, tdb_off_t offset, tdb_len_t len);
  375. /* Writes a converted copy of a record. */
  376. int tdb_write_convert(struct tdb_context *tdb, tdb_off_t off,
  377. const void *rec, size_t len);
  378. /* Reads record and converts it */
  379. int tdb_read_convert(struct tdb_context *tdb, tdb_off_t off,
  380. void *rec, size_t len);
  381. /* Adds a stat, if it's in range. */
  382. void add_stat_(struct tdb_context *tdb, uint64_t *stat, size_t val);
  383. #define add_stat(tdb, statname, val) \
  384. do { \
  385. if (unlikely((tdb)->stats)) \
  386. add_stat_((tdb), &(tdb)->stats->statname, (val)); \
  387. } while (0)
  388. /* lock.c: */
  389. void tdb_lock_init(struct tdb_context *tdb);
  390. /* Lock/unlock a range of hashes. */
  391. int tdb_lock_hashes(struct tdb_context *tdb,
  392. tdb_off_t hash_lock, tdb_len_t hash_range,
  393. int ltype, enum tdb_lock_flags waitflag);
  394. int tdb_unlock_hashes(struct tdb_context *tdb,
  395. tdb_off_t hash_lock,
  396. tdb_len_t hash_range, int ltype);
  397. /* Lock/unlock a particular free bucket. */
  398. int tdb_lock_free_bucket(struct tdb_context *tdb, tdb_off_t b_off,
  399. enum tdb_lock_flags waitflag);
  400. void tdb_unlock_free_bucket(struct tdb_context *tdb, tdb_off_t b_off);
  401. /* Serialize transaction start. */
  402. int tdb_transaction_lock(struct tdb_context *tdb, int ltype);
  403. int tdb_transaction_unlock(struct tdb_context *tdb, int ltype);
  404. /* Do we have any hash locks (ie. via tdb_chainlock) ? */
  405. bool tdb_has_hash_locks(struct tdb_context *tdb);
  406. /* Lock entire database. */
  407. int tdb_allrecord_lock(struct tdb_context *tdb, int ltype,
  408. enum tdb_lock_flags flags, bool upgradable);
  409. int tdb_allrecord_unlock(struct tdb_context *tdb, int ltype);
  410. int tdb_allrecord_upgrade(struct tdb_context *tdb);
  411. /* Serialize db open. */
  412. int tdb_lock_open(struct tdb_context *tdb, enum tdb_lock_flags flags);
  413. void tdb_unlock_open(struct tdb_context *tdb);
  414. bool tdb_has_open_lock(struct tdb_context *tdb);
  415. /* Serialize db expand. */
  416. int tdb_lock_expand(struct tdb_context *tdb, int ltype);
  417. void tdb_unlock_expand(struct tdb_context *tdb, int ltype);
  418. bool tdb_has_expansion_lock(struct tdb_context *tdb);
  419. /* If it needs recovery, grab all the locks and do it. */
  420. int tdb_lock_and_recover(struct tdb_context *tdb);
  421. /* traverse.c: */
  422. int first_in_hash(struct tdb_context *tdb, int ltype,
  423. struct traverse_info *tinfo,
  424. TDB_DATA *kbuf, size_t *dlen);
  425. int next_in_hash(struct tdb_context *tdb, int ltype,
  426. struct traverse_info *tinfo,
  427. TDB_DATA *kbuf, size_t *dlen);
  428. /* transaction.c: */
  429. int tdb_transaction_recover(struct tdb_context *tdb);
  430. bool tdb_needs_recovery(struct tdb_context *tdb);
  431. /* tdb.c: */
  432. void COLD tdb_logerr(struct tdb_context *tdb,
  433. enum TDB_ERROR ecode,
  434. enum tdb_debug_level level,
  435. const char *fmt, ...);
  436. #ifdef TDB_TRACE
  437. void tdb_trace(struct tdb_context *tdb, const char *op);
  438. void tdb_trace_seqnum(struct tdb_context *tdb, uint32_t seqnum, const char *op);
  439. void tdb_trace_open(struct tdb_context *tdb, const char *op,
  440. unsigned hash_size, unsigned tdb_flags, unsigned open_flags);
  441. void tdb_trace_ret(struct tdb_context *tdb, const char *op, int ret);
  442. void tdb_trace_retrec(struct tdb_context *tdb, const char *op, TDB_DATA ret);
  443. void tdb_trace_1rec(struct tdb_context *tdb, const char *op,
  444. TDB_DATA rec);
  445. void tdb_trace_1rec_ret(struct tdb_context *tdb, const char *op,
  446. TDB_DATA rec, int ret);
  447. void tdb_trace_1rec_retrec(struct tdb_context *tdb, const char *op,
  448. TDB_DATA rec, TDB_DATA ret);
  449. void tdb_trace_2rec_flag_ret(struct tdb_context *tdb, const char *op,
  450. TDB_DATA rec1, TDB_DATA rec2, unsigned flag,
  451. int ret);
  452. void tdb_trace_2rec_retrec(struct tdb_context *tdb, const char *op,
  453. TDB_DATA rec1, TDB_DATA rec2, TDB_DATA ret);
  454. #else
  455. #define tdb_trace(tdb, op)
  456. #define tdb_trace_seqnum(tdb, seqnum, op)
  457. #define tdb_trace_open(tdb, op, hash_size, tdb_flags, open_flags)
  458. #define tdb_trace_ret(tdb, op, ret)
  459. #define tdb_trace_retrec(tdb, op, ret)
  460. #define tdb_trace_1rec(tdb, op, rec)
  461. #define tdb_trace_1rec_ret(tdb, op, rec, ret)
  462. #define tdb_trace_1rec_retrec(tdb, op, rec, ret)
  463. #define tdb_trace_2rec_flag_ret(tdb, op, rec1, rec2, flag, ret)
  464. #define tdb_trace_2rec_retrec(tdb, op, rec1, rec2, ret)
  465. #endif /* !TDB_TRACE */
  466. #endif