add casts; fix legacy fcn declaration

This commit is contained in:
Rusty Sears 2013-01-30 15:42:36 -08:00
parent 2504600f3b
commit 814614b0bb
2 changed files with 13 additions and 13 deletions

View file

@ -103,7 +103,7 @@ struct stasis_alloc_t {
static int op_alloc(const LogEntry* e, Page* p) { static int op_alloc(const LogEntry* e, Page* p) {
assert(e->update.arg_size >= sizeof(alloc_arg)); assert(e->update.arg_size >= sizeof(alloc_arg));
const alloc_arg* arg = stasis_log_entry_update_args_cptr(e); const alloc_arg* arg = (const alloc_arg*)stasis_log_entry_update_args_cptr(e);
recordid rid = { recordid rid = {
p->id, p->id,
arg->slot, arg->slot,
@ -128,7 +128,7 @@ static int op_alloc(const LogEntry* e, Page* p) {
static int op_dealloc(const LogEntry* e, Page* p) { static int op_dealloc(const LogEntry* e, Page* p) {
assert(e->update.arg_size >= sizeof(alloc_arg)); assert(e->update.arg_size >= sizeof(alloc_arg));
const alloc_arg* arg = stasis_log_entry_update_args_cptr(e); const alloc_arg* arg = (const alloc_arg*)stasis_log_entry_update_args_cptr(e);
recordid rid = { recordid rid = {
p->id, p->id,
arg->slot, arg->slot,
@ -146,7 +146,7 @@ static int op_dealloc(const LogEntry* e, Page* p) {
static int op_realloc(const LogEntry* e, Page* p) { static int op_realloc(const LogEntry* e, Page* p) {
assert(e->update.arg_size >= sizeof(alloc_arg)); assert(e->update.arg_size >= sizeof(alloc_arg));
const alloc_arg* arg = stasis_log_entry_update_args_cptr(e); const alloc_arg* arg = (const alloc_arg*)stasis_log_entry_update_args_cptr(e);
recordid rid = { recordid rid = {
p->id, p->id,
@ -204,7 +204,7 @@ stasis_operation_impl stasis_op_impl_realloc(void) {
} }
int stasis_alloc_callback(int xid, void * arg) { int stasis_alloc_callback(int xid, void * arg) {
stasis_alloc_t * alloc = arg; stasis_alloc_t * alloc = (stasis_alloc_t*)arg;
pthread_mutex_lock(&alloc->mut); pthread_mutex_lock(&alloc->mut);
stasis_allocation_policy_transaction_completed(alloc->allocPolicy, xid); stasis_allocation_policy_transaction_completed(alloc->allocPolicy, xid);
pthread_mutex_unlock(&alloc->mut); pthread_mutex_unlock(&alloc->mut);
@ -221,7 +221,7 @@ stasis_alloc_t* stasis_alloc_init(stasis_transaction_table_t * tbl, stasis_alloc
return alloc; return alloc;
} }
static void stasis_alloc_register_old_regions(); static void stasis_alloc_register_old_regions(stasis_alloc_t* alloc);
void stasis_alloc_post_init(stasis_alloc_t * alloc) { void stasis_alloc_post_init(stasis_alloc_t * alloc) {
stasis_alloc_register_old_regions(alloc); stasis_alloc_register_old_regions(alloc);
} }
@ -278,7 +278,7 @@ static void stasis_alloc_reserve_new_region(stasis_alloc_t* alloc, int xid) {
} }
recordid Talloc(int xid, unsigned long size) { recordid Talloc(int xid, unsigned long size) {
stasis_alloc_t* alloc = stasis_runtime_alloc_state(); stasis_alloc_t* alloc = (stasis_alloc_t*)stasis_runtime_alloc_state();
short type; short type;
if(size >= BLOB_THRESHOLD_SIZE) { if(size >= BLOB_THRESHOLD_SIZE) {
type = BLOB_SLOT; type = BLOB_SLOT;
@ -363,7 +363,7 @@ recordid Talloc(int xid, unsigned long size) {
} }
recordid TallocFromPage(int xid, pageid_t page, unsigned long size) { recordid TallocFromPage(int xid, pageid_t page, unsigned long size) {
stasis_alloc_t* alloc = stasis_runtime_alloc_state(); stasis_alloc_t* alloc = (stasis_alloc_t*)stasis_runtime_alloc_state();
short type; short type;
if(size >= BLOB_THRESHOLD_SIZE) { if(size >= BLOB_THRESHOLD_SIZE) {
type = BLOB_SLOT; type = BLOB_SLOT;
@ -408,7 +408,7 @@ recordid TallocFromPage(int xid, pageid_t page, unsigned long size) {
} }
void Tdealloc(int xid, recordid rid) { void Tdealloc(int xid, recordid rid) {
stasis_alloc_t* alloc = stasis_runtime_alloc_state(); stasis_alloc_t* alloc = (stasis_alloc_t*)stasis_runtime_alloc_state();
// @todo this needs to garbage collect empty storage regions. // @todo this needs to garbage collect empty storage regions.

View file

@ -278,9 +278,9 @@ void stasis_uninitialized_page_loaded(int xid, Page * p) {
if(xid == INVALID_XID) { if(xid == INVALID_XID) {
xid_lsn = INVALID_LSN; xid_lsn = INVALID_LSN;
} else { } else {
xid_lsn = stasis_transaction_table_get(stasis_runtime_transaction_table(), xid)->prevLSN; xid_lsn = stasis_transaction_table_get((stasis_transaction_table_t*)stasis_runtime_transaction_table(), xid)->prevLSN;
} }
lsn_t log_lsn = ((stasis_log_t*)stasis_log())->next_available_lsn(stasis_log()); lsn_t log_lsn = ((stasis_log_t*)stasis_log())->next_available_lsn((stasis_log_t*)stasis_log());
// If this transaction has a prevLSN, prefer it. Otherwise, set the LSN to nextAvailableLSN - 1 // If this transaction has a prevLSN, prefer it. Otherwise, set the LSN to nextAvailableLSN - 1
p->LSN = *stasis_page_lsn_ptr(p) = (xid_lsn == INVALID_LSN) ? (log_lsn - 1) : xid_lsn; p->LSN = *stasis_page_lsn_ptr(p) = (xid_lsn == INVALID_LSN) ? (log_lsn - 1) : xid_lsn;
p->pageType = *stasis_page_type_ptr(p) = UNINITIALIZED_PAGE; p->pageType = *stasis_page_type_ptr(p) = UNINITIALIZED_PAGE;
@ -337,7 +337,7 @@ typedef struct genericBlockImpl {
@todo The block API should pass around xids. @todo The block API should pass around xids.
*/ */
static const byte * blkFirst(block_t * b) { static const byte * blkFirst(block_t * b) {
genericBlockImpl * impl = b->impl; genericBlockImpl * impl = (genericBlockImpl*)b->impl;
impl->pos = stasis_record_first(-1, impl->p); impl->pos = stasis_record_first(-1, impl->p);
if(! memcmp(&(impl->pos), &(NULLRID), sizeof(recordid))) { if(! memcmp(&(impl->pos), &(NULLRID), sizeof(recordid))) {
return 0; return 0;
@ -346,7 +346,7 @@ static const byte * blkFirst(block_t * b) {
} }
} }
static const byte * blkNext(block_t * b) { static const byte * blkNext(block_t * b) {
genericBlockImpl * impl = b->impl; genericBlockImpl * impl = (genericBlockImpl*)b->impl;
impl->pos = stasis_record_next(-1, impl->p, impl->pos); impl->pos = stasis_record_next(-1, impl->p, impl->pos);
if(! memcmp(&(impl->pos), &NULLRID, sizeof(recordid))) { if(! memcmp(&(impl->pos), &NULLRID, sizeof(recordid))) {
return 0; return 0;
@ -355,7 +355,7 @@ static const byte * blkNext(block_t * b) {
} }
} }
static int blkSize(block_t * b) { static int blkSize(block_t * b) {
genericBlockImpl * impl = b->impl; genericBlockImpl * impl = (genericBlockImpl*)b->impl;
return stasis_record_type_to_size(impl->pos.size); return stasis_record_type_to_size(impl->pos.size);
} }
static void blkRelease(block_t * b) { static void blkRelease(block_t * b) {