diff --git a/CMakeLists.txt b/CMakeLists.txt index 42a1721..da74bec 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -168,8 +168,8 @@ LINK_DIRECTORIES(${CMAKE_CURRENT_BINARY_DIR}/src/stasis) IF ( "${CMAKE_C_COMPILER_ID}" STREQUAL "GNU" ) SET(COMMON_LIBRARIES stasis m pthread stdc++ ${DBUG}) # profiler) - SET(CMAKE_C_FLAGS "-g -Wall -ansi -pedantic -std=gnu99 -DPBL_COMPAT -D_FILE_OFFSET_BITS=64 ${CMAKE_C_FLAGS}") - SET(CMAKE_CXX_FLAGS "-g -Wall -ansi -Wno-long-long -pedantic -DPBL_COMPAT -D_FILE_OFFSET_BITS=64 ${CMAKE_CXX_FLAGS}") + SET(CMAKE_C_FLAGS "-g -Wall -Wextra -ansi -Wno-unused-parameter -pedantic -std=gnu99 -DPBL_COMPAT -D_FILE_OFFSET_BITS=64 ${CMAKE_C_FLAGS}") + SET(CMAKE_CXX_FLAGS "-g -Wall -Wextra -ansi -Wno-unused-parameter -Wno-long-long -pedantic -DPBL_COMPAT -D_FILE_OFFSET_BITS=64 ${CMAKE_CXX_FLAGS}") ELSEIF ( "${CMAKE_C_COMPILER_ID}" STREQUAL "SunPro" ) SET(COMMON_LIBRARIES stasis m pthread Crun Cstd) SET(CMAKE_C_FLAGS "-g -xc99=all -DPBL_COMPAT -D_FILE_OFFSET_BITS=64 ${CMAKE_C_FLAGS}") @@ -178,8 +178,8 @@ ELSE( "${CMAKE_C_COMPILER_ID}" STREQUAL "GNU" ) # TODO: how to detect compilers correctly on old cmake??? This is a huge hack; it uses old gcc # options, since cmake is old... SET(COMMON_LIBRARIES stasis m pthread stdc++ ${DBUG}) - SET(CMAKE_C_FLAGS "-g -Wall -pedantic -std=gnu99 -DPBL_COMPAT -D_FILE_OFFSET_BITS=64 ${CMAKE_C_FLAGS}") - SET(CMAKE_CXX_FLAGS "-g -Wall -Wno-long-long -pedantic -DPBL_COMPAT -D_FILE_OFFSET_BITS=64 ${CMAKE_CXX_FLAGS}") + SET(CMAKE_C_FLAGS "-g -Wall -Wlong-long -pedantic -std=gnu99 -DPBL_COMPAT -D_FILE_OFFSET_BITS=64 ${CMAKE_C_FLAGS}") + SET(CMAKE_CXX_FLAGS "-g -Wall -pedantic -DPBL_COMPAT -D_FILE_OFFSET_BITS=64 ${CMAKE_CXX_FLAGS}") ENDIF ( "${CMAKE_C_COMPILER_ID}" STREQUAL "GNU" ) INSTALL(DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}/src/stasis diff --git a/benchmarks/rawIOPS.c b/benchmarks/rawIOPS.c index 78b7d35..49c901c 100644 --- a/benchmarks/rawIOPS.c +++ b/benchmarks/rawIOPS.c @@ -37,7 +37,7 @@ void * status_worker(void * ignored) { while(1) { struct timespec ts = stasis_double_to_timespec(1.0); nanosleep(&ts,0); - printf("current ops/sec %lld\n", completed_ops - last_ops); + printf("current ops/sec %lld\n", (long long) (completed_ops - last_ops)); last_ops = completed_ops; iter ++; if((! (iter % 10)) && (op_count == 0)) { diff --git a/src/stasis/dirtyPageTable.c b/src/stasis/dirtyPageTable.c index 0bcc773..41b3587 100644 --- a/src/stasis/dirtyPageTable.c +++ b/src/stasis/dirtyPageTable.c @@ -171,7 +171,7 @@ int stasis_dirty_page_table_flush_with_target(stasis_dirty_page_table_t * dirtyP long buffered = 0; do { dpt_entry dummy = { 0, 0 }; - pageid_t vals[stride]; + pageid_t * vals = stasis_alloca(stride, pageid_t); int off = 0; int strides = 0; all_flushed = 1; diff --git a/src/stasis/flags.c b/src/stasis/flags.c index d1012bd..670fc5c 100644 --- a/src/stasis/flags.c +++ b/src/stasis/flags.c @@ -173,27 +173,27 @@ size_t stasis_log_in_memory_max_entries = 0; // unlimited #endif #ifdef STASIS_LOG_FILE_NAME -char * stasis_log_file_name = STASIS_LOG_FILE_NAME; +const char * stasis_log_file_name = STASIS_LOG_FILE_NAME; #else -char * stasis_log_file_name = "logfile.txt"; +const char * stasis_log_file_name = "logfile.txt"; #endif #ifdef STASIS_STORE_FILE_NAME -char * stasis_store_file_name = STASIS_STORE_FILE_NAME; +const char * stasis_store_file_name = STASIS_STORE_FILE_NAME; #else -char * stasis_store_file_name = "storefile.txt"; +const char * stasis_store_file_name = "storefile.txt"; #endif #ifdef STASIS_STORE_FILE_1_NAME -char * stasis_store_file_1_name = STASIS_STORE_FILE_1_NAME; +const char * stasis_store_file_1_name = STASIS_STORE_FILE_1_NAME; #else -char * stasis_store_file_1_name = "storefile1.txt"; +const char * stasis_store_file_1_name = "storefile1.txt"; #endif #ifdef STASIS_STORE_FILE_2_NAME char * stasis_store_file_2_name = STASIS_STORE_FILE_2_NAME; #else -char * stasis_store_file_2_name = "storefile2.txt"; +const char * stasis_store_file_2_name = "storefile2.txt"; #endif #ifdef STASIS_BUFFER_MANAGER_HASH_PREFETCH_COUNT diff --git a/src/stasis/io/file.c b/src/stasis/io/file.c index c6e74c7..3688ce0 100644 --- a/src/stasis/io/file.c +++ b/src/stasis/io/file.c @@ -136,7 +136,7 @@ inline static int file_write_unlocked(stasis_handle_t * h, lsn_t off, return error; } -inline static void print_eof_error(char * file, int line) { +inline static void print_eof_error(const char * file, int line) { fprintf(stderr, "%s:%d Internal error: attempt to access negative offset, or beyond EOF.\n", file, line); fflush(stderr); } diff --git a/src/stasis/io/raid0.c b/src/stasis/io/raid0.c index 1102e97..b9e51b7 100644 --- a/src/stasis/io/raid0.c +++ b/src/stasis/io/raid0.c @@ -213,7 +213,7 @@ stasis_handle_t * stasis_handle_raid0_factory(void) { } else { int count = 0; while(stasis_handle_raid0_filenames[count]) count++; - stasis_handle_t * h[count]; + stasis_handle_t ** h = stasis_alloca(count, stasis_handle_t*); for(int i = 0; i < count; i++) { h[i] = stasis_handle_file_factory(stasis_handle_raid0_filenames[i], O_CREAT | O_RDWR | stasis_buffer_manager_io_handle_flags, FILE_PERM); } diff --git a/src/stasis/operations/alloc.c b/src/stasis/operations/alloc.c index 60b5662..c41af2c 100644 --- a/src/stasis/operations/alloc.c +++ b/src/stasis/operations/alloc.c @@ -283,7 +283,6 @@ recordid Talloc(int xid, unsigned long size) { if(size >= BLOB_THRESHOLD_SIZE) { type = BLOB_SLOT; } else { - assert(size >= 0); type = size; } diff --git a/src/stasis/operations/linkedListNTA.c b/src/stasis/operations/linkedListNTA.c index 110f1aa..5d8cc91 100644 --- a/src/stasis/operations/linkedListNTA.c +++ b/src/stasis/operations/linkedListNTA.c @@ -1,5 +1,3 @@ -#define __USE_GNU -#define _GNU_SOURCE #include #include diff --git a/src/stasis/page.c b/src/stasis/page.c index cc1b8da..510c391 100644 --- a/src/stasis/page.c +++ b/src/stasis/page.c @@ -125,8 +125,7 @@ void stasis_page_init(stasis_dirty_page_table_t * dpt) { void stasis_page_deinit(void) { for(int i = 0; i < MAX_PAGE_TYPE; i++) { - page_impl p = { 0 }; - page_impls[i] = p; + memset(&page_impls[i], 0, sizeof(page_impls[i])); } stasis_page_fixed_deinit(); diff --git a/src/stasis/util/latchStats.c b/src/stasis/util/latchStats.c index 5a7bf69..236e41c 100644 --- a/src/stasis/util/latchStats.c +++ b/src/stasis/util/latchStats.c @@ -34,7 +34,7 @@ void print_profile_tuple(profile_tuple * tup) { double mean_hold = ((double)tup->sum_hold)/ ((double)tup->count); double std_hold = sqrt((((double)tup->sum_hold2) / ((double)tup->count)) - (mean_hold * mean_hold)); - printf("{count=%ld spin[%1.4lf %1.4lf %0.0lf] held[%1.4lf %1.4lf %0.0lf]us}", tup->count, + printf("{count=%ld spin[%1.4f %1.4f %0.0f] held[%1.4f %1.4f %0.0f]us}", tup->count, mean_spin, std_spin, tup->max_spin, mean_hold, std_hold, tup->max_hold); } else { diff --git a/src/stasis/util/ringbuffer.c b/src/stasis/util/ringbuffer.c index 2fffa04..66e1703 100644 --- a/src/stasis/util/ringbuffer.c +++ b/src/stasis/util/ringbuffer.c @@ -154,7 +154,7 @@ lsn_t stasis_ringbuffer_consume_bytes(stasis_ringbuffer_t * ring, lsn_t* sz, lsn while(RING_VOLATILE == (ret = stasis_ringbuffer_nb_consume_bytes(ring, RING_NEXT, sz))) { pthread_cond_wait(&ring->write_done, &ring->mut); - *sz = (ring->flush > ring->rf) ? RING_NEXT : orig_sz; + *sz = (ring->flush > ring->rf) ? ((lsn_t)RING_NEXT) : orig_sz; if(ring->shutdown) { if(ring->rt == ring->wf) { DEBUG(stderr, "Shutting down, and there are no more bytes. Signaling shutdown thread.\n"); diff --git a/stasis/experimental/compression/compression.h b/stasis/experimental/compression/compression.h index 11f4d5b..5f23d49 100644 --- a/stasis/experimental/compression/compression.h +++ b/stasis/experimental/compression/compression.h @@ -2,11 +2,7 @@ #define _ROSE_COMPRESSION_COMPRESSION_H__ #include -#define __STDC_LIMIT_MACROS 1 #include -#ifndef UINT16_MAX // XXX should be defined in stdint.h. -#define UINT16_MAX (65535) -#endif namespace rose { diff --git a/stasis/experimental/compression/multicolumn-impl.h b/stasis/experimental/compression/multicolumn-impl.h index 729c002..d4475dc 100644 --- a/stasis/experimental/compression/multicolumn-impl.h +++ b/stasis/experimental/compression/multicolumn-impl.h @@ -207,26 +207,30 @@ Multicolumn::recordFind(int xid, TUPLE& val, TUPLE& scratch) { */ static const page_impl multicolumn_impl = { - -1, + -1, // page type + 0, // has header 0, // multicolumnRead, - 0, // multicolumnWrite, + 0, // multicolumnWrite, 0, // multicolumnReadDone, - 0, // multicolumnWriteDone, + 0, // multicolumnWriteDone, 0, // multicolumnGetType, 0, // multicolumnSetType, 0, // multicolumnGetLength, 0, // multicolumnFirst, 0, // multicolumnNext, + 0, // multicolumnLast, 0, // multicolumnIsBlockSupported, 0, // multicolumnBlockFirst, 0, // multicolumnBlockNext, 0, // multicolumnBlockDone, 0, // multicolumnFreespace, - 0, // multicolumnCompact, - 0, // multicolumnPreRalloc, - 0, // multicolumnPostRalloc, - 0, // multicolumnFree, - 0, // dereference_identity, + 0, // multicolumnCompact, + 0, // multicolumnCompactSlotIDs, + 0, // multicolumnPreRalloc, + 0, // multicolumnPostRalloc, + 0, // multicolumnSplice, + 0, // multicolumnFree, + 0, // dereference_identity, 0, // multicolumnLoaded, 0, // multicolumnFlushed 0, // multicolumnCleanup diff --git a/stasis/experimental/compression/pstar-impl.h b/stasis/experimental/compression/pstar-impl.h index b9dbb74..19925ef 100644 --- a/stasis/experimental/compression/pstar-impl.h +++ b/stasis/experimental/compression/pstar-impl.h @@ -62,26 +62,30 @@ static void pStarCleanup(Page * p) { */ static const page_impl pstar_impl = { - -1, + -1, // page type + 0, // has header 0, // pStarRead, - 0, // pStarWrite, + 0, // pStarWrite, 0, // pStarReadDone, - 0, // pStarWriteDone, + 0, // pStarWriteDone, 0, // pStarGetType, 0, // pStarSetType, 0, // pStarGetLength, 0, // pStarFirst, 0, // pStarNext, + 0, // pStarLast 0, // pStarIsBlockSupported, 0, // pStarBlockFirst, 0, // pStarBlockNext, 0, // pStarBlockDone, 0, // pStarFreespace, - 0, // pStarCompact, - 0, // pStarPreRalloc, - 0, // pStarPostRalloc, - 0, // pStarFree, - 0, // dereference_identity, + 0, // pStarCompact, + 0, // pStarCompactSlotIDs, + 0, // pStarPreRalloc, + 0, // pStarPostRalloc, + 0, // pStarSplice, + 0, // pStarFree, + 0, // dereference_identity, 0, // pStarLoaded, 0, // pStarFlushed 0, // pStarCleanup diff --git a/stasis/flags.h b/stasis/flags.h index f2d95fe..ed5a56b 100644 --- a/stasis/flags.h +++ b/stasis/flags.h @@ -191,15 +191,15 @@ extern int stasis_log_type; extern size_t stasis_log_in_memory_max_entries; -extern char * stasis_log_file_name; +extern const char * stasis_log_file_name; extern int stasis_log_file_mode; extern int stasis_log_file_permissions; extern int stasis_log_dir_permissions; extern int stasis_log_softcommit; -extern char * stasis_store_file_name; -extern char * stasis_store_file_1_name; -extern char * stasis_store_file_2_name; +extern const char * stasis_store_file_name; +extern const char * stasis_store_file_1_name; +extern const char * stasis_store_file_2_name; /**