private.h 17 KB

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