Commit d0230904 authored by Bradley C. Kuszmaul's avatar Bradley C. Kuszmaul

32

git-svn-id: file:///svn/tokudb@261 c7de825b-a66e-492c-adef-691d508d4ae1
parent 1d54aef5
......@@ -34,10 +34,9 @@ void print_struct (const char *structname, int need_internal, struct fieldinfo *
// int total32 = fields32[N-1].size;
// int total64 = fields32[N-1].size;
printf("struct __toku_%s {\n", structname);
for (i=0; i<N-1; i++) {
for (i=0; i<N; i++) {
unsigned int this_32 = fields32[i].off;
unsigned int this_64 = fields64[i].off;
assert(strcmp(fields32[i].decl, fields64[i].decl)==0);
//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;
......@@ -64,9 +63,15 @@ void print_struct (const char *structname, int need_internal, struct fieldinfo *
current_64 = this_64;
}
if (this_32<current_32 || this_64<current_64) {
printf("Whoops\n");
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; /* 32-bit offset=%d size=%d, 64=bit offset=%d size=%d */\n", fields32[i].decl, fields32[i].off, fields32[i].size, fields64[i].off, fields64[i].size);
} else {
assert(fields32[i].decl==0);
assert(fields64[i].decl==0);
}
current_32 += fields32[i].size;
current_64 += fields64[i].size;
}
......@@ -94,6 +99,9 @@ int main (int argc __attribute__((__unused__)), char *argv[] __attribute__((__un
assert(sizeof(dbc_fields32)==sizeof(dbc_fields64));
print_struct("dbc", 1, dbc_fields32, dbc_fields64, sizeof(dbc_fields32)/sizeof(dbc_fields32[0]));
assert(sizeof(db_env_fields32)==sizeof(db_env_fields64));
print_struct("db_env", 1, db_env_fields32, db_env_fields64, sizeof(db_env_fields32)/sizeof(db_env_fields32[0]));
printf("#if defined(__cplusplus)\n}\n#endif\n");
printf("#endif\n");
return 0;
......
......@@ -46,7 +46,7 @@ void sort_and_dump_fields (const char *structname, unsigned int sizeofstruct) {
for (i=0; i<field_counter; i++) {
fprintf(outf, " {\"%s\", %d, %d},\n", fields[i].decl, fields[i].off, fields[i].size);
}
fprintf(outf, " {0, 0, %d} /* size of whole struct */\n", sizeofstruct);
fprintf(outf, " {0, %d, %d} /* size of whole struct */\n", sizeofstruct, sizeofstruct);
fprintf(outf, "};\n");
}
......
......@@ -13,7 +13,7 @@ struct fieldinfo db_fields32[] = {
{"int (*set_flags) (DB *, u_int32_t)", 380, 4},
{"int (*stat) (DB *, void *, u_int32_t)", 396, 4},
{"int (*set_bt_compare) (DB *, int (*)(DB *, const DBT *, const DBT *))", 412, 4},
{0, 0, 484} /* size of whole struct */
{0, 484, 484} /* size of whole struct */
};
struct fieldinfo dbt_fields32[] = {
{"void*data", 0, 4},
......@@ -21,18 +21,18 @@ struct fieldinfo dbt_fields32[] = {
{"u_int32_t ulen", 8, 4},
{"void*app_private", 20, 4},
{"u_int32_t flags", 24, 4},
{0, 0, 28} /* size of whole struct */
{0, 28, 28} /* size of whole struct */
};
struct fieldinfo db_txn_fields32[] = {
{"int (*commit) (DB_TXN*, u_int32_t)", 80, 4},
{"u_int32_t (*id) (DB_TXN *)", 88, 4},
{0, 0, 104} /* size of whole struct */
{0, 104, 104} /* size of whole struct */
};
struct fieldinfo dbc_fields32[] = {
{"int (*c_close) (DBC *)", 204, 4},
{"int (*c_del) (DBC *, u_int32_t)", 212, 4},
{"int (*c_get) (DBC *, DBT *, DBT *, u_int32_t)", 220, 4},
{0, 0, 268} /* size of whole struct */
{0, 268, 268} /* size of whole struct */
};
struct fieldinfo db_env_fields32[] = {
{"int (*close) (DB_ENV *, u_int32_t)", 248, 4},
......@@ -55,5 +55,5 @@ struct fieldinfo db_env_fields32[] = {
{"int (*set_cachesize) (DB_ENV *, u_int32_t, u_int32_t, int)", 460, 4},
{"int (*txn_checkpoint) (DB_ENV *, u_int32_t, u_int32_t, u_int32_t)", 552, 4},
{"int (*txn_stat) (DB_ENV *, DB_TXN_STAT **, u_int32_t)", 564, 4},
{0, 0, 584} /* size of whole struct */
{0, 584, 584} /* size of whole struct */
};
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