Commit 99d87cf6 authored by Rich Prohaska's avatar Rich Prohaska

fix compile time errors

git-svn-id: file:///svn/tokudb@289 c7de825b-a66e-492c-adef-691d508d4ae1
parent 6f3aff09
......@@ -23,7 +23,7 @@ struct db_header {
BRT *database_brts; // These
};
struct ydb_db_internal {
struct __toku_db_internal {
int freed;
int (*bt_compare)(DB *, const DBT *, const DBT *);
struct db_header *header;
......@@ -38,7 +38,7 @@ struct ydb_db_internal {
int is_db_dup;
};
void yobi_db_env_err (const DB_ENV *env __attribute__((__unused__)), int error, const char *fmt, ...) {
void __toku_db_env_err (const DB_ENV *env __attribute__((__unused__)), int error, const char *fmt, ...) {
va_list ap;
va_start(ap, fmt);
fprintf(stderr, "YDB Error %d:", error);
......@@ -68,7 +68,7 @@ void print_flags (u_int32_t flags) {
printf("\n");
}
struct db_env_ydb_internal {
struct __toku_db_env_internal {
u_int32_t open_flags;
int open_mode;
void (*errcall)(const char *, char *);
......@@ -82,7 +82,7 @@ struct db_env_ydb_internal {
CACHETABLE cachetable;
};
int yobi_db_env_open (DB_ENV *env, const char *home, u_int32_t flags, int mode) {
int __toku_db_env_open (DB_ENV *env, const char *home, u_int32_t flags, int mode) {
int r;
notef("(%p, \"%s\", 0x%x, 0%o)\n", env, home, flags, mode);
env->i->dir = strdup(home);
......@@ -96,103 +96,105 @@ int yobi_db_env_open (DB_ENV *env, const char *home, u_int32_t flags, int mode)
assert(r==0);
return 0;
}
int yobi_db_env_close (DB_ENV * env, u_int32_t flags) {
int __toku_db_env_close (DB_ENV * env, u_int32_t flags) {
barf();
return 1;
}
int yobi_db_env_log_archive (DB_ENV *env, char **list[], u_int32_t flags) {
int __toku_db_env_log_archive (DB_ENV *env, char **list[], u_int32_t flags) {
*list = NULL;
return 0;
}
int yobi_db_env_log_flush (DB_ENV * env, const DB_LSN * lsn) {
int __toku_db_env_log_flush (DB_ENV * env, const DB_LSN * lsn) {
barf();
return 1;
}
int yobi_db_env_set_cachesize (DB_ENV * env, u_int32_t gbytes, u_int32_t bytes, int ncache) {
int __toku_db_env_set_cachesize (DB_ENV * env, u_int32_t gbytes, u_int32_t bytes, int ncache) {
barf();
return 1;
}
int yobi_db_env_set_data_dir (DB_ENV * env, const char *dir) {
int __toku_db_env_set_data_dir (DB_ENV * env, const char *dir) {
barf();
return 1;
}
void yobi_db_env_set_errcall (DB_ENV *env, void (*errcall)(const char *, char *)) {
void __toku_db_env_set_errcall (DB_ENV *env, void (*errcall)(const char *, char *)) {
env->i->errcall=errcall;
}
void yobi_db_env_set_errpfx (DB_ENV * env, const char *errpfx) {
void __toku_db_env_set_errpfx (DB_ENV * env, const char *errpfx) {
env->i->errpfx = strdup(errpfx);
}
int yobi_db_env_set_flags (DB_ENV *env, u_int32_t flags, int onoff) {
int __toku_db_env_set_flags (DB_ENV *env, u_int32_t flags, int onoff) {
barf();
return 1;
}
int yobi_db_env_set_lg_bsize (DB_ENV * env, u_int32_t bsize) {
int __toku_db_env_set_lg_bsize (DB_ENV * env, u_int32_t bsize) {
barf();
return 1;
}
int yobi_db_env_set_lg_dir (DB_ENV * env, const char * dir) {
int __toku_db_env_set_lg_dir (DB_ENV * env, const char * dir) {
barf();
return 1;
}
int yobi_db_env_set_lg_max (DB_ENV *env, u_int32_t lg_max) {
int __toku_db_env_set_lg_max (DB_ENV *env, u_int32_t lg_max) {
barf();
return 1;
}
int yobi_db_env_set_lk_detect (DB_ENV *env, u_int32_t detect) {
int __toku_db_env_set_lk_detect (DB_ENV *env, u_int32_t detect) {
barf();
return 1;
}
int yobi_db_env_set_lk_max (DB_ENV *env, u_int32_t lk_max) {
int __toku_db_env_set_lk_max (DB_ENV *env, u_int32_t lk_max) {
barf();
return 1;
}
void yobi_db_env_set_noticecall (DB_ENV *env, void (*noticecall)(DB_ENV *, db_notices)) {
void __toku_db_env_set_noticecall (DB_ENV *env, void (*noticecall)(DB_ENV *, db_notices)) {
env->i->noticecall = noticecall;
}
int yobi_db_env_set_tmp_dir (DB_ENV * env, const char *tmp_dir) {
int __toku_db_env_set_tmp_dir (DB_ENV * env, const char *tmp_dir) {
env->i->tmp_dir = strdup(tmp_dir);
return 0;
}
int yobi_db_env_set_verbose (DB_ENV *env, u_int32_t which, int onoff) {
int __toku_db_env_set_verbose (DB_ENV *env, u_int32_t which, int onoff) {
barf();
return 1;
}
int yobi_db_env_txn_checkpoint (DB_ENV *env, u_int32_t kbyte, u_int32_t min, u_int32_t flags) {
int __toku_db_env_txn_checkpoint (DB_ENV *env, u_int32_t kbyte, u_int32_t min, u_int32_t flags) {
return 0;
}
int yobi_db_env_txn_stat (DB_ENV *env, DB_TXN_STAT **statp, u_int32_t flags) {
int __toku_db_env_txn_stat (DB_ENV *env, DB_TXN_STAT **statp, u_int32_t flags) {
barf();
return 1;
}
void yobi_default_errcall(const char *errpfx, char *msg) {
void __toku_default_errcall(const char *errpfx, char *msg) {
fprintf(stderr, "YDB: %s: %s", errpfx, msg);
}
int txn_begin (DB_ENV *env, DB_TXN *stxn, DB_TXN **txn, u_int32_t flags);
int db_env_create (DB_ENV **envp, u_int32_t flags) {
DB_ENV *result=malloc(sizeof(*result));
fprintf(stderr, "%s:%d db_env_create flags=%d, returning %p\n", __FILE__, __LINE__, flags, result);
result->err = yobi_db_env_err;
result->open = yobi_db_env_open;
result->close = yobi_db_env_close;
result->txn_checkpoint = yobi_db_env_txn_checkpoint;
result->log_flush = yobi_db_env_log_flush;
result->set_errcall = yobi_db_env_set_errcall;
result->set_errpfx = yobi_db_env_set_errpfx;
result->set_noticecall = yobi_db_env_set_noticecall;
result->set_flags = yobi_db_env_set_flags;
result->set_data_dir = yobi_db_env_set_data_dir;
result->set_tmp_dir = yobi_db_env_set_tmp_dir;
result->set_verbose = yobi_db_env_set_verbose;
result->set_lg_bsize = yobi_db_env_set_lg_bsize;
result->set_lg_dir = yobi_db_env_set_lg_dir;
result->set_lg_max = yobi_db_env_set_lg_max;
result->set_cachesize = yobi_db_env_set_cachesize;
result->set_lk_detect = yobi_db_env_set_lk_detect;
result->set_lk_max = yobi_db_env_set_lk_max;
result->log_archive = yobi_db_env_log_archive;
result->txn_stat = yobi_db_env_txn_stat;
result->err = __toku_db_env_err;
result->open = __toku_db_env_open;
result->close = __toku_db_env_close;
result->txn_checkpoint = __toku_db_env_txn_checkpoint;
result->log_flush = __toku_db_env_log_flush;
result->set_errcall = __toku_db_env_set_errcall;
result->set_errpfx = __toku_db_env_set_errpfx;
result->set_noticecall = __toku_db_env_set_noticecall;
result->set_flags = __toku_db_env_set_flags;
result->set_data_dir = __toku_db_env_set_data_dir;
result->set_tmp_dir = __toku_db_env_set_tmp_dir;
result->set_verbose = __toku_db_env_set_verbose;
result->set_lg_bsize = __toku_db_env_set_lg_bsize;
result->set_lg_dir = __toku_db_env_set_lg_dir;
result->set_lg_max = __toku_db_env_set_lg_max;
result->set_cachesize = __toku_db_env_set_cachesize;
result->set_lk_detect = __toku_db_env_set_lk_detect;
result->set_lk_max = __toku_db_env_set_lk_max;
result->log_archive = __toku_db_env_log_archive;
result->txn_stat = __toku_db_env_txn_stat;
result->txn_begin = txn_begin;
result->i = malloc(sizeof(*result->i));
......@@ -200,7 +202,7 @@ int db_env_create (DB_ENV **envp, u_int32_t flags) {
result->i->noticecall = 0;
result->i->tmp_dir = 0;
result->i->errcall = yobi_default_errcall;
result->i->errcall = __toku_default_errcall;
result->i->errpfx = "";
result->i->n_files = 0;
......@@ -212,12 +214,12 @@ int db_env_create (DB_ENV **envp, u_int32_t flags) {
}
int yobi_db_txn_commit (DB_TXN *txn, u_int32_t flags) {
int __toku_db_txn_commit (DB_TXN *txn, u_int32_t flags) {
notef("flags=%d\n", flags);
return 0;
}
u_int32_t yobi_db_txn_id (DB_TXN *txn) {
u_int32_t __toku_db_txn_id (DB_TXN *txn) {
barf();
abort();
}
......@@ -225,8 +227,8 @@ u_int32_t yobi_db_txn_id (DB_TXN *txn) {
int txn_begin (DB_ENV *env, DB_TXN *stxn, DB_TXN **txn, u_int32_t flags) {
DB_TXN *result = malloc(sizeof(*result));
notef("parent=%p flags=0x%x\n", stxn, flags);
result->commit = yobi_db_txn_commit;
result->id = yobi_db_txn_id;
result->commit = __toku_db_txn_commit;
result->id = __toku_db_txn_id;
*txn = result;
return 0;
}
......@@ -245,40 +247,40 @@ int log_compare (const DB_LSN *a, const DB_LSN *b) {
abort();
}
int yobi_db_close (DB *db, u_int32_t flags) {
int __toku_db_close (DB *db, u_int32_t flags) {
int r = close_brt(db->i->brt);
printf("%s:%d %d=yobi_db_close(%p)\n", __FILE__, __LINE__, r, db);
printf("%s:%d %d=__toku_db_close(%p)\n", __FILE__, __LINE__, r, db);
db->i->freed = 1;
return r;
}
struct yobi_dbc_internal {
struct __toku_dbc_internal {
BRT_CURSOR c;
DB *db;
};
int yobi_c_get (DBC *c, DBT *key, DBT *data, u_int32_t flag) {
int __toku_c_get (DBC *c, DBT *key, DBT *data, u_int32_t flag) {
return brt_c_get(c->i->c, key, data, flag);
}
int yobi_c_close (DBC *c) {
int __toku_c_close (DBC *c) {
int r = brt_cursor_close(c->i->c);
printf("%s:%d %d=yobi_c_close(%p)\n", __FILE__, __LINE__, r, c);
printf("%s:%d %d=__toku_c_close(%p)\n", __FILE__, __LINE__, r, c);
return r;
}
int yobi_c_del (DBC *c, u_int32_t flags) {
int __toku_c_del (DBC *c, u_int32_t flags) {
barf();
return 0;
}
int yobi_db_cursor (DB *db, DB_TXN *txn, DBC **c, u_int32_t flags) {
int __toku_db_cursor (DB *db, DB_TXN *txn, DBC **c, u_int32_t flags) {
DBC *result=malloc(sizeof(*result));
int r;
assert(result);
result->c_get = yobi_c_get;
result->c_close = yobi_c_close;
result->c_del = yobi_c_del;
result->c_get = __toku_c_get;
result->c_close = __toku_c_close;
result->c_del = __toku_c_del;
result->i = malloc(sizeof(*result->i));
result->i->db = db;
r = brt_cursor(db->i->brt, &result->i->c);
......@@ -287,17 +289,17 @@ int yobi_db_cursor (DB *db, DB_TXN *txn, DBC **c, u_int32_t flags) {
return 0;
}
int yobi_db_del (DB *db, DB_TXN *txn, DBT *dbt, u_int32_t flags) {
int __toku_db_del (DB *db, DB_TXN *txn, DBT *dbt, u_int32_t flags) {
barf();
abort();
}
int yobi_db_get (DB *db, DB_TXN *txn, DBT *dbta, DBT *dbtb, u_int32_t flags) {
int __toku_db_get (DB *db, DB_TXN *txn, DBT *dbta, DBT *dbtb, u_int32_t flags) {
barf();
abort();
}
int yobi_db_key_range (DB *db, DB_TXN *txn, DBT *dbt, DB_KEY_RANGE *kr, u_int32_t flags) {
int __toku_db_key_range (DB *db, DB_TXN *txn, DBT *dbt, DB_KEY_RANGE *kr, u_int32_t flags) {
barf();
abort();
}
......@@ -331,7 +333,7 @@ char *construct_full_name (const char *dir, const char *fname) {
// have to inherit mode bits and so forth from the first file that was created.
// Other problems may ensue (who is responsible for deleting the file? That's not so bad actually.)
// This suggests that we really need to put the multiple databases into one file.
int yobi_db_open (DB *db, DB_TXN *txn, const char *fname, const char *dbname, DBTYPE dbtype, u_int32_t flags, int mode) {
int __toku_db_open (DB *db, DB_TXN *txn, const char *fname, const char *dbname, DBTYPE dbtype, u_int32_t flags, int mode) {
// Warning. Should check arguments. Should check return codes on malloc and open and so forth.
int openflags=0;
......@@ -369,19 +371,19 @@ int yobi_db_open (DB *db, DB_TXN *txn, const char *fname, const char *dbname, D
assert(r==0);
return 0;
}
int yobi_db_put (DB *db, DB_TXN *txn, DBT *dbta, DBT *dbtb, u_int32_t flags) {
int __toku_db_put (DB *db, DB_TXN *txn, DBT *dbta, DBT *dbtb, u_int32_t flags) {
int r = brt_insert(db->i->brt, dbta, dbtb, db);
//printf("%s:%d %d=yobi_db_put(...)\n", __FILE__, __LINE__, r);
//printf("%s:%d %d=__toku_db_put(...)\n", __FILE__, __LINE__, r);
return r;
}
int yobi_db_remove (DB *db, const char *fname, const char *dbname, u_int32_t flags) {
int __toku_db_remove (DB *db, const char *fname, const char *dbname, u_int32_t flags) {
int r;
char ffull[PATH_MAX];
assert(dbname==0);
r = snprintf(ffull, PATH_MAX, "%s%s", db->i->env->i->dir, fname); assert(r<PATH_MAX);
return unlink(ffull);
}
int yobi_db_rename (DB *db, const char *namea, const char *nameb, const char *namec, u_int32_t flags) {
int __toku_db_rename (DB *db, const char *namea, const char *nameb, const char *namec, u_int32_t flags) {
char afull[PATH_MAX], cfull[PATH_MAX];
int r;
assert(nameb==0);
......@@ -389,12 +391,12 @@ int yobi_db_rename (DB *db, const char *namea, const char *nameb, const char *n
r = snprintf(cfull, PATH_MAX, "%s%s", db->i->env->i->dir, namec); assert(r<PATH_MAX);
return rename(afull, cfull);
}
int yobi_db_set_bt_compare (DB *db, int (*bt_compare)(DB *, const DBT *, const DBT *)) {
int __toku_db_set_bt_compare (DB *db, int (*bt_compare)(DB *, const DBT *, const DBT *)) {
note();
db->i->bt_compare = bt_compare;
return 0;
}
int yobi_db_set_flags (DB *db, u_int32_t flags) {
int __toku_db_set_flags (DB *db, u_int32_t flags) {
if (flags&DB_DUP) {
printf("Set DB_DUP\n");
if (db->i->brt && !db->i->is_db_dup) {
......@@ -407,7 +409,7 @@ int yobi_db_set_flags (DB *db, u_int32_t flags) {
assert(flags==0);
return 0;
}
int yobi_db_stat (DB *db, void *v, u_int32_t flags) {
int __toku_db_stat (DB *db, void *v, u_int32_t flags) {
barf();
abort();
}
......@@ -417,18 +419,18 @@ int db_create (DB **db, DB_ENV *env, u_int32_t flags) {
fprintf(stderr, "%s:%d db_create(%p, %p, 0x%x)\n", __FILE__, __LINE__, db, env, flags);
print_flags(flags);
result->app_private = 0;
result->close = yobi_db_close;
result->cursor = yobi_db_cursor;
result->del = yobi_db_del;
result->get = yobi_db_get;
result->key_range = yobi_db_key_range;
result->open = yobi_db_open;
result->put = yobi_db_put;
result->remove = yobi_db_remove;
result->rename = yobi_db_rename;
result->set_bt_compare = yobi_db_set_bt_compare;
result->set_flags = yobi_db_set_flags;
result->stat = yobi_db_stat;
result->close = __toku_db_close;
result->cursor = __toku_db_cursor;
result->del = __toku_db_del;
result->get = __toku_db_get;
result->key_range = __toku_db_key_range;
result->open = __toku_db_open;
result->put = __toku_db_put;
result->remove = __toku_db_remove;
result->rename = __toku_db_rename;
result->set_bt_compare = __toku_db_set_bt_compare;
result->set_flags = __toku_db_set_flags;
result->stat = __toku_db_stat;
result->i = malloc(sizeof(*result->i));
result->i->freed = 0;
result->i->bt_compare = 0;
......
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