Commit 13b53ce9 authored by Bradley C. Kuszmaul's avatar Bradley C. Kuszmaul Committed by Yoni Fogel

[t:r4298] Resolve various conflicts with buildheader between 4298 and main. Refs #4298.

git-svn-id: file:///svn/toku/tokudb@39774 c7de825b-a66e-492c-adef-691d508d4ae1
parent 778f1a1a
#ifndef _DB_H
#define _DB_H
/* This code generated by make_db_h. Copyright (c) 2007, 2008 Tokutek */
#ident "Copyright (c) 2007, 2008 Tokutek Inc. All rights reserved."
/* This code generated by make_db_h. Copyright (c) 2007-2011 Tokutek */
#ident "Copyright (c) 2007-2011 Tokutek Inc. All rights reserved."
#include <sys/types.h>
/*stdio is needed for the FILE* in db->verify*/
#include <stdio.h>
......@@ -23,6 +23,7 @@ extern "C" {
#define TOKU_OFF_T_DEFINED
typedef int64_t toku_off_t;
#endif
#define DB_GID_SIZE 128
typedef struct __toku_db_env DB_ENV;
typedef struct __toku_db_key_range DB_KEY_RANGE;
typedef struct __toku_db_lsn DB_LSN;
......@@ -32,6 +33,7 @@ typedef struct __toku_db_txn_active DB_TXN_ACTIVE;
typedef struct __toku_db_txn_stat DB_TXN_STAT;
typedef struct __toku_dbc DBC;
typedef struct __toku_dbt DBT;
typedef struct __toku_db_preplist { DB_TXN *txn; uint8_t gid[DB_GID_SIZE]; } DB_PREPLIST;
typedef u_int32_t db_recno_t;
typedef int(*YDB_CALLBACK_FUNCTION)(DBT const*, DBT const*, void*);
#include <tdb-internal.h>
......@@ -187,276 +189,3 @@ typedef int (*generate_row_for_del_func)(DB *dest_db, DB *src_db, DBT *dest_key,
#ifdef _TOKUDB_WRAP_H
#undef txn_begin
#endif
struct __toku_db_env {
struct __toku_db_env_internal *i;
#define db_env_struct_i(x) ((x)->i)
int (*checkpointing_set_period) (DB_ENV*, u_int32_t) /* Change the delay between automatic checkpoints. 0 means disabled. */;
int (*checkpointing_get_period) (DB_ENV*, u_int32_t*) /* Retrieve the delay between automatic checkpoints. 0 means disabled. */;
int (*cleaner_set_period) (DB_ENV*, u_int32_t) /* Change the delay between automatic cleaner attempts. 0 means disabled. */;
int (*cleaner_get_period) (DB_ENV*, u_int32_t*) /* Retrieve the delay between automatic cleaner attempts. 0 means disabled. */;
int (*cleaner_set_iterations) (DB_ENV*, u_int32_t) /* Change the number of attempts on each cleaner invokation. 0 means disabled. */;
int (*cleaner_get_iterations) (DB_ENV*, u_int32_t*) /* Retrieve the number of attempts on each cleaner invokation. 0 means disabled. */;
int (*checkpointing_postpone) (DB_ENV*) /* Use for 'rename table' or any other operation that must be disjoint from a checkpoint */;
int (*checkpointing_resume) (DB_ENV*) /* Alert tokudb 'postpone' is no longer necessary */;
void *app_private; /* 32-bit offset=36 size=4, 64=bit offset=72 size=8 */
int (*checkpointing_begin_atomic_operation) (DB_ENV*) /* Begin a set of operations (that must be atomic as far as checkpoints are concerned). i.e. inserting into every index in one table */;
int (*checkpointing_end_atomic_operation) (DB_ENV*) /* End a set of operations (that must be atomic as far as checkpoints are concerned). */;
int (*set_default_bt_compare) (DB_ENV*,int (*bt_compare) (DB *, const DBT *, const DBT *)) /* Set default (key) comparison function for all DBs in this environment. Required for RECOVERY since you cannot open the DBs manually. */;
int (*get_engine_status_num_rows) (DB_ENV*, uint64_t*) /* return number of rows in engine status */;
int (*get_engine_status) (DB_ENV*, TOKU_ENGINE_STATUS_ROW, uint64_t, fs_redzone_state*, uint64_t*, char*, int) /* Fill in status struct and redzone state, possibly env panic string */;
int (*get_engine_status_text) (DB_ENV*, char*, int) /* Fill in status text */;
int (*crash) (DB_ENV*, const char*/*expr_as_string*/,const char */*fun*/,const char*/*file*/,int/*line*/, int/*errno*/);;
int (*get_iname) (DB_ENV* env, DBT* dname_dbt, DBT* iname_dbt) /* FOR TEST ONLY: lookup existing iname */;
int (*create_loader) (DB_ENV *env, DB_TXN *txn, DB_LOADER **blp, DB *src_db, int N, DB *dbs[/*N*/], uint32_t db_flags[/*N*/], uint32_t dbt_flags[/*N*/], uint32_t loader_flags);
int (*create_indexer) (DB_ENV *env, DB_TXN *txn, DB_INDEXER **idxrp, DB *src_db, int N, DB *dbs[/*N*/], uint32_t db_flags[/*N*/], uint32_t indexer_flags);
int (*put_multiple) (DB_ENV *env, DB *src_db, DB_TXN *txn,
const DBT *src_key, const DBT *src_val,
uint32_t num_dbs, DB **db_array, DBT *keys, DBT *vals, uint32_t *flags_array) /* insert into multiple DBs */;
int (*set_generate_row_callback_for_put) (DB_ENV *env, generate_row_for_put_func generate_row_for_put);
int (*del_multiple) (DB_ENV *env, DB *src_db, DB_TXN *txn,
const DBT *src_key, const DBT *src_val,
uint32_t num_dbs, DB **db_array, DBT *keys, uint32_t *flags_array) /* delete from multiple DBs */;
int (*set_generate_row_callback_for_del) (DB_ENV *env, generate_row_for_del_func generate_row_for_del);
int (*update_multiple) (DB_ENV *env, DB *src_db, DB_TXN *txn,
DBT *old_src_key, DBT *old_src_data,
DBT *new_src_key, DBT *new_src_data,
uint32_t num_dbs, DB **db_array, uint32_t *flags_array,
uint32_t num_keys, DBT *keys,
uint32_t num_vals, DBT *vals) /* update multiple DBs */;
int (*get_redzone) (DB_ENV *env, int *redzone) /* get the redzone limit */;
int (*set_redzone) (DB_ENV *env, int redzone) /* set the redzone limit in percent of total space */;
int (*set_lk_max_memory) (DB_ENV *env, uint64_t max);
int (*get_lk_max_memory) (DB_ENV *env, uint64_t *max);
void (*set_update) (DB_ENV *env, int (*update_function)(DB *, const DBT *key, const DBT *old_val, const DBT *extra, void (*set_val)(const DBT *new_val, void *set_extra), void *set_extra));
int (*set_lock_timeout) (DB_ENV *env, uint64_t lock_wait_time_msec);
int (*get_lock_timeout) (DB_ENV *env, uint64_t *lock_wait_time_msec);
void* __toku_dummy0[5];
char __toku_dummy1[64];
void *api1_internal; /* 32-bit offset=212 size=4, 64=bit offset=360 size=8 */
void* __toku_dummy2[7];
int (*close) (DB_ENV *, u_int32_t); /* 32-bit offset=244 size=4, 64=bit offset=424 size=8 */
int (*dbremove) (DB_ENV *, DB_TXN *, const char *, const char *, u_int32_t); /* 32-bit offset=248 size=4, 64=bit offset=432 size=8 */
int (*dbrename) (DB_ENV *, DB_TXN *, const char *, const char *, const char *, u_int32_t); /* 32-bit offset=252 size=4, 64=bit offset=440 size=8 */
void (*err) (const DB_ENV *, int, const char *, ...); /* 32-bit offset=256 size=4, 64=bit offset=448 size=8 */
void* __toku_dummy3[1];
int (*open) (DB_ENV *, const char *, u_int32_t, int); /* 32-bit offset=264 size=4, 64=bit offset=464 size=8 */
void* __toku_dummy4[1];
int (*set_data_dir) (DB_ENV *, const char *); /* 32-bit offset=272 size=4, 64=bit offset=480 size=8 */
void* __toku_dummy5[3];
void (*set_errcall) (DB_ENV *, void (*)(const char *, char *)); /* 32-bit offset=288 size=4, 64=bit offset=512 size=8 */
void (*set_errfile) (DB_ENV *, FILE*); /* 32-bit offset=292 size=4, 64=bit offset=520 size=8 */
void (*set_errpfx) (DB_ENV *, const char *); /* 32-bit offset=296 size=4, 64=bit offset=528 size=8 */
void* __toku_dummy6[1];
int (*set_flags) (DB_ENV *, u_int32_t, int); /* 32-bit offset=304 size=4, 64=bit offset=544 size=8 */
void* __toku_dummy7[4];
int (*set_tmp_dir) (DB_ENV *, const char *); /* 32-bit offset=324 size=4, 64=bit offset=584 size=8 */
int (*set_verbose) (DB_ENV *, u_int32_t, int); /* 32-bit offset=328 size=4, 64=bit offset=592 size=8 */
void* __toku_dummy8[1];
int (*set_lg_bsize) (DB_ENV *, u_int32_t); /* 32-bit offset=336 size=4, 64=bit offset=608 size=8 */
int (*set_lg_dir) (DB_ENV *, const char *); /* 32-bit offset=340 size=4, 64=bit offset=616 size=8 */
int (*set_lg_max) (DB_ENV *, u_int32_t); /* 32-bit offset=344 size=4, 64=bit offset=624 size=8 */
void* __toku_dummy9[1];
int (*log_archive) (DB_ENV *, char **[], u_int32_t); /* 32-bit offset=352 size=4, 64=bit offset=640 size=8 */
void* __toku_dummy10[2];
int (*log_flush) (DB_ENV *, const DB_LSN *); /* 32-bit offset=364 size=4, 64=bit offset=664 size=8 */
void* __toku_dummy11[4];
int (*set_lk_detect) (DB_ENV *, u_int32_t); /* 32-bit offset=384 size=4, 64=bit offset=704 size=8 */
int (*set_lk_max) (DB_ENV *, u_int32_t); /* 32-bit offset=388 size=4, 64=bit offset=712 size=8 */
int (*set_lk_max_locks) (DB_ENV *, u_int32_t); /* 32-bit offset=392 size=4, 64=bit offset=720 size=8 */
void* __toku_dummy12[14];
int (*set_cachesize) (DB_ENV *, u_int32_t, u_int32_t, int); /* 32-bit offset=452 size=4, 64=bit offset=840 size=8 */
void* __toku_dummy13[21];
int (*txn_begin) (DB_ENV *, DB_TXN *, DB_TXN **, u_int32_t); /* 32-bit offset=540 size=4, 64=bit offset=1016 size=8 */
int (*txn_checkpoint) (DB_ENV *, u_int32_t, u_int32_t, u_int32_t); /* 32-bit offset=544 size=4, 64=bit offset=1024 size=8 */
void* __toku_dummy14[2];
int (*txn_stat) (DB_ENV *, DB_TXN_STAT **, u_int32_t); /* 32-bit offset=556 size=4, 64=bit offset=1048 size=8 */
void* __toku_dummy15[2]; /* Padding at the end */
char __toku_dummy16[8]; /* Padding at the end */
};
struct __toku_db_key_range {
double less; /* 32-bit offset=0 size=8, 64=bit offset=0 size=8 */
double equal; /* 32-bit offset=8 size=8, 64=bit offset=8 size=8 */
double greater; /* 32-bit offset=16 size=8, 64=bit offset=16 size=8 */
void* __toku_dummy0[126]; /* Padding at the end */
char __toku_dummy1[48]; /* Padding at the end */
};
struct __toku_db_lsn {
char __toku_dummy0[8]; /* Padding at the end */
};
struct __toku_dbt {
void*data; /* 32-bit offset=0 size=4, 64=bit offset=0 size=8 */
u_int32_t size; /* 32-bit offset=4 size=4, 64=bit offset=8 size=4 */
u_int32_t ulen; /* 32-bit offset=8 size=4, 64=bit offset=12 size=4 */
char __toku_dummy0[8];
u_int32_t flags; /* 32-bit offset=20 size=4, 64=bit offset=24 size=4 */
/* 4 more bytes of alignment in the 64-bit case. */
};
typedef struct __toku_descriptor {
DBT dbt;
} *DESCRIPTOR, DESCRIPTOR_S;
//One header is included in 'data'
//One header is included in 'additional for checkpoint'
typedef struct __toku_db_fragmentation {
uint64_t file_size_bytes; //Total file size in bytes
uint64_t data_bytes; //Compressed User Data in bytes
uint64_t data_blocks; //Number of blocks of compressed User Data
uint64_t checkpoint_bytes_additional; //Additional bytes used for checkpoint system
uint64_t checkpoint_blocks_additional; //Additional blocks used for checkpoint system
uint64_t unused_bytes; //Unused space in file
uint64_t unused_blocks; //Number of contiguous regions of unused space
uint64_t largest_unused_block; //Size of largest contiguous unused space
} *TOKU_DB_FRAGMENTATION, TOKU_DB_FRAGMENTATION_S;
struct __toku_db {
struct __toku_db_internal *i;
#define db_struct_i(x) ((x)->i)
int (*key_range64)(DB*, DB_TXN *, DBT *, u_int64_t *less, u_int64_t *equal, u_int64_t *greater, int *is_exact);
int (*stat64)(DB *, DB_TXN *, DB_BTREE_STAT64 *);
int (*pre_acquire_table_lock)(DB*, DB_TXN*);
void *app_private; /* 32-bit offset=16 size=4, 64=bit offset=32 size=8 */
DB_ENV *dbenv; /* 32-bit offset=20 size=4, 64=bit offset=40 size=8 */
int (*pre_acquire_fileops_lock)(DB*, DB_TXN*);
const DBT* (*dbt_pos_infty)(void) /* Return the special DBT that refers to positive infinity in the lock table.*/;
const DBT* (*dbt_neg_infty)(void)/* Return the special DBT that refers to negative infinity in the lock table.*/;
void (*get_max_row_size) (DB*, u_int32_t *max_key_size, u_int32_t *max_row_size);
DESCRIPTOR descriptor /* saved row/dictionary descriptor for aiding in comparisons */;
int (*change_descriptor) (DB*, DB_TXN*, const DBT* descriptor, u_int32_t) /* change row/dictionary descriptor for a db. Available only while db is open */;
int (*getf_set)(DB*, DB_TXN*, u_int32_t, DBT*, YDB_CALLBACK_FUNCTION, void*) /* same as DBC->c_getf_set without a persistent cursor) */;
int (*flatten)(DB*, DB_TXN*) /* Flatten a dictionary, similar to (but faster than) a table scan */;
int (*optimize)(DB*) /* Run garbage collecion and promote all transactions older than oldest. Amortized (happens during flattening) */;
int (*hot_optimize)(DB*, int (*progress_callback)(void *progress_extra, float progress), void *progress_extra);
int (*get_fragmentation)(DB*,TOKU_DB_FRAGMENTATION);
int (*get_readpagesize)(DB*,u_int32_t*);
int (*set_readpagesize)(DB*,u_int32_t);
int (*set_indexer)(DB*, DB_INDEXER*);
void (*get_indexer)(DB*, DB_INDEXER**);
int (*verify_with_progress)(DB *, int (*progress_callback)(void *progress_extra, float progress), void *progress_extra, int verbose, int keep_going);
int (*update)(DB *, DB_TXN*, const DBT *key, const DBT *extra, u_int32_t flags);
int (*update_broadcast)(DB *, DB_TXN*, const DBT *extra, u_int32_t flags);
void* __toku_dummy0[11];
char __toku_dummy1[96];
void *api_internal; /* 32-bit offset=236 size=4, 64=bit offset=376 size=8 */
void* __toku_dummy2[5];
int (*close) (DB*, u_int32_t); /* 32-bit offset=260 size=4, 64=bit offset=424 size=8 */
int (*cursor) (DB *, DB_TXN *, DBC **, u_int32_t); /* 32-bit offset=264 size=4, 64=bit offset=432 size=8 */
int (*del) (DB *, DB_TXN *, DBT *, u_int32_t); /* 32-bit offset=268 size=4, 64=bit offset=440 size=8 */
void* __toku_dummy3[2];
int (*fd) (DB *, int *); /* 32-bit offset=280 size=4, 64=bit offset=464 size=8 */
int (*get) (DB *, DB_TXN *, DBT *, DBT *, u_int32_t); /* 32-bit offset=284 size=4, 64=bit offset=472 size=8 */
void* __toku_dummy4[4];
int (*key_range) (DB *, DB_TXN *, DBT *, DB_KEY_RANGE *, u_int32_t); /* 32-bit offset=304 size=4, 64=bit offset=512 size=8 */
int (*open) (DB *, DB_TXN *, const char *, const char *, DBTYPE, u_int32_t, int); /* 32-bit offset=308 size=4, 64=bit offset=520 size=8 */
int (*put) (DB *, DB_TXN *, DBT *, DBT *, u_int32_t); /* 32-bit offset=312 size=4, 64=bit offset=528 size=8 */
int (*remove) (DB *, const char *, const char *, u_int32_t); /* 32-bit offset=316 size=4, 64=bit offset=536 size=8 */
int (*rename) (DB *, const char *, const char *, const char *, u_int32_t); /* 32-bit offset=320 size=4, 64=bit offset=544 size=8 */
int (*truncate) (DB *, DB_TXN *, u_int32_t *, u_int32_t); /* 32-bit offset=324 size=4, 64=bit offset=552 size=8 */
void* __toku_dummy5[7];
void (*set_errfile) (DB *, FILE*); /* 32-bit offset=356 size=4, 64=bit offset=616 size=8 */
void* __toku_dummy6[2];
int (*set_flags) (DB *, u_int32_t); /* 32-bit offset=368 size=4, 64=bit offset=640 size=8 */
void* __toku_dummy7[1];
int (*set_pagesize) (DB *, u_int32_t); /* 32-bit offset=376 size=4, 64=bit offset=656 size=8 */
void* __toku_dummy8[1];
int (*stat) (DB *, void *, u_int32_t); /* 32-bit offset=384 size=4, 64=bit offset=672 size=8 */
void* __toku_dummy9[2];
int (*verify) (DB *, const char *, const char *, FILE *, u_int32_t); /* 32-bit offset=396 size=4, 64=bit offset=696 size=8 */
void* __toku_dummy10[16]; /* Padding at the end */
char __toku_dummy11[8]; /* Padding at the end */
};
struct __toku_db_txn_active {
u_int32_t txnid; /* 32-bit offset=0 size=4, 64=bit offset=0 size=4 */
char __toku_dummy0[4];
DB_LSN lsn; /* 32-bit offset=8 size=8, 64=bit offset=8 size=8 */
};
typedef struct __toku_txn_progress {
uint64_t entries_total;
uint64_t entries_processed;
uint8_t is_commit;
uint8_t stalled_on_checkpoint;
} *TOKU_TXN_PROGRESS, TOKU_TXN_PROGRESS_S;
typedef void(*TXN_PROGRESS_POLL_FUNCTION)(TOKU_TXN_PROGRESS, void*);
struct txn_stat {
u_int64_t rollback_raw_count;
};
struct __toku_db_txn {
DB_ENV *mgrp /*In TokuDB, mgrp is a DB_ENV not a DB_TXNMGR*/; /* 32-bit offset=0 size=4, 64=bit offset=0 size=8 */
DB_TXN *parent; /* 32-bit offset=4 size=4, 64=bit offset=8 size=8 */
int (*txn_stat)(DB_TXN *, struct txn_stat **);
struct { void *next, *prev; } open_txns;
int (*commit_with_progress)(DB_TXN*, uint32_t, TXN_PROGRESS_POLL_FUNCTION, void*);
int (*abort_with_progress)(DB_TXN*, TXN_PROGRESS_POLL_FUNCTION, void*);
void* __toku_dummy0[5];
char __toku_dummy1[24];
void *api_internal; /* 32-bit offset=68 size=4, 64=bit offset=112 size=8 */
void* __toku_dummy2[1];
int (*abort) (DB_TXN *); /* 32-bit offset=76 size=4, 64=bit offset=128 size=8 */
int (*commit) (DB_TXN*, u_int32_t); /* 32-bit offset=80 size=4, 64=bit offset=136 size=8 */
void* __toku_dummy3[1];
u_int32_t (*id) (DB_TXN *); /* 32-bit offset=88 size=4, 64=bit offset=152 size=8 */
void* __toku_dummy4[3]; /* Padding at the end */
};
struct __toku_db_txn_stat {
void* __toku_dummy0[1];
char __toku_dummy1[28];
u_int32_t st_nactive; /* 32-bit offset=32 size=4, 64=bit offset=36 size=4 */
char __toku_dummy2[8];
DB_TXN_ACTIVE *st_txnarray; /* 32-bit offset=44 size=4, 64=bit offset=48 size=8 */
void* __toku_dummy3[1]; /* Padding at the end */
char __toku_dummy4[8]; /* Padding at the end */
};
struct __toku_dbc {
DB *dbp; /* 32-bit offset=0 size=4, 64=bit offset=0 size=8 */
int (*c_getf_first)(DBC *, u_int32_t, YDB_CALLBACK_FUNCTION, void *);
int (*c_getf_last)(DBC *, u_int32_t, YDB_CALLBACK_FUNCTION, void *);
int (*c_getf_next)(DBC *, u_int32_t, YDB_CALLBACK_FUNCTION, void *);
int (*c_getf_prev)(DBC *, u_int32_t, YDB_CALLBACK_FUNCTION, void *);
int (*c_getf_current)(DBC *, u_int32_t, YDB_CALLBACK_FUNCTION, void *);
int (*c_getf_current_binding)(DBC *, u_int32_t, YDB_CALLBACK_FUNCTION, void *);
int (*c_getf_set)(DBC *, u_int32_t, DBT *, YDB_CALLBACK_FUNCTION, void *);
int (*c_getf_set_range)(DBC *, u_int32_t, DBT *, YDB_CALLBACK_FUNCTION, void *);
int (*c_getf_set_range_reverse)(DBC *, u_int32_t, DBT *, YDB_CALLBACK_FUNCTION, void *);
int (*c_pre_acquire_range_lock)(DBC*, const DBT*, const DBT*);
void* __toku_dummy0[10];
char __toku_dummy1[104];
int (*c_close) (DBC *); /* 32-bit offset=188 size=4, 64=bit offset=272 size=8 */
int (*c_count) (DBC *, db_recno_t *, u_int32_t); /* 32-bit offset=192 size=4, 64=bit offset=280 size=8 */
int (*c_del) (DBC *, u_int32_t); /* 32-bit offset=196 size=4, 64=bit offset=288 size=8 */
void* __toku_dummy2[1];
int (*c_get) (DBC *, DBT *, DBT *, u_int32_t); /* 32-bit offset=204 size=4, 64=bit offset=304 size=8 */
void* __toku_dummy3[11]; /* Padding at the end */
};
#ifdef _TOKUDB_WRAP_H
#define txn_begin txn_begin_tokudb
#endif
int db_env_create(DB_ENV **, u_int32_t) __attribute__((__visibility__("default")));
int db_create(DB **, DB_ENV *, u_int32_t) __attribute__((__visibility__("default")));
char *db_strerror(int) __attribute__((__visibility__("default")));
const char *db_version(int*,int *,int *) __attribute__((__visibility__("default")));
int log_compare (const DB_LSN*, const DB_LSN *) __attribute__((__visibility__("default")));
int db_env_set_func_fsync (int (*)(int)) __attribute__((__visibility__("default")));
int toku_set_trace_file (char *fname) __attribute__((__visibility__("default")));
int toku_close_trace_file (void) __attribute__((__visibility__("default")));
int db_env_set_func_free (void (*)(void*)) __attribute__((__visibility__("default")));
int db_env_set_func_malloc (void *(*)(size_t)) __attribute__((__visibility__("default")));
int db_env_set_func_realloc (void *(*)(void*, size_t)) __attribute__((__visibility__("default")));
int db_env_set_func_pwrite (ssize_t (*)(int, const void *, size_t, toku_off_t)) __attribute__((__visibility__("default")));
int db_env_set_func_full_pwrite (ssize_t (*)(int, const void *, size_t, toku_off_t)) __attribute__((__visibility__("default")));
int db_env_set_func_write (ssize_t (*)(int, const void *, size_t)) __attribute__((__visibility__("default")));
int db_env_set_func_full_write (ssize_t (*)(int, const void *, size_t)) __attribute__((__visibility__("default")));
int db_env_set_func_fdopen (FILE* (*)(int, const char *)) __attribute__((__visibility__("default")));
int db_env_set_func_fopen (FILE* (*)(const char *, const char *)) __attribute__((__visibility__("default")));
int db_env_set_func_open (int (*)(const char *, int, int)) __attribute__((__visibility__("default")));
int db_env_set_func_fclose (int (*)(FILE*)) __attribute__((__visibility__("default")));
int db_env_set_func_pread (ssize_t (*)(int, void *, size_t, off_t)) __attribute__((__visibility__("default")));
void db_env_set_func_loader_fwrite (size_t (*fwrite_fun)(const void*,size_t,size_t,FILE*)) __attribute__((__visibility__("default")));
void db_env_set_checkpoint_callback (void (*)(void*), void*) __attribute__((__visibility__("default")));
void db_env_set_checkpoint_callback2 (void (*)(void*), void*) __attribute__((__visibility__("default")));
void db_env_set_recover_callback (void (*)(void*), void*) __attribute__((__visibility__("default")));
void db_env_set_recover_callback2 (void (*)(void*), void*) __attribute__((__visibility__("default")));
void db_env_set_loader_size_factor (uint32_t) __attribute__((__visibility__("default")));
void db_env_set_mvcc_garbage_collection_verification(u_int32_t) __attribute__((__visibility__("default")));
void db_env_enable_engine_status(u_int32_t) __attribute__((__visibility__("default")));
void db_env_set_flusher_thread_callback (void (*)(int, void*), void*) __attribute__((__visibility__("default")));
#if defined(__cplusplus)
}
#endif
#endif
#ifndef _DB_H
#define _DB_H
/* This code generated by make_db_h. Copyright (c) 2007, 2008 Tokutek */
#ident "Copyright (c) 2007, 2008 Tokutek Inc. All rights reserved."
/* This code generated by make_db_h. Copyright (c) 2007-2011 Tokutek */
#ident "Copyright (c) 2007-2011 Tokutek Inc. All rights reserved."
#include <sys/types.h>
/*stdio is needed for the FILE* in db->verify*/
#include <stdio.h>
......@@ -23,6 +23,7 @@ extern "C" {
#define TOKU_OFF_T_DEFINED
typedef int64_t toku_off_t;
#endif
#define DB_GID_SIZE 128
typedef struct __toku_db_env DB_ENV;
typedef struct __toku_db_key_range DB_KEY_RANGE;
typedef struct __toku_db_lsn DB_LSN;
......@@ -32,6 +33,7 @@ typedef struct __toku_db_txn_active DB_TXN_ACTIVE;
typedef struct __toku_db_txn_stat DB_TXN_STAT;
typedef struct __toku_dbc DBC;
typedef struct __toku_dbt DBT;
typedef struct __toku_db_preplist { DB_TXN *txn; uint8_t gid[DB_GID_SIZE]; } DB_PREPLIST;
typedef u_int32_t db_recno_t;
typedef int(*YDB_CALLBACK_FUNCTION)(DBT const*, DBT const*, void*);
#include <tdb-internal.h>
......@@ -212,19 +214,19 @@ struct __toku_db_env {
int (*create_loader) (DB_ENV *env, DB_TXN *txn, DB_LOADER **blp, DB *src_db, int N, DB *dbs[/*N*/], uint32_t db_flags[/*N*/], uint32_t dbt_flags[/*N*/], uint32_t loader_flags);
int (*create_indexer) (DB_ENV *env, DB_TXN *txn, DB_INDEXER **idxrp, DB *src_db, int N, DB *dbs[/*N*/], uint32_t db_flags[/*N*/], uint32_t indexer_flags);
int (*put_multiple) (DB_ENV *env, DB *src_db, DB_TXN *txn,
const DBT *src_key, const DBT *src_val,
uint32_t num_dbs, DB **db_array, DBT *keys, DBT *vals, uint32_t *flags_array) /* insert into multiple DBs */;
const DBT *src_key, const DBT *src_val,
uint32_t num_dbs, DB **db_array, DBT *keys, DBT *vals, uint32_t *flags_array) /* insert into multiple DBs */;
int (*set_generate_row_callback_for_put) (DB_ENV *env, generate_row_for_put_func generate_row_for_put);
int (*del_multiple) (DB_ENV *env, DB *src_db, DB_TXN *txn,
const DBT *src_key, const DBT *src_val,
uint32_t num_dbs, DB **db_array, DBT *keys, uint32_t *flags_array) /* delete from multiple DBs */;
const DBT *src_key, const DBT *src_val,
uint32_t num_dbs, DB **db_array, DBT *keys, uint32_t *flags_array) /* delete from multiple DBs */;
int (*set_generate_row_callback_for_del) (DB_ENV *env, generate_row_for_del_func generate_row_for_del);
int (*update_multiple) (DB_ENV *env, DB *src_db, DB_TXN *txn,
DBT *old_src_key, DBT *old_src_data,
DBT *new_src_key, DBT *new_src_data,
uint32_t num_dbs, DB **db_array, uint32_t *flags_array,
uint32_t num_keys, DBT *keys,
uint32_t num_vals, DBT *vals) /* update multiple DBs */;
DBT *old_src_key, DBT *old_src_data,
DBT *new_src_key, DBT *new_src_data,
uint32_t num_dbs, DB **db_array, uint32_t *flags_array,
uint32_t num_keys, DBT *keys,
uint32_t num_vals, DBT *vals) /* update multiple DBs */;
int (*get_redzone) (DB_ENV *env, int *redzone) /* get the redzone limit */;
int (*set_redzone) (DB_ENV *env, int redzone) /* set the redzone limit in percent of total space */;
int (*set_lk_max_memory) (DB_ENV *env, uint64_t max);
......@@ -396,7 +398,7 @@ struct __toku_db_txn {
DB_ENV *mgrp /*In TokuDB, mgrp is a DB_ENV not a DB_TXNMGR*/; /* 32-bit offset=0 size=4, 64=bit offset=0 size=8 */
DB_TXN *parent; /* 32-bit offset=4 size=4, 64=bit offset=8 size=8 */
int (*txn_stat)(DB_TXN *, struct txn_stat **);
struct { void *next, *prev; } open_txns;
struct toku_list open_txns;
int (*commit_with_progress)(DB_TXN*, uint32_t, TXN_PROGRESS_POLL_FUNCTION, void*);
int (*abort_with_progress)(DB_TXN*, TXN_PROGRESS_POLL_FUNCTION, void*);
void* __toku_dummy0[10];
......
#ifndef _DB_H
#define _DB_H
/* This code generated by make_db_h. Copyright (c) 2007, 2008 Tokutek */
#ident "Copyright (c) 2007, 2008 Tokutek Inc. All rights reserved."
/* This code generated by make_db_h. Copyright (c) 2007-2011 Tokutek */
#ident "Copyright (c) 2007-2011 Tokutek Inc. All rights reserved."
#include <sys/types.h>
/*stdio is needed for the FILE* in db->verify*/
#include <stdio.h>
......@@ -23,6 +23,7 @@ extern "C" {
#define TOKU_OFF_T_DEFINED
typedef int64_t toku_off_t;
#endif
#define DB_GID_SIZE 128
typedef struct __toku_db_env DB_ENV;
typedef struct __toku_db_key_range DB_KEY_RANGE;
typedef struct __toku_db_lsn DB_LSN;
......@@ -32,6 +33,7 @@ typedef struct __toku_db_txn_active DB_TXN_ACTIVE;
typedef struct __toku_db_txn_stat DB_TXN_STAT;
typedef struct __toku_dbc DBC;
typedef struct __toku_dbt DBT;
typedef struct __toku_db_preplist { DB_TXN *txn; uint8_t gid[DB_GID_SIZE]; } DB_PREPLIST;
typedef u_int32_t db_recno_t;
typedef int(*YDB_CALLBACK_FUNCTION)(DBT const*, DBT const*, void*);
#include <tdb-internal.h>
......@@ -212,19 +214,19 @@ struct __toku_db_env {
int (*create_loader) (DB_ENV *env, DB_TXN *txn, DB_LOADER **blp, DB *src_db, int N, DB *dbs[/*N*/], uint32_t db_flags[/*N*/], uint32_t dbt_flags[/*N*/], uint32_t loader_flags);
int (*create_indexer) (DB_ENV *env, DB_TXN *txn, DB_INDEXER **idxrp, DB *src_db, int N, DB *dbs[/*N*/], uint32_t db_flags[/*N*/], uint32_t indexer_flags);
int (*put_multiple) (DB_ENV *env, DB *src_db, DB_TXN *txn,
const DBT *src_key, const DBT *src_val,
uint32_t num_dbs, DB **db_array, DBT *keys, DBT *vals, uint32_t *flags_array) /* insert into multiple DBs */;
const DBT *src_key, const DBT *src_val,
uint32_t num_dbs, DB **db_array, DBT *keys, DBT *vals, uint32_t *flags_array) /* insert into multiple DBs */;
int (*set_generate_row_callback_for_put) (DB_ENV *env, generate_row_for_put_func generate_row_for_put);
int (*del_multiple) (DB_ENV *env, DB *src_db, DB_TXN *txn,
const DBT *src_key, const DBT *src_val,
uint32_t num_dbs, DB **db_array, DBT *keys, uint32_t *flags_array) /* delete from multiple DBs */;
const DBT *src_key, const DBT *src_val,
uint32_t num_dbs, DB **db_array, DBT *keys, uint32_t *flags_array) /* delete from multiple DBs */;
int (*set_generate_row_callback_for_del) (DB_ENV *env, generate_row_for_del_func generate_row_for_del);
int (*update_multiple) (DB_ENV *env, DB *src_db, DB_TXN *txn,
DBT *old_src_key, DBT *old_src_data,
DBT *new_src_key, DBT *new_src_data,
uint32_t num_dbs, DB **db_array, uint32_t *flags_array,
uint32_t num_keys, DBT *keys,
uint32_t num_vals, DBT *vals) /* update multiple DBs */;
DBT *old_src_key, DBT *old_src_data,
DBT *new_src_key, DBT *new_src_data,
uint32_t num_dbs, DB **db_array, uint32_t *flags_array,
uint32_t num_keys, DBT *keys,
uint32_t num_vals, DBT *vals) /* update multiple DBs */;
int (*get_redzone) (DB_ENV *env, int *redzone) /* get the redzone limit */;
int (*set_redzone) (DB_ENV *env, int redzone) /* set the redzone limit in percent of total space */;
int (*set_lk_max_memory) (DB_ENV *env, uint64_t max);
......@@ -402,7 +404,7 @@ struct __toku_db_txn {
DB_ENV *mgrp /*In TokuDB, mgrp is a DB_ENV not a DB_TXNMGR*/; /* 32-bit offset=0 size=4, 64=bit offset=0 size=8 */
DB_TXN *parent; /* 32-bit offset=4 size=4, 64=bit offset=8 size=8 */
int (*txn_stat)(DB_TXN *, struct txn_stat **);
struct { void *next, *prev; } open_txns;
struct toku_list open_txns;
int (*commit_with_progress)(DB_TXN*, uint32_t, TXN_PROGRESS_POLL_FUNCTION, void*);
int (*abort_with_progress)(DB_TXN*, TXN_PROGRESS_POLL_FUNCTION, void*);
void* __toku_dummy0[13];
......
#ifndef _DB_H
#define _DB_H
/* This code generated by make_db_h. Copyright (c) 2007, 2008 Tokutek */
#ident "Copyright (c) 2007, 2008 Tokutek Inc. All rights reserved."
/* This code generated by make_db_h. Copyright (c) 2007-2011 Tokutek */
#ident "Copyright (c) 2007-2011 Tokutek Inc. All rights reserved."
#include <sys/types.h>
/*stdio is needed for the FILE* in db->verify*/
#include <stdio.h>
......@@ -23,6 +23,7 @@ extern "C" {
#define TOKU_OFF_T_DEFINED
typedef int64_t toku_off_t;
#endif
#define DB_GID_SIZE 128
typedef struct __toku_db_env DB_ENV;
typedef struct __toku_db_key_range DB_KEY_RANGE;
typedef struct __toku_db_lsn DB_LSN;
......@@ -32,6 +33,7 @@ typedef struct __toku_db_txn_active DB_TXN_ACTIVE;
typedef struct __toku_db_txn_stat DB_TXN_STAT;
typedef struct __toku_dbc DBC;
typedef struct __toku_dbt DBT;
typedef struct __toku_db_preplist { DB_TXN *txn; uint8_t gid[DB_GID_SIZE]; } DB_PREPLIST;
typedef u_int32_t db_recno_t;
typedef int(*YDB_CALLBACK_FUNCTION)(DBT const*, DBT const*, void*);
#include <tdb-internal.h>
......@@ -212,19 +214,19 @@ struct __toku_db_env {
int (*create_loader) (DB_ENV *env, DB_TXN *txn, DB_LOADER **blp, DB *src_db, int N, DB *dbs[/*N*/], uint32_t db_flags[/*N*/], uint32_t dbt_flags[/*N*/], uint32_t loader_flags);
int (*create_indexer) (DB_ENV *env, DB_TXN *txn, DB_INDEXER **idxrp, DB *src_db, int N, DB *dbs[/*N*/], uint32_t db_flags[/*N*/], uint32_t indexer_flags);
int (*put_multiple) (DB_ENV *env, DB *src_db, DB_TXN *txn,
const DBT *src_key, const DBT *src_val,
uint32_t num_dbs, DB **db_array, DBT *keys, DBT *vals, uint32_t *flags_array) /* insert into multiple DBs */;
const DBT *src_key, const DBT *src_val,
uint32_t num_dbs, DB **db_array, DBT *keys, DBT *vals, uint32_t *flags_array) /* insert into multiple DBs */;
int (*set_generate_row_callback_for_put) (DB_ENV *env, generate_row_for_put_func generate_row_for_put);
int (*del_multiple) (DB_ENV *env, DB *src_db, DB_TXN *txn,
const DBT *src_key, const DBT *src_val,
uint32_t num_dbs, DB **db_array, DBT *keys, uint32_t *flags_array) /* delete from multiple DBs */;
const DBT *src_key, const DBT *src_val,
uint32_t num_dbs, DB **db_array, DBT *keys, uint32_t *flags_array) /* delete from multiple DBs */;
int (*set_generate_row_callback_for_del) (DB_ENV *env, generate_row_for_del_func generate_row_for_del);
int (*update_multiple) (DB_ENV *env, DB *src_db, DB_TXN *txn,
DBT *old_src_key, DBT *old_src_data,
DBT *new_src_key, DBT *new_src_data,
uint32_t num_dbs, DB **db_array, uint32_t *flags_array,
uint32_t num_keys, DBT *keys,
uint32_t num_vals, DBT *vals) /* update multiple DBs */;
DBT *old_src_key, DBT *old_src_data,
DBT *new_src_key, DBT *new_src_data,
uint32_t num_dbs, DB **db_array, uint32_t *flags_array,
uint32_t num_keys, DBT *keys,
uint32_t num_vals, DBT *vals) /* update multiple DBs */;
int (*get_redzone) (DB_ENV *env, int *redzone) /* get the redzone limit */;
int (*set_redzone) (DB_ENV *env, int redzone) /* set the redzone limit in percent of total space */;
int (*set_lk_max_memory) (DB_ENV *env, uint64_t max);
......@@ -402,7 +404,7 @@ struct __toku_db_txn {
DB_ENV *mgrp /*In TokuDB, mgrp is a DB_ENV not a DB_TXNMGR*/; /* 32-bit offset=0 size=4, 64=bit offset=0 size=8 */
DB_TXN *parent; /* 32-bit offset=4 size=4, 64=bit offset=8 size=8 */
int (*txn_stat)(DB_TXN *, struct txn_stat **);
struct { void *next, *prev; } open_txns;
struct toku_list open_txns;
int (*commit_with_progress)(DB_TXN*, uint32_t, TXN_PROGRESS_POLL_FUNCTION, void*);
int (*abort_with_progress)(DB_TXN*, TXN_PROGRESS_POLL_FUNCTION, void*);
void* __toku_dummy0[13];
......
#ifndef _DB_H
#define _DB_H
/* This code generated by make_db_h. Copyright (c) 2007, 2008 Tokutek */
#ident "Copyright (c) 2007, 2008 Tokutek Inc. All rights reserved."
/* This code generated by make_db_h. Copyright (c) 2007-2011 Tokutek */
#ident "Copyright (c) 2007-2011 Tokutek Inc. All rights reserved."
#include <sys/types.h>
/*stdio is needed for the FILE* in db->verify*/
#include <stdio.h>
......@@ -23,6 +23,7 @@ extern "C" {
#define TOKU_OFF_T_DEFINED
typedef int64_t toku_off_t;
#endif
#define DB_GID_SIZE 128
typedef struct __toku_db_env DB_ENV;
typedef struct __toku_db_key_range DB_KEY_RANGE;
typedef struct __toku_db_lsn DB_LSN;
......@@ -32,6 +33,7 @@ typedef struct __toku_db_txn_active DB_TXN_ACTIVE;
typedef struct __toku_db_txn_stat DB_TXN_STAT;
typedef struct __toku_dbc DBC;
typedef struct __toku_dbt DBT;
typedef struct __toku_db_preplist { DB_TXN *txn; uint8_t gid[DB_GID_SIZE]; } DB_PREPLIST;
typedef u_int32_t db_recno_t;
typedef int(*YDB_CALLBACK_FUNCTION)(DBT const*, DBT const*, void*);
#include <tdb-internal.h>
......@@ -213,19 +215,19 @@ struct __toku_db_env {
int (*create_loader) (DB_ENV *env, DB_TXN *txn, DB_LOADER **blp, DB *src_db, int N, DB *dbs[/*N*/], uint32_t db_flags[/*N*/], uint32_t dbt_flags[/*N*/], uint32_t loader_flags);
int (*create_indexer) (DB_ENV *env, DB_TXN *txn, DB_INDEXER **idxrp, DB *src_db, int N, DB *dbs[/*N*/], uint32_t db_flags[/*N*/], uint32_t indexer_flags);
int (*put_multiple) (DB_ENV *env, DB *src_db, DB_TXN *txn,
const DBT *src_key, const DBT *src_val,
uint32_t num_dbs, DB **db_array, DBT *keys, DBT *vals, uint32_t *flags_array) /* insert into multiple DBs */;
const DBT *src_key, const DBT *src_val,
uint32_t num_dbs, DB **db_array, DBT *keys, DBT *vals, uint32_t *flags_array) /* insert into multiple DBs */;
int (*set_generate_row_callback_for_put) (DB_ENV *env, generate_row_for_put_func generate_row_for_put);
int (*del_multiple) (DB_ENV *env, DB *src_db, DB_TXN *txn,
const DBT *src_key, const DBT *src_val,
uint32_t num_dbs, DB **db_array, DBT *keys, uint32_t *flags_array) /* delete from multiple DBs */;
const DBT *src_key, const DBT *src_val,
uint32_t num_dbs, DB **db_array, DBT *keys, uint32_t *flags_array) /* delete from multiple DBs */;
int (*set_generate_row_callback_for_del) (DB_ENV *env, generate_row_for_del_func generate_row_for_del);
int (*update_multiple) (DB_ENV *env, DB *src_db, DB_TXN *txn,
DBT *old_src_key, DBT *old_src_data,
DBT *new_src_key, DBT *new_src_data,
uint32_t num_dbs, DB **db_array, uint32_t *flags_array,
uint32_t num_keys, DBT *keys,
uint32_t num_vals, DBT *vals) /* update multiple DBs */;
DBT *old_src_key, DBT *old_src_data,
DBT *new_src_key, DBT *new_src_data,
uint32_t num_dbs, DB **db_array, uint32_t *flags_array,
uint32_t num_keys, DBT *keys,
uint32_t num_vals, DBT *vals) /* update multiple DBs */;
int (*get_redzone) (DB_ENV *env, int *redzone) /* get the redzone limit */;
int (*set_redzone) (DB_ENV *env, int redzone) /* set the redzone limit in percent of total space */;
int (*set_lk_max_memory) (DB_ENV *env, uint64_t max);
......@@ -405,7 +407,7 @@ struct __toku_db_txn {
DB_ENV *mgrp /*In TokuDB, mgrp is a DB_ENV not a DB_TXNMGR*/; /* 32-bit offset=0 size=4, 64=bit offset=0 size=8 */
DB_TXN *parent; /* 32-bit offset=4 size=4, 64=bit offset=8 size=8 */
int (*txn_stat)(DB_TXN *, struct txn_stat **);
struct { void *next, *prev; } open_txns;
struct toku_list open_txns;
int (*commit_with_progress)(DB_TXN*, uint32_t, TXN_PROGRESS_POLL_FUNCTION, void*);
int (*abort_with_progress)(DB_TXN*, TXN_PROGRESS_POLL_FUNCTION, void*);
void* __toku_dummy0[14];
......
/* -*- mode: C; c-basic-offset: 4 -*- */
#ident "Copyright (c) 2007, 2008 Tokutek Inc. All rights reserved."
#ident "Copyright (c) 2007-2011 Tokutek Inc. All rights reserved."
#ident "$Id$"
/* LICENSE: This file is licensed under the GPL or from Tokutek. */
/* Make a db.h that will be link-time compatible with Sleepycat's Berkeley DB. */
......@@ -40,14 +41,14 @@ void print_db_notices (void) {
if (!(flags & bit)) break; \
} \
assert(which < 32); \
printf("#define %s %d\n", #name, bit); \
printf("#define %s %u\n", #name, bit); \
flags |= bit; \
} while (0)
#define dodefine_track_enum(flags, name) do {assert(name>=0 && name<256); \
assert(!(flags[name])); \
flags[name] = 1; \
printf("#define %s %d\n", #name, name);} while (0)
printf("#define %s %d\n", #name, (int)(name));} while (0)
#define dodefine_from_track_enum(flags, name) do { \
uint32_t which; \
/* don't use 0 */ \
......@@ -56,7 +57,7 @@ void print_db_notices (void) {
} \
assert(which < 256); \
flags[which] = 1; \
printf("#define %s %d\n", #name, which); \
printf("#define %s %u\n", #name, which); \
} while (0)
......@@ -74,8 +75,9 @@ enum {
TOKUDB_MVCC_DICTIONARY_TOO_NEW = -100010,
TOKUDB_UPGRADE_FAILURE = -100011,
TOKUDB_TRY_AGAIN = -100012,
TOKUDB_NEEDS_REPAIR = -100013,
TOKUDB_NEEDS_REPAIR = -100013,
TOKUDB_CURSOR_CONTINUE = -100014,
DONTUSE_I_JUST_PUT_THIS_HERE_SO_I_COULD_HAVE_A_COMMA_AFTER_EACH_ITEM
};
static void print_defines (void) {
......@@ -273,96 +275,97 @@ static void print_struct (const char *structname, enum need_internal_type need_i
assert(need_internal==NO_INTERNAL || need_internal==INTERNAL_NAMED || need_internal==INTERNAL_AT_END);
printf("struct __toku_%s {\n", structname);
for (i=0; i<N-1; i++) {
unsigned int this_32 = fields32[i].off;
unsigned int this_64 = fields64[i].off;
//fprintf(stderr, "this32=%d current32=%d this64=%d current64=%d\n", this_32, current_32, this_64, current_64);
if (this_32 > current_32 || this_64 > current_64) {
unsigned int diff32 = this_32-current_32;
unsigned int diff64 = this_64-current_64;
assert(this_32 > current_32 && this_64 > current_64);
if (diff32!=diff64) {
unsigned int diff = diff64-diff32;
unsigned int n_dummys = diff/4;
if (need_internal==INTERNAL_NAMED && !did_toku_internal) {
if (TDB_NATIVE &&
(strcmp(structname, "dbc")==0 ||
strcmp(structname, "db_txn")==0)) {
printf(" struct __toku_%s_internal ii;\n", structname);
printf("#define %s_struct_i(x) (&(x)->ii)\n", structname);
} else {
printf(" struct __toku_%s_internal *i;\n", structname);
printf("#define %s_struct_i(x) ((x)->i)\n", structname);
}
n_dummys--;
did_toku_internal=1;
}
while (n_dummys>0 && extra_decls && *extra_decls) {
printf(" %s;\n", *extra_decls);
extra_decls++;
n_dummys--;
}
if (n_dummys>0) {
if (!TDB_NATIVE)
printf(" void* __toku_dummy%d[%d];\n", dummy_counter, n_dummys);
dummy_counter++;
}
diff64-=diff*2;
diff32-=diff;
}
assert(diff32==diff64);
if (diff32>0) {
if (!TDB_NATIVE)
printf(" char __toku_dummy%d[%d];\n", dummy_counter, diff32);
dummy_counter++;
}
current_32 = this_32;
current_64 = this_64;
}
if (this_32<current_32 || this_64<current_64) {
printf("Whoops this_32=%d this_64=%d\n", this_32, this_64);
}
if (i+1<N) {
assert(strcmp(fields32[i].decl, fields64[i].decl)==0);
printf(" %s;", fields32[i].decl);
if (!TDB_NATIVE)
printf(" /* 32-bit offset=%d size=%d, 64=bit offset=%d size=%d */", fields32[i].off, fields32[i].size, fields64[i].off, fields64[i].size);
printf("\n");
} else {
assert(fields32[i].decl==0);
assert(fields64[i].decl==0);
}
current_32 += fields32[i].size;
current_64 += fields64[i].size;
unsigned int this_32 = fields32[i].off;
unsigned int this_64 = fields64[i].off;
//fprintf(stderr, "this32=%d current32=%d this64=%d current64=%d\n", this_32, current_32, this_64, current_64);
if (this_32 > current_32 || this_64 > current_64) {
unsigned int diff32 = this_32-current_32;
unsigned int diff64 = this_64-current_64;
assert(this_32 > current_32 && this_64 > current_64);
if (diff32!=diff64) {
unsigned int diff = diff64-diff32;
unsigned int n_dummys = diff/4;
if (need_internal==INTERNAL_NAMED && !did_toku_internal) {
if (TDB_NATIVE &&
(strcmp(structname, "dbc")==0 ||
strcmp(structname, "db_txn")==0)) {
printf(" struct __toku_%s_internal ii;\n", structname);
printf("#define %s_struct_i(x) (&(x)->ii)\n", structname);
} else {
printf(" struct __toku_%s_internal *i;\n", structname);
printf("#define %s_struct_i(x) ((x)->i)\n", structname);
}
n_dummys--;
did_toku_internal=1;
}
while (n_dummys>0 && extra_decls && *extra_decls) {
printf(" %s;\n", *extra_decls);
extra_decls++;
n_dummys--;
}
if (n_dummys>0) {
if (!TDB_NATIVE)
printf(" void* __toku_dummy%d[%u];\n", dummy_counter, n_dummys);
dummy_counter++;
}
diff64-=diff*2;
diff32-=diff;
}
assert(diff32==diff64);
if (diff32>0) {
if (!TDB_NATIVE)
printf(" char __toku_dummy%d[%u];\n", dummy_counter, diff32);
dummy_counter++;
}
current_32 = this_32;
current_64 = this_64;
}
if (this_32<current_32 || this_64<current_64) {
printf("Whoops this_32=%u this_64=%u\n", this_32, this_64);
}
if (i+1<N) {
if (strcmp(fields32[i].decl, fields64[i].decl)!=0) fprintf(stderr, "decl didn't match for %s\n", fields32[i].decl),
assert(strcmp(fields32[i].decl, fields64[i].decl)==0);
printf(" %s;", fields32[i].decl);
if (!TDB_NATIVE)
printf(" /* 32-bit offset=%u size=%u, 64=bit offset=%u size=%u */", fields32[i].off, fields32[i].size, fields64[i].off, fields64[i].size);
printf("\n");
} else {
assert(fields32[i].decl==0);
assert(fields64[i].decl==0);
}
current_32 += fields32[i].size;
current_64 += fields64[i].size;
}
if (extra_decls) assert(NULL==*extra_decls); // make sure that the extra decls all got used up.
{
unsigned int this_32 = fields32[N-1].off;
unsigned int this_64 = fields64[N-1].off;
unsigned int diff32 = this_32-current_32;
unsigned int diff64 = this_64-current_64;
if (diff32>0 && diff32<diff64) {
unsigned int diff = diff64-diff32;
if (!TDB_NATIVE)
printf(" void* __toku_dummy%d[%d]; /* Padding at the end */ \n", dummy_counter, diff/4);
dummy_counter++;
diff64-=diff*2;
diff32-=diff;
}
if (diff32>0) {
if (!TDB_NATIVE)
printf(" char __toku_dummy%d[%d]; /* Padding at the end */ \n", dummy_counter, diff32);
dummy_counter++;
diff64-=diff32;
diff32=0;
}
if (diff64>0)
if (!TDB_NATIVE)
printf(" /* %d more bytes of alignment in the 64-bit case. */\n", diff64);
assert(diff64<8); /* there could be a few left from alignment. */
unsigned int this_32 = fields32[N-1].off;
unsigned int this_64 = fields64[N-1].off;
unsigned int diff32 = this_32-current_32;
unsigned int diff64 = this_64-current_64;
if (diff32>0 && diff32<diff64) {
unsigned int diff = diff64-diff32;
if (!TDB_NATIVE)
printf(" void* __toku_dummy%d[%u]; /* Padding at the end */ \n", dummy_counter, diff/4);
dummy_counter++;
diff64-=diff*2;
diff32-=diff;
}
if (diff32>0) {
if (!TDB_NATIVE)
printf(" char __toku_dummy%d[%u]; /* Padding at the end */ \n", dummy_counter, diff32);
dummy_counter++;
diff64-=diff32;
diff32=0;
}
if (diff64>0)
if (!TDB_NATIVE)
printf(" /* %u more bytes of alignment in the 64-bit case. */\n", diff64);
assert(diff64<8); /* there could be a few left from alignment. */
}
if (need_internal==INTERNAL_AT_END) {
did_toku_internal = 1;
did_toku_internal = 1;
}
printf("};\n");
assert(did_toku_internal || !need_internal);
......@@ -371,8 +374,8 @@ static void print_struct (const char *structname, enum need_internal_type need_i
int main (int argc __attribute__((__unused__)), char *const argv[] __attribute__((__unused__))) {
printf("#ifndef _DB_H\n");
printf("#define _DB_H\n");
printf("/* This code generated by make_db_h. Copyright (c) 2007, 2008 Tokutek */\n");
printf("#ident \"Copyright (c) 2007, 2008 Tokutek Inc. All rights reserved.\"\n");
printf("/* This code generated by make_db_h. Copyright (c) 2007-2011 Tokutek */\n");
printf("#ident \"Copyright (c) 2007-2011 Tokutek Inc. All rights reserved.\"\n");
printf("#include <sys/types.h>\n");
printf("/*stdio is needed for the FILE* in db->verify*/\n");
printf("#include <stdio.h>\n");
......@@ -394,10 +397,10 @@ int main (int argc __attribute__((__unused__)), char *const argv[] __attribute__
printf("#endif\n");
if (0) {
printf("#ifndef __BIT_TYPES_DEFINED__\n");
printf("/* Define some int types if not provided by the system. BIND does this, so we do it too. */\n");
printf("typedef unsigned int u_int32_t;\n");
printf("#endif\n");
printf("#ifndef __BIT_TYPES_DEFINED__\n");
printf("/* Define some int types if not provided by the system. BIND does this, so we do it too. */\n");
printf("typedef unsigned int u_int32_t;\n");
printf("#endif\n");
}
//Typedef toku_off_t
......@@ -406,6 +409,11 @@ int main (int argc __attribute__((__unused__)), char *const argv[] __attribute__
"typedef int64_t toku_off_t;\n"
"#endif\n");
#ifndef DB_GID_SIZE
#define DB_GID_SIZE DB_XIDDATASIZE
#endif
dodefine(DB_GID_SIZE);
//printf("typedef struct __toku_db_btree_stat DB_BTREE_STAT;\n");
printf("typedef struct __toku_db_env DB_ENV;\n");
printf("typedef struct __toku_db_key_range DB_KEY_RANGE;\n");
......@@ -416,6 +424,7 @@ int main (int argc __attribute__((__unused__)), char *const argv[] __attribute__
printf("typedef struct __toku_db_txn_stat DB_TXN_STAT;\n");
printf("typedef struct __toku_dbc DBC;\n");
printf("typedef struct __toku_dbt DBT;\n");
printf("typedef struct __toku_db_preplist { DB_TXN *txn; uint8_t gid[DB_GID_SIZE]; } DB_PREPLIST;\n");
printf("typedef u_int32_t db_recno_t;\n");
printf("typedef int(*YDB_CALLBACK_FUNCTION)(DBT const*, DBT const*, void*);\n");
......@@ -502,48 +511,47 @@ int main (int argc __attribute__((__unused__)), char *const argv[] __attribute__
//print_struct("db_btree_stat", 0, db_btree_stat_fields32, db_btree_stat_fields64, sizeof(db_btree_stat_fields32)/sizeof(db_btree_stat_fields32[0]), 0);
assert(sizeof(db_env_fields32)==sizeof(db_env_fields64));
{
const char *extra[]= {
"int (*checkpointing_set_period) (DB_ENV*, u_int32_t) /* Change the delay between automatic checkpoints. 0 means disabled. */",
"int (*checkpointing_get_period) (DB_ENV*, u_int32_t*) /* Retrieve the delay between automatic checkpoints. 0 means disabled. */",
"int (*cleaner_set_period) (DB_ENV*, u_int32_t) /* Change the delay between automatic cleaner attempts. 0 means disabled. */",
"int (*cleaner_get_period) (DB_ENV*, u_int32_t*) /* Retrieve the delay between automatic cleaner attempts. 0 means disabled. */",
"int (*cleaner_set_iterations) (DB_ENV*, u_int32_t) /* Change the number of attempts on each cleaner invokation. 0 means disabled. */",
"int (*cleaner_get_iterations) (DB_ENV*, u_int32_t*) /* Retrieve the number of attempts on each cleaner invokation. 0 means disabled. */",
"int (*checkpointing_postpone) (DB_ENV*) /* Use for 'rename table' or any other operation that must be disjoint from a checkpoint */",
"int (*checkpointing_resume) (DB_ENV*) /* Alert tokudb 'postpone' is no longer necessary */",
"int (*checkpointing_begin_atomic_operation) (DB_ENV*) /* Begin a set of operations (that must be atomic as far as checkpoints are concerned). i.e. inserting into every index in one table */",
"int (*checkpointing_end_atomic_operation) (DB_ENV*) /* End a set of operations (that must be atomic as far as checkpoints are concerned). */",
"int (*set_default_bt_compare) (DB_ENV*,int (*bt_compare) (DB *, const DBT *, const DBT *)) /* Set default (key) comparison function for all DBs in this environment. Required for RECOVERY since you cannot open the DBs manually. */",
"int (*get_engine_status_num_rows) (DB_ENV*, uint64_t*) /* return number of rows in engine status */",
"int (*get_engine_status) (DB_ENV*, TOKU_ENGINE_STATUS_ROW, uint64_t, fs_redzone_state*, uint64_t*, char*, int) /* Fill in status struct and redzone state, possibly env panic string */",
"int (*get_engine_status_text) (DB_ENV*, char*, int) /* Fill in status text */",
"int (*crash) (DB_ENV*, const char*/*expr_as_string*/,const char */*fun*/,const char*/*file*/,int/*line*/, int/*errno*/);",
"int (*get_iname) (DB_ENV* env, DBT* dname_dbt, DBT* iname_dbt) /* FOR TEST ONLY: lookup existing iname */",
"int (*create_loader) (DB_ENV *env, DB_TXN *txn, DB_LOADER **blp, DB *src_db, int N, DB *dbs[/*N*/], uint32_t db_flags[/*N*/], uint32_t dbt_flags[/*N*/], uint32_t loader_flags)",
"int (*create_indexer) (DB_ENV *env, DB_TXN *txn, DB_INDEXER **idxrp, DB *src_db, int N, DB *dbs[/*N*/], uint32_t db_flags[/*N*/], uint32_t indexer_flags)",
"int (*put_multiple) (DB_ENV *env, DB *src_db, DB_TXN *txn,\n"
" const DBT *src_key, const DBT *src_val,\n"
" uint32_t num_dbs, DB **db_array, DBT *keys, DBT *vals, uint32_t *flags_array) /* insert into multiple DBs */",
"int (*set_generate_row_callback_for_put) (DB_ENV *env, generate_row_for_put_func generate_row_for_put)",
"int (*del_multiple) (DB_ENV *env, DB *src_db, DB_TXN *txn,\n"
" const DBT *src_key, const DBT *src_val,\n"
" uint32_t num_dbs, DB **db_array, DBT *keys, uint32_t *flags_array) /* delete from multiple DBs */",
"int (*set_generate_row_callback_for_del) (DB_ENV *env, generate_row_for_del_func generate_row_for_del)",
"int (*update_multiple) (DB_ENV *env, DB *src_db, DB_TXN *txn,\n"
" DBT *old_src_key, DBT *old_src_data,\n"
" DBT *new_src_key, DBT *new_src_data,\n"
" uint32_t num_dbs, DB **db_array, uint32_t *flags_array,\n"
" uint32_t num_keys, DBT *keys,\n"
" uint32_t num_vals, DBT *vals) /* update multiple DBs */",
"int (*get_redzone) (DB_ENV *env, int *redzone) /* get the redzone limit */",
"int (*set_redzone) (DB_ENV *env, int redzone) /* set the redzone limit in percent of total space */",
"int (*set_lk_max_memory) (DB_ENV *env, uint64_t max)",
"int (*get_lk_max_memory) (DB_ENV *env, uint64_t *max)",
"void (*set_update) (DB_ENV *env, int (*update_function)(DB *, const DBT *key, const DBT *old_val, const DBT *extra, void (*set_val)(const DBT *new_val, void *set_extra), void *set_extra))",
"int (*set_lock_timeout) (DB_ENV *env, uint64_t lock_wait_time_msec)",
"int (*get_lock_timeout) (DB_ENV *env, uint64_t *lock_wait_time_msec)",
NULL
};
const char *extra[]={
"int (*checkpointing_set_period) (DB_ENV*, u_int32_t) /* Change the delay between automatic checkpoints. 0 means disabled. */",
"int (*checkpointing_get_period) (DB_ENV*, u_int32_t*) /* Retrieve the delay between automatic checkpoints. 0 means disabled. */",
"int (*cleaner_set_period) (DB_ENV*, u_int32_t) /* Change the delay between automatic cleaner attempts. 0 means disabled. */",
"int (*cleaner_get_period) (DB_ENV*, u_int32_t*) /* Retrieve the delay between automatic cleaner attempts. 0 means disabled. */",
"int (*cleaner_set_iterations) (DB_ENV*, u_int32_t) /* Change the number of attempts on each cleaner invokation. 0 means disabled. */",
"int (*cleaner_get_iterations) (DB_ENV*, u_int32_t*) /* Retrieve the number of attempts on each cleaner invokation. 0 means disabled. */",
"int (*checkpointing_postpone) (DB_ENV*) /* Use for 'rename table' or any other operation that must be disjoint from a checkpoint */",
"int (*checkpointing_resume) (DB_ENV*) /* Alert tokudb 'postpone' is no longer necessary */",
"int (*checkpointing_begin_atomic_operation) (DB_ENV*) /* Begin a set of operations (that must be atomic as far as checkpoints are concerned). i.e. inserting into every index in one table */",
"int (*checkpointing_end_atomic_operation) (DB_ENV*) /* End a set of operations (that must be atomic as far as checkpoints are concerned). */",
"int (*set_default_bt_compare) (DB_ENV*,int (*bt_compare) (DB *, const DBT *, const DBT *)) /* Set default (key) comparison function for all DBs in this environment. Required for RECOVERY since you cannot open the DBs manually. */",
"int (*get_engine_status_num_rows) (DB_ENV*, uint64_t*) /* return number of rows in engine status */",
"int (*get_engine_status) (DB_ENV*, TOKU_ENGINE_STATUS_ROW, uint64_t, fs_redzone_state*, uint64_t*, char*, int) /* Fill in status struct and redzone state, possibly env panic string */",
"int (*get_engine_status_text) (DB_ENV*, char*, int) /* Fill in status text */",
"int (*crash) (DB_ENV*, const char*/*expr_as_string*/,const char */*fun*/,const char*/*file*/,int/*line*/, int/*errno*/);",
"int (*get_iname) (DB_ENV* env, DBT* dname_dbt, DBT* iname_dbt) /* FOR TEST ONLY: lookup existing iname */",
"int (*create_loader) (DB_ENV *env, DB_TXN *txn, DB_LOADER **blp, DB *src_db, int N, DB *dbs[/*N*/], uint32_t db_flags[/*N*/], uint32_t dbt_flags[/*N*/], uint32_t loader_flags)",
"int (*create_indexer) (DB_ENV *env, DB_TXN *txn, DB_INDEXER **idxrp, DB *src_db, int N, DB *dbs[/*N*/], uint32_t db_flags[/*N*/], uint32_t indexer_flags)",
"int (*put_multiple) (DB_ENV *env, DB *src_db, DB_TXN *txn,\n"
" const DBT *src_key, const DBT *src_val,\n"
" uint32_t num_dbs, DB **db_array, DBT *keys, DBT *vals, uint32_t *flags_array) /* insert into multiple DBs */",
"int (*set_generate_row_callback_for_put) (DB_ENV *env, generate_row_for_put_func generate_row_for_put)",
"int (*del_multiple) (DB_ENV *env, DB *src_db, DB_TXN *txn,\n"
" const DBT *src_key, const DBT *src_val,\n"
" uint32_t num_dbs, DB **db_array, DBT *keys, uint32_t *flags_array) /* delete from multiple DBs */",
"int (*set_generate_row_callback_for_del) (DB_ENV *env, generate_row_for_del_func generate_row_for_del)",
"int (*update_multiple) (DB_ENV *env, DB *src_db, DB_TXN *txn,\n"
" DBT *old_src_key, DBT *old_src_data,\n"
" DBT *new_src_key, DBT *new_src_data,\n"
" uint32_t num_dbs, DB **db_array, uint32_t *flags_array,\n"
" uint32_t num_keys, DBT *keys,\n"
" uint32_t num_vals, DBT *vals) /* update multiple DBs */",
"int (*get_redzone) (DB_ENV *env, int *redzone) /* get the redzone limit */",
"int (*set_redzone) (DB_ENV *env, int redzone) /* set the redzone limit in percent of total space */",
"int (*set_lk_max_memory) (DB_ENV *env, uint64_t max)",
"int (*get_lk_max_memory) (DB_ENV *env, uint64_t *max)",
"void (*set_update) (DB_ENV *env, int (*update_function)(DB *, const DBT *key, const DBT *old_val, const DBT *extra, void (*set_val)(const DBT *new_val, void *set_extra), void *set_extra))",
"int (*set_lock_timeout) (DB_ENV *env, uint64_t lock_wait_time_msec)",
"int (*get_lock_timeout) (DB_ENV *env, uint64_t *lock_wait_time_msec)",
NULL};
print_struct("db_env", 1, db_env_fields32, db_env_fields64, sizeof(db_env_fields32)/sizeof(db_env_fields32[0]), extra);
}
......@@ -552,8 +560,8 @@ int main (int argc __attribute__((__unused__)), char *const argv[] __attribute__
assert(sizeof(db_lsn_fields32)==sizeof(db_lsn_fields64));
{
//const char *extra[] = {"u_int64_t lsn", NULL};
print_struct("db_lsn", 0, db_lsn_fields32, db_lsn_fields64, sizeof(db_lsn_fields32)/sizeof(db_lsn_fields32[0]), 0);
//const char *extra[] = {"u_int64_t lsn", NULL};
print_struct("db_lsn", 0, db_lsn_fields32, db_lsn_fields64, sizeof(db_lsn_fields32)/sizeof(db_lsn_fields32[0]), 0);
}
assert(sizeof(dbt_fields32)==sizeof(dbt_fields64));
......@@ -581,16 +589,16 @@ int main (int argc __attribute__((__unused__)), char *const argv[] __attribute__
printf(" uint64_t largest_unused_block; //Size of largest contiguous unused space\n");
printf("} *TOKU_DB_FRAGMENTATION, TOKU_DB_FRAGMENTATION_S;\n");
const char *extra[]={"int (*key_range64)(DB*, DB_TXN *, DBT *, u_int64_t *less, u_int64_t *equal, u_int64_t *greater, int *is_exact)",
"int (*stat64)(DB *, DB_TXN *, DB_BTREE_STAT64 *)",
"int (*pre_acquire_table_lock)(DB*, DB_TXN*)",
"int (*pre_acquire_fileops_lock)(DB*, DB_TXN*)",
"const DBT* (*dbt_pos_infty)(void) /* Return the special DBT that refers to positive infinity in the lock table.*/",
"const DBT* (*dbt_neg_infty)(void)/* Return the special DBT that refers to negative infinity in the lock table.*/",
const char *extra[]={"int (*key_range64)(DB*, DB_TXN *, DBT *, u_int64_t *less, u_int64_t *equal, u_int64_t *greater, int *is_exact)",
"int (*stat64)(DB *, DB_TXN *, DB_BTREE_STAT64 *)",
"int (*pre_acquire_table_lock)(DB*, DB_TXN*)",
"int (*pre_acquire_fileops_lock)(DB*, DB_TXN*)",
"const DBT* (*dbt_pos_infty)(void) /* Return the special DBT that refers to positive infinity in the lock table.*/",
"const DBT* (*dbt_neg_infty)(void)/* Return the special DBT that refers to negative infinity in the lock table.*/",
"void (*get_max_row_size) (DB*, u_int32_t *max_key_size, u_int32_t *max_row_size)",
"DESCRIPTOR descriptor /* saved row/dictionary descriptor for aiding in comparisons */",
"int (*change_descriptor) (DB*, DB_TXN*, const DBT* descriptor, u_int32_t) /* change row/dictionary descriptor for a db. Available only while db is open */",
"int (*getf_set)(DB*, DB_TXN*, u_int32_t, DBT*, YDB_CALLBACK_FUNCTION, void*) /* same as DBC->c_getf_set without a persistent cursor) */",
"int (*getf_set)(DB*, DB_TXN*, u_int32_t, DBT*, YDB_CALLBACK_FUNCTION, void*) /* same as DBC->c_getf_set without a persistent cursor) */",
"int (*flatten)(DB*, DB_TXN*) /* Flatten a dictionary, similar to (but faster than) a table scan */",
"int (*optimize)(DB*) /* Run garbage collecion and promote all transactions older than oldest. Amortized (happens during flattening) */",
"int (*hot_optimize)(DB*, int (*progress_callback)(void *progress_extra, float progress), void *progress_extra)",
......@@ -600,10 +608,10 @@ int main (int argc __attribute__((__unused__)), char *const argv[] __attribute__
"int (*set_indexer)(DB*, DB_INDEXER*)",
"void (*get_indexer)(DB*, DB_INDEXER**)",
"int (*verify_with_progress)(DB *, int (*progress_callback)(void *progress_extra, float progress), void *progress_extra, int verbose, int keep_going)",
"int (*update)(DB *, DB_TXN*, const DBT *key, const DBT *extra, u_int32_t flags)",
"int (*update_broadcast)(DB *, DB_TXN*, const DBT *extra, u_int32_t flags)",
NULL};
print_struct("db", 1, db_fields32, db_fields64, sizeof(db_fields32)/sizeof(db_fields32[0]), extra);
"int (*update)(DB *, DB_TXN*, const DBT *key, const DBT *extra, u_int32_t flags)",
"int (*update_broadcast)(DB *, DB_TXN*, const DBT *extra, u_int32_t flags)",
NULL};
print_struct("db", 1, db_fields32, db_fields64, sizeof(db_fields32)/sizeof(db_fields32[0]), extra);
}
assert(sizeof(db_txn_active_fields32)==sizeof(db_txn_active_fields64));
......@@ -619,36 +627,35 @@ int main (int argc __attribute__((__unused__)), char *const argv[] __attribute__
printf("} *TOKU_TXN_PROGRESS, TOKU_TXN_PROGRESS_S;\n");
printf("typedef void(*TXN_PROGRESS_POLL_FUNCTION)(TOKU_TXN_PROGRESS, void*);\n");
printf("struct txn_stat {\n u_int64_t rollback_raw_count;\n};\n");
const char *extra[] = {
printf("struct txn_stat {\n u_int64_t rollback_raw_count;\n};\n");
const char *extra[] = {
"int (*txn_stat)(DB_TXN *, struct txn_stat **)",
"struct { void *next, *prev; } open_txns",
"struct toku_list open_txns",
"int (*commit_with_progress)(DB_TXN*, uint32_t, TXN_PROGRESS_POLL_FUNCTION, void*)",
"int (*abort_with_progress)(DB_TXN*, TXN_PROGRESS_POLL_FUNCTION, void*)",
NULL,
};
print_struct("db_txn", INTERNAL_AT_END, db_txn_fields32, db_txn_fields64, sizeof(db_txn_fields32)/sizeof(db_txn_fields32[0]), extra);
NULL};
print_struct("db_txn", INTERNAL_AT_END, db_txn_fields32, db_txn_fields64, sizeof(db_txn_fields32)/sizeof(db_txn_fields32[0]), extra);
}
assert(sizeof(db_txn_stat_fields32)==sizeof(db_txn_stat_fields64));
print_struct("db_txn_stat", 0, db_txn_stat_fields32, db_txn_stat_fields64, sizeof(db_txn_stat_fields32)/sizeof(db_txn_stat_fields32[0]), 0);
{
const char *extra[]={
"int (*c_getf_first)(DBC *, u_int32_t, YDB_CALLBACK_FUNCTION, void *)",
"int (*c_getf_last)(DBC *, u_int32_t, YDB_CALLBACK_FUNCTION, void *)",
const char *extra[]={
"int (*c_getf_first)(DBC *, u_int32_t, YDB_CALLBACK_FUNCTION, void *)",
"int (*c_getf_last)(DBC *, u_int32_t, YDB_CALLBACK_FUNCTION, void *)",
"int (*c_getf_next)(DBC *, u_int32_t, YDB_CALLBACK_FUNCTION, void *)",
"int (*c_getf_prev)(DBC *, u_int32_t, YDB_CALLBACK_FUNCTION, void *)",
"int (*c_getf_current)(DBC *, u_int32_t, YDB_CALLBACK_FUNCTION, void *)",
"int (*c_getf_current_binding)(DBC *, u_int32_t, YDB_CALLBACK_FUNCTION, void *)",
"int (*c_getf_set)(DBC *, u_int32_t, DBT *, YDB_CALLBACK_FUNCTION, void *)",
"int (*c_getf_set_range)(DBC *, u_int32_t, DBT *, YDB_CALLBACK_FUNCTION, void *)",
"int (*c_getf_set_range_reverse)(DBC *, u_int32_t, DBT *, YDB_CALLBACK_FUNCTION, void *)",
"int (*c_pre_acquire_range_lock)(DBC*, const DBT*, const DBT*)",
NULL};
assert(sizeof(dbc_fields32)==sizeof(dbc_fields64));
print_struct("dbc", INTERNAL_AT_END, dbc_fields32, dbc_fields64, sizeof(dbc_fields32)/sizeof(dbc_fields32[0]), extra);
"int (*c_getf_prev)(DBC *, u_int32_t, YDB_CALLBACK_FUNCTION, void *)",
"int (*c_getf_current)(DBC *, u_int32_t, YDB_CALLBACK_FUNCTION, void *)",
"int (*c_getf_current_binding)(DBC *, u_int32_t, YDB_CALLBACK_FUNCTION, void *)",
"int (*c_getf_set)(DBC *, u_int32_t, DBT *, YDB_CALLBACK_FUNCTION, void *)",
"int (*c_getf_set_range)(DBC *, u_int32_t, DBT *, YDB_CALLBACK_FUNCTION, void *)",
"int (*c_getf_set_range_reverse)(DBC *, u_int32_t, DBT *, YDB_CALLBACK_FUNCTION, void *)",
"int (*c_pre_acquire_range_lock)(DBC*, const DBT*, const DBT*)",
NULL};
assert(sizeof(dbc_fields32)==sizeof(dbc_fields64));
print_struct("dbc", INTERNAL_AT_END, dbc_fields32, dbc_fields64, sizeof(dbc_fields32)/sizeof(dbc_fields32[0]), extra);
}
printf("#ifdef _TOKUDB_WRAP_H\n#define txn_begin txn_begin_tokudb\n#endif\n");
......
/* -*- mode: C; c-basic-offset: 4 -*- */
#ident "Copyright (c) 2007, 2008 Tokutek Inc. All rights reserved."
#ident "$Id$"
/* LICENSE: This file is licensed under the GPL or from Tokutek. */
/* Make a db.h that will be link-time compatible with Sleepycat's Berkeley DB. */
......@@ -11,16 +12,16 @@
// Don't include toku_assert.h. Just use assert.h
#include <assert.h>
#define DECL_LIMIT 100
#define DECL_LIMIT 200
#define FIELD_LIMIT 100
struct fieldinfo {
char decl[DECL_LIMIT];
unsigned int off;
unsigned int size;
} fields[FIELD_LIMIT];
int field_counter=0;
static int field_counter=0;
int compare_fields (const void *av, const void *bv) {
static int compare_fields (const void *av, const void *bv) {
const struct fieldinfo *a = av;
const struct fieldinfo *b = bv;
if (a->off < b->off) return -1;
......@@ -28,14 +29,16 @@ int compare_fields (const void *av, const void *bv) {
return 0;
}
#define STRUCT_SETUP(typ, name, fstring) ({ snprintf(fields[field_counter].decl, DECL_LIMIT, fstring, #name); \
fields[field_counter].off = __builtin_offsetof(typ, name); \
{ typ dummy; \
fields[field_counter].size = sizeof(dummy.name); } \
#define STRUCT_SETUP(typ, name, fstring) ({ \
int len=snprintf(fields[field_counter].decl, DECL_LIMIT, fstring, #name); \
assert(len<DECL_LIMIT); \
fields[field_counter].off = __builtin_offsetof(typ, name); \
{ typ dummy; \
fields[field_counter].size = sizeof(dummy.name); } \
field_counter++; })
FILE *outf;
void open_file (void) {
static FILE *outf;
static void open_file (void) {
char fname[100];
#ifdef LOCAL
snprintf(fname, 100, "sample_offsets_local.h");
......@@ -47,32 +50,32 @@ void open_file (void) {
}
void sort_and_dump_fields (const char *structname, unsigned int sizeofstruct) {
static void sort_and_dump_fields (const char *structname, unsigned int sizeofstruct) {
int i;
qsort(fields, field_counter, sizeof(fields[0]), compare_fields);
fprintf(outf, "struct fieldinfo %s_fields%d[] = {\n", structname, __WORDSIZE);
for (i=0; i<field_counter; i++) {
fprintf(outf, " {\"%s\", %d, %d},\n", fields[i].decl, fields[i].off, fields[i].size);
fprintf(outf, " {\"%s\", %u, %u},\n", fields[i].decl, fields[i].off, fields[i].size);
}
fprintf(outf, " {0, %d, %d} /* size of whole struct */\n", sizeofstruct, sizeofstruct);
fprintf(outf, " {0, %u, %u} /* size of whole struct */\n", sizeofstruct, sizeofstruct);
fprintf(outf, "};\n");
}
void sample_db_btree_stat_offsets (void) {
static void sample_db_btree_stat_offsets (void) {
field_counter=0;
STRUCT_SETUP(DB_BTREE_STAT, bt_ndata, "u_int32_t %s");
STRUCT_SETUP(DB_BTREE_STAT, bt_nkeys, "u_int32_t %s");
sort_and_dump_fields("db_btree_stat", sizeof(DB_BTREE_STAT));
}
void sample_db_env_offsets (void) {
static void sample_db_env_offsets (void) {
field_counter=0;
STRUCT_SETUP(DB_ENV, api1_internal, "void *%s"); /* Used for C++ hacking. */
STRUCT_SETUP(DB_ENV, app_private, "void *%s");
STRUCT_SETUP(DB_ENV, close, "int (*%s) (DB_ENV *, u_int32_t)");
STRUCT_SETUP(DB_ENV, err, "void (*%s) (const DB_ENV *, int, const char *, ...)");
#if DB_VERSION_MAJOR == 4 && DB_VERSION_MINOR >= 3
STRUCT_SETUP(DB_ENV, get_cachesize, "int (*%s) (DB_ENV *, u_int32_t *, u_int32_t *, int *)");
STRUCT_SETUP(DB_ENV, get_cachesize, "int (*%s) (DB_ENV *, u_int32_t *, u_int32_t *, int *)");
STRUCT_SETUP(DB_ENV, get_flags, "int (*%s) (DB_ENV *, u_int32_t *)");
STRUCT_SETUP(DB_ENV, get_lk_max_locks, "int (*%s) (DB_ENV *, u_int32_t *)");
STRUCT_SETUP(DB_ENV, get_lg_max, "int (*%s) (DB_ENV *, u_int32_t*)");
......@@ -103,14 +106,15 @@ void sample_db_env_offsets (void) {
STRUCT_SETUP(DB_ENV, set_tmp_dir, "int (*%s) (DB_ENV *, const char *)");
STRUCT_SETUP(DB_ENV, set_verbose, "int (*%s) (DB_ENV *, u_int32_t, int)");
STRUCT_SETUP(DB_ENV, txn_checkpoint, "int (*%s) (DB_ENV *, u_int32_t, u_int32_t, u_int32_t)");
STRUCT_SETUP(DB_ENV, txn_stat, "int (*%s) (DB_ENV *, DB_TXN_STAT **, u_int32_t)");
STRUCT_SETUP(DB_ENV, txn_begin, "int (*%s) (DB_ENV *, DB_TXN *, DB_TXN **, u_int32_t)");
STRUCT_SETUP(DB_ENV, dbremove, "int (*%s) (DB_ENV *, DB_TXN *, const char *, const char *, u_int32_t)");
STRUCT_SETUP(DB_ENV, dbrename, "int (*%s) (DB_ENV *, DB_TXN *, const char *, const char *, const char *, u_int32_t)");
STRUCT_SETUP(DB_ENV, txn_stat, "int (*%s) (DB_ENV *, DB_TXN_STAT **, u_int32_t)");
STRUCT_SETUP(DB_ENV, txn_begin, "int (*%s) (DB_ENV *, DB_TXN *, DB_TXN **, u_int32_t)");
STRUCT_SETUP(DB_ENV, txn_recover, "int (*%s) (DB_ENV *, DB_PREPLIST preplist[/*count*/], long count, /*out*/ long *retp, u_int32_t flags)");
STRUCT_SETUP(DB_ENV, dbremove, "int (*%s) (DB_ENV *, DB_TXN *, const char *, const char *, u_int32_t)");
STRUCT_SETUP(DB_ENV, dbrename, "int (*%s) (DB_ENV *, DB_TXN *, const char *, const char *, const char *, u_int32_t)");
sort_and_dump_fields("db_env", sizeof(DB_ENV));
}
void sample_db_key_range_offsets (void) {
static void sample_db_key_range_offsets (void) {
field_counter=0;
STRUCT_SETUP(DB_KEY_RANGE, less, "double %s");
STRUCT_SETUP(DB_KEY_RANGE, equal, "double %s");
......@@ -118,12 +122,12 @@ void sample_db_key_range_offsets (void) {
sort_and_dump_fields("db_key_range", sizeof(DB_ENV));
}
void sample_db_lsn_offsets (void) {
static void sample_db_lsn_offsets (void) {
field_counter=0;
sort_and_dump_fields("db_lsn", sizeof(DB_LSN));
}
void sample_db_offsets (void) {
static void sample_db_offsets (void) {
/* Do these in alphabetical order. */
field_counter=0;
STRUCT_SETUP(DB, api_internal, "void *%s"); /* Used for C++ hacking. */
......@@ -152,32 +156,33 @@ void sample_db_offsets (void) {
sort_and_dump_fields("db", sizeof(DB));
}
void sample_db_txn_active_offsets (void) {
static void sample_db_txn_active_offsets (void) {
field_counter=0;
STRUCT_SETUP(DB_TXN_ACTIVE, lsn, "DB_LSN %s");
STRUCT_SETUP(DB_TXN_ACTIVE, txnid, "u_int32_t %s");
sort_and_dump_fields("db_txn_active", sizeof(DB_TXN_ACTIVE));
}
void sample_db_txn_offsets (void) {
static void sample_db_txn_offsets (void) {
field_counter=0;
STRUCT_SETUP(DB_TXN, abort, "int (*%s) (DB_TXN *)");
STRUCT_SETUP(DB_TXN, api_internal,"void *%s");
STRUCT_SETUP(DB_TXN, commit, "int (*%s) (DB_TXN*, u_int32_t)");
STRUCT_SETUP(DB_TXN, prepare, "int (*%s) (DB_TXN*, u_int8_t gid[DB_GID_SIZE])");
STRUCT_SETUP(DB_TXN, id, "u_int32_t (*%s) (DB_TXN *)");
STRUCT_SETUP(DB_TXN, mgrp, "DB_ENV *%s /*In TokuDB, mgrp is a DB_ENV not a DB_TXNMGR*/");
STRUCT_SETUP(DB_TXN, parent, "DB_TXN *%s");
sort_and_dump_fields("db_txn", sizeof(DB_TXN));
}
void sample_db_txn_stat_offsets (void) {
static void sample_db_txn_stat_offsets (void) {
field_counter=0;
STRUCT_SETUP(DB_TXN_STAT, st_nactive, "u_int32_t %s");
STRUCT_SETUP(DB_TXN_STAT, st_txnarray, "DB_TXN_ACTIVE *%s");
sort_and_dump_fields("db_txn_stat", sizeof(DB_TXN_STAT));
}
void sample_dbc_offsets (void) {
static void sample_dbc_offsets (void) {
field_counter=0;
STRUCT_SETUP(DBC, c_close, "int (*%s) (DBC *)");
STRUCT_SETUP(DBC, c_count, "int (*%s) (DBC *, db_recno_t *, u_int32_t)");
......@@ -187,7 +192,7 @@ void sample_dbc_offsets (void) {
sort_and_dump_fields("dbc", sizeof(DBC));
}
void sample_dbt_offsets (void) {
static void sample_dbt_offsets (void) {
field_counter=0;
#if 0 && DB_VERSION_MAJOR==4 && DB_VERSION_MINOR==1
STRUCT_SETUP(DBT, app_private, "void*%s");
......
......@@ -33,6 +33,7 @@ struct fieldinfo db_env_fields32[] = {
{"int (*set_cachesize) (DB_ENV *, u_int32_t, u_int32_t, int)", 452, 4},
{"int (*txn_begin) (DB_ENV *, DB_TXN *, DB_TXN **, u_int32_t)", 540, 4},
{"int (*txn_checkpoint) (DB_ENV *, u_int32_t, u_int32_t, u_int32_t)", 544, 4},
{"int (*txn_recover) (DB_ENV *, DB_PREPLIST preplist[/*count*/], long count, /*out*/ long *retp, u_int32_t flags)", 552, 4},
{"int (*txn_stat) (DB_ENV *, DB_TXN_STAT **, u_int32_t)", 556, 4},
{0, 576, 576} /* size of whole struct */
};
......@@ -79,6 +80,7 @@ struct fieldinfo db_txn_fields32[] = {
{"int (*abort) (DB_TXN *)", 76, 4},
{"int (*commit) (DB_TXN*, u_int32_t)", 80, 4},
{"u_int32_t (*id) (DB_TXN *)", 88, 4},
{"int (*prepare) (DB_TXN*, u_int8_t gid[DB_GID_SIZE])", 92, 4},
{0, 104, 104} /* size of whole struct */
};
struct fieldinfo db_txn_stat_fields32[] = {
......
......@@ -19,7 +19,7 @@ struct fieldinfo db_env_fields32[] = {
{"void (*set_errcall) (DB_ENV *, void (*)(const DB_ENV *, const char *, const char *))", 348, 4},
{"void (*set_errfile) (DB_ENV *, FILE*)", 356, 4},
{"void (*set_errpfx) (DB_ENV *, const char *)", 364, 4},
{"int (*get_flags) (DB_ENV *, u_int32_t *)", 372, 4},
{"int (*get_flags) (DB_ENV *, u_int32_t *)", 372, 4},
{"int (*set_flags) (DB_ENV *, u_int32_t, int)", 376, 4},
{"int (*set_tmp_dir) (DB_ENV *, const char *)", 432, 4},
{"int (*set_verbose) (DB_ENV *, u_int32_t, int)", 440, 4},
......@@ -33,10 +33,11 @@ struct fieldinfo db_env_fields32[] = {
{"int (*set_lk_max) (DB_ENV *, u_int32_t)", 528, 4},
{"int (*get_lk_max_locks) (DB_ENV *, u_int32_t *)", 532, 4},
{"int (*set_lk_max_locks) (DB_ENV *, u_int32_t)", 536, 4},
{"int (*get_cachesize) (DB_ENV *, u_int32_t *, u_int32_t *, int *)", 592, 4},
{"int (*get_cachesize) (DB_ENV *, u_int32_t *, u_int32_t *, int *)", 592, 4},
{"int (*set_cachesize) (DB_ENV *, u_int32_t, u_int32_t, int)", 596, 4},
{"int (*txn_begin) (DB_ENV *, DB_TXN *, DB_TXN **, u_int32_t)", 712, 4},
{"int (*txn_checkpoint) (DB_ENV *, u_int32_t, u_int32_t, u_int32_t)", 716, 4},
{"int (*txn_recover) (DB_ENV *, DB_PREPLIST preplist[/*count*/], long count, /*out*/ long *retp, u_int32_t flags)", 720, 4},
{"int (*txn_stat) (DB_ENV *, DB_TXN_STAT **, u_int32_t)", 724, 4},
{0, 756, 756} /* size of whole struct */
};
......@@ -85,6 +86,7 @@ struct fieldinfo db_txn_fields32[] = {
{"int (*abort) (DB_TXN *)", 100, 4},
{"int (*commit) (DB_TXN*, u_int32_t)", 104, 4},
{"u_int32_t (*id) (DB_TXN *)", 112, 4},
{"int (*prepare) (DB_TXN*, u_int8_t gid[DB_GID_SIZE])", 116, 4},
{0, 132, 132} /* size of whole struct */
};
struct fieldinfo db_txn_stat_fields32[] = {
......
......@@ -14,8 +14,8 @@ struct fieldinfo db_env_fields32[] = {
{"int (*dbremove) (DB_ENV *, DB_TXN *, const char *, const char *, u_int32_t)", 372, 4},
{"int (*dbrename) (DB_ENV *, DB_TXN *, const char *, const char *, const char *, u_int32_t)", 376, 4},
{"void (*err) (const DB_ENV *, int, const char *, ...)", 380, 4},
{"int (*get_cachesize) (DB_ENV *, u_int32_t *, u_int32_t *, int *)", 396, 4},
{"int (*get_flags) (DB_ENV *, u_int32_t *)", 416, 4},
{"int (*get_cachesize) (DB_ENV *, u_int32_t *, u_int32_t *, int *)", 396, 4},
{"int (*get_flags) (DB_ENV *, u_int32_t *)", 416, 4},
{"int (*get_lg_max) (DB_ENV *, u_int32_t*)", 436, 4},
{"int (*get_lk_max_locks) (DB_ENV *, u_int32_t *)", 456, 4},
{"int (*log_archive) (DB_ENV *, char **[], u_int32_t)", 548, 4},
......@@ -37,6 +37,7 @@ struct fieldinfo db_env_fields32[] = {
{"int (*set_verbose) (DB_ENV *, u_int32_t, int)", 872, 4},
{"int (*txn_begin) (DB_ENV *, DB_TXN *, DB_TXN **, u_int32_t)", 880, 4},
{"int (*txn_checkpoint) (DB_ENV *, u_int32_t, u_int32_t, u_int32_t)", 884, 4},
{"int (*txn_recover) (DB_ENV *, DB_PREPLIST preplist[/*count*/], long count, /*out*/ long *retp, u_int32_t flags)", 888, 4},
{"int (*txn_stat) (DB_ENV *, DB_TXN_STAT **, u_int32_t)", 892, 4},
{0, 920, 920} /* size of whole struct */
};
......@@ -85,6 +86,7 @@ struct fieldinfo db_txn_fields32[] = {
{"int (*abort) (DB_TXN *)", 96, 4},
{"int (*commit) (DB_TXN*, u_int32_t)", 100, 4},
{"u_int32_t (*id) (DB_TXN *)", 112, 4},
{"int (*prepare) (DB_TXN*, u_int8_t gid[DB_GID_SIZE])", 116, 4},
{0, 136, 136} /* size of whole struct */
};
struct fieldinfo db_txn_stat_fields32[] = {
......
......@@ -14,8 +14,8 @@ struct fieldinfo db_env_fields32[] = {
{"int (*dbremove) (DB_ENV *, DB_TXN *, const char *, const char *, u_int32_t)", 376, 4},
{"int (*dbrename) (DB_ENV *, DB_TXN *, const char *, const char *, const char *, u_int32_t)", 380, 4},
{"void (*err) (const DB_ENV *, int, const char *, ...)", 384, 4},
{"int (*get_cachesize) (DB_ENV *, u_int32_t *, u_int32_t *, int *)", 400, 4},
{"int (*get_flags) (DB_ENV *, u_int32_t *)", 420, 4},
{"int (*get_cachesize) (DB_ENV *, u_int32_t *, u_int32_t *, int *)", 400, 4},
{"int (*get_flags) (DB_ENV *, u_int32_t *)", 420, 4},
{"int (*get_lg_max) (DB_ENV *, u_int32_t*)", 440, 4},
{"int (*get_lk_max_locks) (DB_ENV *, u_int32_t *)", 460, 4},
{"int (*log_archive) (DB_ENV *, char **[], u_int32_t)", 548, 4},
......@@ -36,6 +36,7 @@ struct fieldinfo db_env_fields32[] = {
{"int (*set_verbose) (DB_ENV *, u_int32_t, int)", 924, 4},
{"int (*txn_begin) (DB_ENV *, DB_TXN *, DB_TXN **, u_int32_t)", 932, 4},
{"int (*txn_checkpoint) (DB_ENV *, u_int32_t, u_int32_t, u_int32_t)", 936, 4},
{"int (*txn_recover) (DB_ENV *, DB_PREPLIST preplist[/*count*/], long count, /*out*/ long *retp, u_int32_t flags)", 940, 4},
{"int (*txn_stat) (DB_ENV *, DB_TXN_STAT **, u_int32_t)", 944, 4},
{0, 972, 972} /* size of whole struct */
};
......@@ -84,6 +85,7 @@ struct fieldinfo db_txn_fields32[] = {
{"int (*abort) (DB_TXN *)", 96, 4},
{"int (*commit) (DB_TXN*, u_int32_t)", 100, 4},
{"u_int32_t (*id) (DB_TXN *)", 112, 4},
{"int (*prepare) (DB_TXN*, u_int8_t gid[DB_GID_SIZE])", 116, 4},
{0, 136, 136} /* size of whole struct */
};
struct fieldinfo db_txn_stat_fields32[] = {
......
......@@ -14,8 +14,8 @@ struct fieldinfo db_env_fields32[] = {
{"int (*dbremove) (DB_ENV *, DB_TXN *, const char *, const char *, u_int32_t)", 396, 4},
{"int (*dbrename) (DB_ENV *, DB_TXN *, const char *, const char *, const char *, u_int32_t)", 400, 4},
{"void (*err) (const DB_ENV *, int, const char *, ...)", 404, 4},
{"int (*get_cachesize) (DB_ENV *, u_int32_t *, u_int32_t *, int *)", 420, 4},
{"int (*get_flags) (DB_ENV *, u_int32_t *)", 444, 4},
{"int (*get_cachesize) (DB_ENV *, u_int32_t *, u_int32_t *, int *)", 420, 4},
{"int (*get_flags) (DB_ENV *, u_int32_t *)", 444, 4},
{"int (*get_lg_max) (DB_ENV *, u_int32_t*)", 464, 4},
{"int (*get_lk_max_locks) (DB_ENV *, u_int32_t *)", 484, 4},
{"int (*log_archive) (DB_ENV *, char **[], u_int32_t)", 576, 4},
......@@ -36,6 +36,7 @@ struct fieldinfo db_env_fields32[] = {
{"int (*set_verbose) (DB_ENV *, u_int32_t, int)", 968, 4},
{"int (*txn_begin) (DB_ENV *, DB_TXN *, DB_TXN **, u_int32_t)", 976, 4},
{"int (*txn_checkpoint) (DB_ENV *, u_int32_t, u_int32_t, u_int32_t)", 980, 4},
{"int (*txn_recover) (DB_ENV *, DB_PREPLIST preplist[/*count*/], long count, /*out*/ long *retp, u_int32_t flags)", 984, 4},
{"int (*txn_stat) (DB_ENV *, DB_TXN_STAT **, u_int32_t)", 988, 4},
{0, 1016, 1016} /* size of whole struct */
};
......@@ -84,6 +85,7 @@ struct fieldinfo db_txn_fields32[] = {
{"int (*abort) (DB_TXN *)", 100, 4},
{"int (*commit) (DB_TXN*, u_int32_t)", 104, 4},
{"u_int32_t (*id) (DB_TXN *)", 116, 4},
{"int (*prepare) (DB_TXN*, u_int8_t gid[DB_GID_SIZE])", 120, 4},
{0, 140, 140} /* size of whole struct */
};
struct fieldinfo db_txn_stat_fields32[] = {
......
......@@ -33,6 +33,7 @@ struct fieldinfo db_env_fields64[] = {
{"int (*set_cachesize) (DB_ENV *, u_int32_t, u_int32_t, int)", 840, 8},
{"int (*txn_begin) (DB_ENV *, DB_TXN *, DB_TXN **, u_int32_t)", 1016, 8},
{"int (*txn_checkpoint) (DB_ENV *, u_int32_t, u_int32_t, u_int32_t)", 1024, 8},
{"int (*txn_recover) (DB_ENV *, DB_PREPLIST preplist[/*count*/], long count, /*out*/ long *retp, u_int32_t flags)", 1040, 8},
{"int (*txn_stat) (DB_ENV *, DB_TXN_STAT **, u_int32_t)", 1048, 8},
{0, 1080, 1080} /* size of whole struct */
};
......@@ -79,6 +80,7 @@ struct fieldinfo db_txn_fields64[] = {
{"int (*abort) (DB_TXN *)", 128, 8},
{"int (*commit) (DB_TXN*, u_int32_t)", 136, 8},
{"u_int32_t (*id) (DB_TXN *)", 152, 8},
{"int (*prepare) (DB_TXN*, u_int8_t gid[DB_GID_SIZE])", 160, 8},
{0, 184, 184} /* size of whole struct */
};
struct fieldinfo db_txn_stat_fields64[] = {
......
......@@ -19,7 +19,7 @@ struct fieldinfo db_env_fields64[] = {
{"void (*set_errcall) (DB_ENV *, void (*)(const DB_ENV *, const char *, const char *))", 600, 8},
{"void (*set_errfile) (DB_ENV *, FILE*)", 616, 8},
{"void (*set_errpfx) (DB_ENV *, const char *)", 632, 8},
{"int (*get_flags) (DB_ENV *, u_int32_t *)", 648, 8},
{"int (*get_flags) (DB_ENV *, u_int32_t *)", 648, 8},
{"int (*set_flags) (DB_ENV *, u_int32_t, int)", 656, 8},
{"int (*set_tmp_dir) (DB_ENV *, const char *)", 768, 8},
{"int (*set_verbose) (DB_ENV *, u_int32_t, int)", 784, 8},
......@@ -33,10 +33,11 @@ struct fieldinfo db_env_fields64[] = {
{"int (*set_lk_max) (DB_ENV *, u_int32_t)", 960, 8},
{"int (*get_lk_max_locks) (DB_ENV *, u_int32_t *)", 968, 8},
{"int (*set_lk_max_locks) (DB_ENV *, u_int32_t)", 976, 8},
{"int (*get_cachesize) (DB_ENV *, u_int32_t *, u_int32_t *, int *)", 1088, 8},
{"int (*get_cachesize) (DB_ENV *, u_int32_t *, u_int32_t *, int *)", 1088, 8},
{"int (*set_cachesize) (DB_ENV *, u_int32_t, u_int32_t, int)", 1096, 8},
{"int (*txn_begin) (DB_ENV *, DB_TXN *, DB_TXN **, u_int32_t)", 1328, 8},
{"int (*txn_checkpoint) (DB_ENV *, u_int32_t, u_int32_t, u_int32_t)", 1336, 8},
{"int (*txn_recover) (DB_ENV *, DB_PREPLIST preplist[/*count*/], long count, /*out*/ long *retp, u_int32_t flags)", 1344, 8},
{"int (*txn_stat) (DB_ENV *, DB_TXN_STAT **, u_int32_t)", 1352, 8},
{0, 1400, 1400} /* size of whole struct */
};
......@@ -85,6 +86,7 @@ struct fieldinfo db_txn_fields64[] = {
{"int (*abort) (DB_TXN *)", 176, 8},
{"int (*commit) (DB_TXN*, u_int32_t)", 184, 8},
{"u_int32_t (*id) (DB_TXN *)", 200, 8},
{"int (*prepare) (DB_TXN*, u_int8_t gid[DB_GID_SIZE])", 208, 8},
{0, 240, 240} /* size of whole struct */
};
struct fieldinfo db_txn_stat_fields64[] = {
......
......@@ -14,8 +14,8 @@ struct fieldinfo db_env_fields64[] = {
{"int (*dbremove) (DB_ENV *, DB_TXN *, const char *, const char *, u_int32_t)", 616, 8},
{"int (*dbrename) (DB_ENV *, DB_TXN *, const char *, const char *, const char *, u_int32_t)", 624, 8},
{"void (*err) (const DB_ENV *, int, const char *, ...)", 632, 8},
{"int (*get_cachesize) (DB_ENV *, u_int32_t *, u_int32_t *, int *)", 664, 8},
{"int (*get_flags) (DB_ENV *, u_int32_t *)", 704, 8},
{"int (*get_cachesize) (DB_ENV *, u_int32_t *, u_int32_t *, int *)", 664, 8},
{"int (*get_flags) (DB_ENV *, u_int32_t *)", 704, 8},
{"int (*get_lg_max) (DB_ENV *, u_int32_t*)", 744, 8},
{"int (*get_lk_max_locks) (DB_ENV *, u_int32_t *)", 784, 8},
{"int (*log_archive) (DB_ENV *, char **[], u_int32_t)", 968, 8},
......@@ -37,6 +37,7 @@ struct fieldinfo db_env_fields64[] = {
{"int (*set_verbose) (DB_ENV *, u_int32_t, int)", 1616, 8},
{"int (*txn_begin) (DB_ENV *, DB_TXN *, DB_TXN **, u_int32_t)", 1632, 8},
{"int (*txn_checkpoint) (DB_ENV *, u_int32_t, u_int32_t, u_int32_t)", 1640, 8},
{"int (*txn_recover) (DB_ENV *, DB_PREPLIST preplist[/*count*/], long count, /*out*/ long *retp, u_int32_t flags)", 1648, 8},
{"int (*txn_stat) (DB_ENV *, DB_TXN_STAT **, u_int32_t)", 1656, 8},
{0, 1696, 1696} /* size of whole struct */
};
......@@ -85,6 +86,7 @@ struct fieldinfo db_txn_fields64[] = {
{"int (*abort) (DB_TXN *)", 184, 8},
{"int (*commit) (DB_TXN*, u_int32_t)", 192, 8},
{"u_int32_t (*id) (DB_TXN *)", 216, 8},
{"int (*prepare) (DB_TXN*, u_int8_t gid[DB_GID_SIZE])", 224, 8},
{0, 264, 264} /* size of whole struct */
};
struct fieldinfo db_txn_stat_fields64[] = {
......
......@@ -14,8 +14,8 @@ struct fieldinfo db_env_fields64[] = {
{"int (*dbremove) (DB_ENV *, DB_TXN *, const char *, const char *, u_int32_t)", 624, 8},
{"int (*dbrename) (DB_ENV *, DB_TXN *, const char *, const char *, const char *, u_int32_t)", 632, 8},
{"void (*err) (const DB_ENV *, int, const char *, ...)", 640, 8},
{"int (*get_cachesize) (DB_ENV *, u_int32_t *, u_int32_t *, int *)", 672, 8},
{"int (*get_flags) (DB_ENV *, u_int32_t *)", 712, 8},
{"int (*get_cachesize) (DB_ENV *, u_int32_t *, u_int32_t *, int *)", 672, 8},
{"int (*get_flags) (DB_ENV *, u_int32_t *)", 712, 8},
{"int (*get_lg_max) (DB_ENV *, u_int32_t*)", 752, 8},
{"int (*get_lk_max_locks) (DB_ENV *, u_int32_t *)", 792, 8},
{"int (*log_archive) (DB_ENV *, char **[], u_int32_t)", 968, 8},
......@@ -36,6 +36,7 @@ struct fieldinfo db_env_fields64[] = {
{"int (*set_verbose) (DB_ENV *, u_int32_t, int)", 1720, 8},
{"int (*txn_begin) (DB_ENV *, DB_TXN *, DB_TXN **, u_int32_t)", 1736, 8},
{"int (*txn_checkpoint) (DB_ENV *, u_int32_t, u_int32_t, u_int32_t)", 1744, 8},
{"int (*txn_recover) (DB_ENV *, DB_PREPLIST preplist[/*count*/], long count, /*out*/ long *retp, u_int32_t flags)", 1752, 8},
{"int (*txn_stat) (DB_ENV *, DB_TXN_STAT **, u_int32_t)", 1760, 8},
{0, 1800, 1800} /* size of whole struct */
};
......@@ -84,6 +85,7 @@ struct fieldinfo db_txn_fields64[] = {
{"int (*abort) (DB_TXN *)", 184, 8},
{"int (*commit) (DB_TXN*, u_int32_t)", 192, 8},
{"u_int32_t (*id) (DB_TXN *)", 216, 8},
{"int (*prepare) (DB_TXN*, u_int8_t gid[DB_GID_SIZE])", 224, 8},
{0, 264, 264} /* size of whole struct */
};
struct fieldinfo db_txn_stat_fields64[] = {
......
......@@ -14,8 +14,8 @@ struct fieldinfo db_env_fields64[] = {
{"int (*dbremove) (DB_ENV *, DB_TXN *, const char *, const char *, u_int32_t)", 648, 8},
{"int (*dbrename) (DB_ENV *, DB_TXN *, const char *, const char *, const char *, u_int32_t)", 656, 8},
{"void (*err) (const DB_ENV *, int, const char *, ...)", 664, 8},
{"int (*get_cachesize) (DB_ENV *, u_int32_t *, u_int32_t *, int *)", 696, 8},
{"int (*get_flags) (DB_ENV *, u_int32_t *)", 744, 8},
{"int (*get_cachesize) (DB_ENV *, u_int32_t *, u_int32_t *, int *)", 696, 8},
{"int (*get_flags) (DB_ENV *, u_int32_t *)", 744, 8},
{"int (*get_lg_max) (DB_ENV *, u_int32_t*)", 784, 8},
{"int (*get_lk_max_locks) (DB_ENV *, u_int32_t *)", 824, 8},
{"int (*log_archive) (DB_ENV *, char **[], u_int32_t)", 1008, 8},
......@@ -36,6 +36,7 @@ struct fieldinfo db_env_fields64[] = {
{"int (*set_verbose) (DB_ENV *, u_int32_t, int)", 1792, 8},
{"int (*txn_begin) (DB_ENV *, DB_TXN *, DB_TXN **, u_int32_t)", 1808, 8},
{"int (*txn_checkpoint) (DB_ENV *, u_int32_t, u_int32_t, u_int32_t)", 1816, 8},
{"int (*txn_recover) (DB_ENV *, DB_PREPLIST preplist[/*count*/], long count, /*out*/ long *retp, u_int32_t flags)", 1824, 8},
{"int (*txn_stat) (DB_ENV *, DB_TXN_STAT **, u_int32_t)", 1832, 8},
{0, 1872, 1872} /* size of whole struct */
};
......@@ -84,6 +85,7 @@ struct fieldinfo db_txn_fields64[] = {
{"int (*abort) (DB_TXN *)", 192, 8},
{"int (*commit) (DB_TXN*, u_int32_t)", 200, 8},
{"u_int32_t (*id) (DB_TXN *)", 224, 8},
{"int (*prepare) (DB_TXN*, u_int8_t gid[DB_GID_SIZE])", 232, 8},
{0, 272, 272} /* size of whole struct */
};
struct fieldinfo db_txn_stat_fields64[] = {
......
#ifndef _DB_H
#define _DB_H
/* This code generated by make_db_h. Copyright (c) 2007, 2008 Tokutek */
#ident "Copyright (c) 2007, 2008 Tokutek Inc. All rights reserved."
/* This code generated by make_db_h. Copyright (c) 2007-2011 Tokutek */
#ident "Copyright (c) 2007-2011 Tokutek Inc. All rights reserved."
#include <sys/types.h>
/*stdio is needed for the FILE* in db->verify*/
#include <stdio.h>
......@@ -23,6 +23,7 @@ extern "C" {
#define TOKU_OFF_T_DEFINED
typedef int64_t toku_off_t;
#endif
#define DB_GID_SIZE 128
typedef struct __toku_db_env DB_ENV;
typedef struct __toku_db_key_range DB_KEY_RANGE;
typedef struct __toku_db_lsn DB_LSN;
......@@ -32,6 +33,7 @@ typedef struct __toku_db_txn_active DB_TXN_ACTIVE;
typedef struct __toku_db_txn_stat DB_TXN_STAT;
typedef struct __toku_dbc DBC;
typedef struct __toku_dbt DBT;
typedef struct __toku_db_preplist { DB_TXN *txn; uint8_t gid[DB_GID_SIZE]; } DB_PREPLIST;
typedef u_int32_t db_recno_t;
typedef int(*YDB_CALLBACK_FUNCTION)(DBT const*, DBT const*, void*);
#include <tdb-internal.h>
......@@ -213,19 +215,19 @@ struct __toku_db_env {
int (*create_loader) (DB_ENV *env, DB_TXN *txn, DB_LOADER **blp, DB *src_db, int N, DB *dbs[/*N*/], uint32_t db_flags[/*N*/], uint32_t dbt_flags[/*N*/], uint32_t loader_flags);
int (*create_indexer) (DB_ENV *env, DB_TXN *txn, DB_INDEXER **idxrp, DB *src_db, int N, DB *dbs[/*N*/], uint32_t db_flags[/*N*/], uint32_t indexer_flags);
int (*put_multiple) (DB_ENV *env, DB *src_db, DB_TXN *txn,
const DBT *src_key, const DBT *src_val,
uint32_t num_dbs, DB **db_array, DBT *keys, DBT *vals, uint32_t *flags_array) /* insert into multiple DBs */;
const DBT *src_key, const DBT *src_val,
uint32_t num_dbs, DB **db_array, DBT *keys, DBT *vals, uint32_t *flags_array) /* insert into multiple DBs */;
int (*set_generate_row_callback_for_put) (DB_ENV *env, generate_row_for_put_func generate_row_for_put);
int (*del_multiple) (DB_ENV *env, DB *src_db, DB_TXN *txn,
const DBT *src_key, const DBT *src_val,
uint32_t num_dbs, DB **db_array, DBT *keys, uint32_t *flags_array) /* delete from multiple DBs */;
const DBT *src_key, const DBT *src_val,
uint32_t num_dbs, DB **db_array, DBT *keys, uint32_t *flags_array) /* delete from multiple DBs */;
int (*set_generate_row_callback_for_del) (DB_ENV *env, generate_row_for_del_func generate_row_for_del);
int (*update_multiple) (DB_ENV *env, DB *src_db, DB_TXN *txn,
DBT *old_src_key, DBT *old_src_data,
DBT *new_src_key, DBT *new_src_data,
uint32_t num_dbs, DB **db_array, uint32_t *flags_array,
uint32_t num_keys, DBT *keys,
uint32_t num_vals, DBT *vals) /* update multiple DBs */;
DBT *old_src_key, DBT *old_src_data,
DBT *new_src_key, DBT *new_src_data,
uint32_t num_dbs, DB **db_array, uint32_t *flags_array,
uint32_t num_keys, DBT *keys,
uint32_t num_vals, DBT *vals) /* update multiple DBs */;
int (*get_redzone) (DB_ENV *env, int *redzone) /* get the redzone limit */;
int (*set_redzone) (DB_ENV *env, int redzone) /* set the redzone limit in percent of total space */;
int (*set_lk_max_memory) (DB_ENV *env, uint64_t max);
......@@ -238,8 +240,8 @@ struct __toku_db_env {
int (*dbremove) (DB_ENV *, DB_TXN *, const char *, const char *, u_int32_t);
int (*dbrename) (DB_ENV *, DB_TXN *, const char *, const char *, const char *, u_int32_t);
void (*err) (const DB_ENV *, int, const char *, ...);
int (*get_cachesize) (DB_ENV *, u_int32_t *, u_int32_t *, int *);
int (*get_flags) (DB_ENV *, u_int32_t *);
int (*get_cachesize) (DB_ENV *, u_int32_t *, u_int32_t *, int *);
int (*get_flags) (DB_ENV *, u_int32_t *);
int (*get_lg_max) (DB_ENV *, u_int32_t*);
int (*get_lk_max_locks) (DB_ENV *, u_int32_t *);
int (*log_archive) (DB_ENV *, char **[], u_int32_t);
......@@ -260,6 +262,7 @@ struct __toku_db_env {
int (*set_verbose) (DB_ENV *, u_int32_t, int);
int (*txn_begin) (DB_ENV *, DB_TXN *, DB_TXN **, u_int32_t);
int (*txn_checkpoint) (DB_ENV *, u_int32_t, u_int32_t, u_int32_t);
int (*txn_recover) (DB_ENV *, DB_PREPLIST preplist[/*count*/], long count, /*out*/ long *retp, u_int32_t flags);
int (*txn_stat) (DB_ENV *, DB_TXN_STAT **, u_int32_t);
};
struct __toku_db_key_range {
......@@ -354,13 +357,14 @@ struct __toku_db_txn {
DB_ENV *mgrp /*In TokuDB, mgrp is a DB_ENV not a DB_TXNMGR*/;
DB_TXN *parent;
int (*txn_stat)(DB_TXN *, struct txn_stat **);
struct { void *next, *prev; } open_txns;
struct toku_list open_txns;
int (*commit_with_progress)(DB_TXN*, uint32_t, TXN_PROGRESS_POLL_FUNCTION, void*);
int (*abort_with_progress)(DB_TXN*, TXN_PROGRESS_POLL_FUNCTION, void*);
void *api_internal;
int (*abort) (DB_TXN *);
int (*commit) (DB_TXN*, u_int32_t);
u_int32_t (*id) (DB_TXN *);
int (*prepare) (DB_TXN*, u_int8_t gid[DB_GID_SIZE]);
};
struct __toku_db_txn_stat {
u_int32_t st_nactive;
......
#ifndef _DB_H
#define _DB_H
/* This code generated by make_db_h. Copyright (c) 2007, 2008 Tokutek */
#ident "Copyright (c) 2007, 2008 Tokutek Inc. All rights reserved."
/* This code generated by make_db_h. Copyright (c) 2007-2011 Tokutek */
#ident "Copyright (c) 2007-2011 Tokutek Inc. All rights reserved."
#include <sys/types.h>
/*stdio is needed for the FILE* in db->verify*/
#include <stdio.h>
......@@ -23,6 +23,7 @@ extern "C" {
#define TOKU_OFF_T_DEFINED
typedef int64_t toku_off_t;
#endif
#define DB_GID_SIZE 128
typedef struct __toku_db_env DB_ENV;
typedef struct __toku_db_key_range DB_KEY_RANGE;
typedef struct __toku_db_lsn DB_LSN;
......@@ -32,6 +33,7 @@ typedef struct __toku_db_txn_active DB_TXN_ACTIVE;
typedef struct __toku_db_txn_stat DB_TXN_STAT;
typedef struct __toku_dbc DBC;
typedef struct __toku_dbt DBT;
typedef struct __toku_db_preplist { DB_TXN *txn; uint8_t gid[DB_GID_SIZE]; } DB_PREPLIST;
typedef u_int32_t db_recno_t;
typedef int(*YDB_CALLBACK_FUNCTION)(DBT const*, DBT const*, void*);
#include <tdb-internal.h>
......@@ -213,19 +215,19 @@ struct __toku_db_env {
int (*create_loader) (DB_ENV *env, DB_TXN *txn, DB_LOADER **blp, DB *src_db, int N, DB *dbs[/*N*/], uint32_t db_flags[/*N*/], uint32_t dbt_flags[/*N*/], uint32_t loader_flags);
int (*create_indexer) (DB_ENV *env, DB_TXN *txn, DB_INDEXER **idxrp, DB *src_db, int N, DB *dbs[/*N*/], uint32_t db_flags[/*N*/], uint32_t indexer_flags);
int (*put_multiple) (DB_ENV *env, DB *src_db, DB_TXN *txn,
const DBT *src_key, const DBT *src_val,
uint32_t num_dbs, DB **db_array, DBT *keys, DBT *vals, uint32_t *flags_array) /* insert into multiple DBs */;
const DBT *src_key, const DBT *src_val,
uint32_t num_dbs, DB **db_array, DBT *keys, DBT *vals, uint32_t *flags_array) /* insert into multiple DBs */;
int (*set_generate_row_callback_for_put) (DB_ENV *env, generate_row_for_put_func generate_row_for_put);
int (*del_multiple) (DB_ENV *env, DB *src_db, DB_TXN *txn,
const DBT *src_key, const DBT *src_val,
uint32_t num_dbs, DB **db_array, DBT *keys, uint32_t *flags_array) /* delete from multiple DBs */;
const DBT *src_key, const DBT *src_val,
uint32_t num_dbs, DB **db_array, DBT *keys, uint32_t *flags_array) /* delete from multiple DBs */;
int (*set_generate_row_callback_for_del) (DB_ENV *env, generate_row_for_del_func generate_row_for_del);
int (*update_multiple) (DB_ENV *env, DB *src_db, DB_TXN *txn,
DBT *old_src_key, DBT *old_src_data,
DBT *new_src_key, DBT *new_src_data,
uint32_t num_dbs, DB **db_array, uint32_t *flags_array,
uint32_t num_keys, DBT *keys,
uint32_t num_vals, DBT *vals) /* update multiple DBs */;
DBT *old_src_key, DBT *old_src_data,
DBT *new_src_key, DBT *new_src_data,
uint32_t num_dbs, DB **db_array, uint32_t *flags_array,
uint32_t num_keys, DBT *keys,
uint32_t num_vals, DBT *vals) /* update multiple DBs */;
int (*get_redzone) (DB_ENV *env, int *redzone) /* get the redzone limit */;
int (*set_redzone) (DB_ENV *env, int redzone) /* set the redzone limit in percent of total space */;
int (*set_lk_max_memory) (DB_ENV *env, uint64_t max);
......@@ -238,8 +240,8 @@ struct __toku_db_env {
int (*dbremove) (DB_ENV *, DB_TXN *, const char *, const char *, u_int32_t);
int (*dbrename) (DB_ENV *, DB_TXN *, const char *, const char *, const char *, u_int32_t);
void (*err) (const DB_ENV *, int, const char *, ...);
int (*get_cachesize) (DB_ENV *, u_int32_t *, u_int32_t *, int *);
int (*get_flags) (DB_ENV *, u_int32_t *);
int (*get_cachesize) (DB_ENV *, u_int32_t *, u_int32_t *, int *);
int (*get_flags) (DB_ENV *, u_int32_t *);
int (*get_lg_max) (DB_ENV *, u_int32_t*);
int (*get_lk_max_locks) (DB_ENV *, u_int32_t *);
int (*log_archive) (DB_ENV *, char **[], u_int32_t);
......@@ -260,6 +262,7 @@ struct __toku_db_env {
int (*set_verbose) (DB_ENV *, u_int32_t, int);
int (*txn_begin) (DB_ENV *, DB_TXN *, DB_TXN **, u_int32_t);
int (*txn_checkpoint) (DB_ENV *, u_int32_t, u_int32_t, u_int32_t);
int (*txn_recover) (DB_ENV *, DB_PREPLIST preplist[/*count*/], long count, /*out*/ long *retp, u_int32_t flags);
int (*txn_stat) (DB_ENV *, DB_TXN_STAT **, u_int32_t);
};
struct __toku_db_key_range {
......@@ -354,13 +357,14 @@ struct __toku_db_txn {
DB_ENV *mgrp /*In TokuDB, mgrp is a DB_ENV not a DB_TXNMGR*/;
DB_TXN *parent;
int (*txn_stat)(DB_TXN *, struct txn_stat **);
struct { void *next, *prev; } open_txns;
struct toku_list open_txns;
int (*commit_with_progress)(DB_TXN*, uint32_t, TXN_PROGRESS_POLL_FUNCTION, void*);
int (*abort_with_progress)(DB_TXN*, TXN_PROGRESS_POLL_FUNCTION, void*);
void *api_internal;
int (*abort) (DB_TXN *);
int (*commit) (DB_TXN*, u_int32_t);
u_int32_t (*id) (DB_TXN *);
int (*prepare) (DB_TXN*, u_int8_t gid[DB_GID_SIZE]);
};
struct __toku_db_txn_stat {
u_int32_t st_nactive;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment