Skip to content

Commit

Permalink
fixes #198 Consolidate our portability code by moving toku_include/*
Browse files Browse the repository at this point in the history
stuff into portability/
  • Loading branch information
esmet committed Mar 4, 2014
1 parent c5e2cb9 commit 1f07a7d
Show file tree
Hide file tree
Showing 40 changed files with 57 additions and 65 deletions.
4 changes: 1 addition & 3 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -27,13 +27,12 @@ if (USE_VALGRIND AND NOT VALGRIND_INCLUDE_DIR MATCHES NOTFOUND)
)
endif()
include_directories(
${CMAKE_CURRENT_SOURCE_DIR}/toku_include
${CMAKE_CURRENT_SOURCE_DIR}/portability
${CMAKE_CURRENT_SOURCE_DIR} ## so you can include <ft/ft-ops.h> from inside src/
${CMAKE_CURRENT_BINARY_DIR} ## for logging code
)
## include where config.h will be generated
include_directories(${CMAKE_CURRENT_BINARY_DIR}/toku_include)
include_directories(${CMAKE_CURRENT_BINARY_DIR}/portability)

## build db.h and include where it will be generated
add_subdirectory(buildheader)
Expand All @@ -54,7 +53,6 @@ add_subdirectory(src)
add_subdirectory(tools)

## subdirectories that just install things
add_subdirectory(toku_include)
add_subdirectory(examples)

install(
Expand Down
6 changes: 2 additions & 4 deletions cmake_modules/TokuBuildTagDatabases.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@ file(GLOB_RECURSE all_srcs
locktree/*.cc
portability/*.cc
src/*.cc
toku_include/*.cc
utils/*.cc
util/*.cc
db-benchmark-test/*.cc
Expand All @@ -24,13 +23,12 @@ file(GLOB_RECURSE all_hdrs
locktree/*.h
portability/*.h
src/*.h
toku_include/*.h
utils/*.h
util/*.h
db-benchmark-test/*.h
)
list(APPEND all_hdrs
${CMAKE_CURRENT_BINARY_DIR}/toku_include/toku_config.h
${CMAKE_CURRENT_BINARY_DIR}/portability/toku_config.h
${CMAKE_CURRENT_BINARY_DIR}/buildheader/db.h
${CMAKE_CURRENT_BINARY_DIR}/ft/log_header.h
)
Expand Down Expand Up @@ -79,7 +77,7 @@ if (USE_CSCOPE)
OUTPUT "${CMAKE_CURRENT_SOURCE_DIR}/cscope.out"
OUTPUT "${CMAKE_CURRENT_SOURCE_DIR}/cscope.in.out"
OUTPUT "${CMAKE_CURRENT_SOURCE_DIR}/cscope.po.out"
COMMAND ${CSCOPE} -b -q -R -i"${CMAKE_CURRENT_BINARY_DIR}/cscope.files" -I"${CMAKE_CURRENT_SOURCE_DIR}" -I"${CMAKE_CURRENT_SOURCE_DIR}/include" -I"${CMAKE_CURRENT_SOURCE_DIR}/toku_include" -I"${CMAKE_CURRENT_SOURCE_DIR}/portability" -I"${CMAKE_CURRENT_SOURCE_DIR}/ft" -I"${CMAKE_CURRENT_SOURCE_DIR}/src" -I"${CMAKE_CURRENT_SOURCE_DIR}/locktree" -I"${CMAKE_CURRENT_SOURCE_DIR}/utils" -I"${CMAKE_CURRENT_SOURCE_DIR}/db-benchmark-test" -I"${CMAKE_CURRENT_BINARY_DIR}" -I"${CMAKE_CURRENT_BINARY_DIR}/toku_include" -I"${CMAKE_CURRENT_BINARY_DIR}/buildheader"
COMMAND ${CSCOPE} -b -q -R -i"${CMAKE_CURRENT_BINARY_DIR}/cscope.files" -I"${CMAKE_CURRENT_SOURCE_DIR}" -I"${CMAKE_CURRENT_SOURCE_DIR}/include" -I"${CMAKE_CURRENT_SOURCE_DIR}/portability" -I"${CMAKE_CURRENT_SOURCE_DIR}/portability" -I"${CMAKE_CURRENT_SOURCE_DIR}/ft" -I"${CMAKE_CURRENT_SOURCE_DIR}/src" -I"${CMAKE_CURRENT_SOURCE_DIR}/locktree" -I"${CMAKE_CURRENT_SOURCE_DIR}/utils" -I"${CMAKE_CURRENT_SOURCE_DIR}/db-benchmark-test" -I"${CMAKE_CURRENT_BINARY_DIR}" -I"${CMAKE_CURRENT_BINARY_DIR}/portability" -I"${CMAKE_CURRENT_BINARY_DIR}/buildheader"
DEPENDS ${all_srcs} ${all_hdrs} install_tdb_h generate_config_h generate_log_code
WORKING_DIRECTORY "${CMAKE_CURRENT_SOURCE_DIR}")
add_custom_target(build_cscope.out ALL DEPENDS
Expand Down
5 changes: 3 additions & 2 deletions ft/background_job_manager.cc
Original file line number Diff line number Diff line change
Expand Up @@ -89,11 +89,12 @@ PATENT RIGHTS GRANT:
#ident "Copyright (c) 2011-2013 Tokutek Inc. All rights reserved."
#ident "The technology is licensed by the Massachusetts Institute of Technology, Rutgers State University of New Jersey, and the Research Foundation of State University of New York at Stony Brook under United States of America Serial No. 11/760379 and to the patents and/or patent applications resulting from it."

#include "background_job_manager.h"
#include "toku_config.h"
#include <portability/toku_config.h>
#include <memory.h>
#include <toku_pthread.h>

#include "background_job_manager.h"

struct background_job_manager_struct {
bool accepting_jobs;
uint32_t num_jobs;
Expand Down
2 changes: 1 addition & 1 deletion ft/ft-internal.h
Original file line number Diff line number Diff line change
Expand Up @@ -92,7 +92,7 @@ PATENT RIGHTS GRANT:
#ident "Copyright (c) 2007-2013 Tokutek Inc. All rights reserved."
#ident "The technology is licensed by the Massachusetts Institute of Technology, Rutgers State University of New Jersey, and the Research Foundation of State University of New York at Stony Brook under United States of America Serial No. 11/760379 and to the patents and/or patent applications resulting from it."

#include "toku_config.h"
#include <portability/toku_config.h>
#include <toku_race_tools.h>

// Symbol TOKUDB_REVISION is not defined by fractal-tree makefiles, so
Expand Down
2 changes: 1 addition & 1 deletion ft/rollback_log_node_cache.cc
Original file line number Diff line number Diff line change
Expand Up @@ -90,7 +90,7 @@ PATENT RIGHTS GRANT:
#ident "The technology is licensed by the Massachusetts Institute of Technology, Rutgers State University of New Jersey, and the Research Foundation of State University of New York at Stony Brook under United States of America Serial No. 11/760379 and to the patents and/or patent applications resulting from it."

#include <memory.h>
#include <toku_include/toku_portability.h>
#include <portability/toku_portability.h>

#include "rollback_log_node_cache.h"

Expand Down
2 changes: 1 addition & 1 deletion locktree/tests/range_buffer_test.cc
Original file line number Diff line number Diff line change
Expand Up @@ -93,7 +93,7 @@ PATENT RIGHTS GRANT:

#include <string.h>

#include <toku_include/memory.h>
#include <portability/memory.h>

#include <locktree/range_buffer.h>

Expand Down
11 changes: 10 additions & 1 deletion portability/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -29,10 +29,19 @@ set_property(TARGET ${LIBTOKUPORTABILITY} tokuportability_static_conv APPEND PRO
set_property(SOURCE file memory os_malloc portability toku_assert toku_rwlock APPEND PROPERTY
COMPILE_DEFINITIONS TOKU_ALLOW_DEPRECATED=1)

configure_file(toku_config.h.in toku_config.h)
add_custom_target(generate_config_h DEPENDS
"${CMAKE_CURRENT_BINARY_DIR}/toku_config.h")

# detect when we are being built as a subproject
if (NOT DEFINED MYSQL_PROJECT_NAME_DOCSTRING)
install(
FILES toku_os_types.h toku_time.h
FILES toku_os_types.h toku_time.h toku_list.h toku_os.h
DESTINATION include
COMPONENT tokukv_headers
)
install(
FILES "${CMAKE_CURRENT_BINARY_DIR}/toku_config.h"
DESTINATION include
COMPONENT tokukv_headers
)
Expand Down
4 changes: 2 additions & 2 deletions portability/huge_page_detection.cc
Original file line number Diff line number Diff line change
Expand Up @@ -93,8 +93,8 @@ PATENT RIGHTS GRANT:
#include <stdio.h>
#include <string.h>

#include <toku_include/toku_assert.h>
#include <toku_include/toku_os.h>
#include <portability/toku_assert.h>
#include <portability/toku_os.h>

static bool check_huge_pages_config_file(const char *fname)
// Effect: Return true if huge pages are there. If so, print diagnostics.
Expand Down
2 changes: 1 addition & 1 deletion portability/memory.cc
Original file line number Diff line number Diff line change
Expand Up @@ -88,7 +88,7 @@ PATENT RIGHTS GRANT:

#ident "Copyright (c) 2007-2013 Tokutek Inc. All rights reserved."

#include "toku_config.h"
#include <portability/toku_config.h>

#include <toku_portability.h>
#include <string.h>
Expand Down
File renamed without changes.
2 changes: 1 addition & 1 deletion portability/os_malloc.cc
Original file line number Diff line number Diff line change
Expand Up @@ -89,7 +89,7 @@ PATENT RIGHTS GRANT:

#ident "Copyright (c) 2007-2013 Tokutek Inc. All rights reserved."

#include "toku_config.h"
#include <portability/toku_config.h>

#include <toku_portability.h>
#include <stdlib.h>
Expand Down
2 changes: 1 addition & 1 deletion portability/portability.cc
Original file line number Diff line number Diff line change
Expand Up @@ -88,7 +88,7 @@ PATENT RIGHTS GRANT:
#ident "Copyright (c) 2007-2013 Tokutek Inc. All rights reserved."
#ident "$Id$"

#include "toku_config.h"
#include <portability/toku_config.h>

#include <stdio.h>
#include <stdlib.h>
Expand Down
File renamed without changes.
8 changes: 5 additions & 3 deletions portability/tests/test-cache-line-boundary-fails.cc
Original file line number Diff line number Diff line change
Expand Up @@ -89,15 +89,17 @@ PATENT RIGHTS GRANT:
#ident "Copyright (c) 2007-2013 Tokutek Inc. All rights reserved."
#ident "The technology is licensed by the Massachusetts Institute of Technology, Rutgers State University of New Jersey, and the Research Foundation of State University of New York at Stony Brook under United States of America Serial No. 11/760379 and to the patents and/or patent applications resulting from it."

#include "toku_config.h"
#include <memory.h>
#include <portability/toku_config.h>
#include <portability/toku_atomic.h>
#include "test.h"

#include <memory.h>
#include <stdint.h>
#include <stdio.h>
#include <stdlib.h>
#include <signal.h>

#include "test.h"

int verbose = 0;

static const size_t cachelinesize = 64;
Expand Down
8 changes: 4 additions & 4 deletions portability/tests/test-hugepage.cc
Original file line number Diff line number Diff line change
Expand Up @@ -88,12 +88,12 @@ PATENT RIGHTS GRANT:

#ident "Copyright (c) 2007-2013 Tokutek Inc. All rights reserved."
#ident "The technology is licensed by the Massachusetts Institute of Technology, Rutgers State University of New Jersey, and the Research Foundation of State University of New York at Stony Brook under United States of America Serial No. 11/760379 and to the patents and/or patent applications resulting from it."
#include <stdio.h>
#include <assert.h>
#include <toku_include/toku_os.h>

#include <portability/toku_os.h>
#include <portability/toku_assert.h>

int main(void) {
bool enabled = toku_os_huge_pages_enabled();
assert(!enabled);
invariant(!enabled);
return 0;
}
2 changes: 1 addition & 1 deletion portability/tests/test-xid.cc
Original file line number Diff line number Diff line change
Expand Up @@ -88,7 +88,7 @@ PATENT RIGHTS GRANT:

#ident "Copyright (c) 2007-2013 Tokutek Inc. All rights reserved."
#ident "The technology is licensed by the Massachusetts Institute of Technology, Rutgers State University of New Jersey, and the Research Foundation of State University of New York at Stony Brook under United States of America Serial No. 11/760379 and to the patents and/or patent applications resulting from it."
#include "toku_config.h"
#include <portability/toku_config.h>
#include <stdio.h>
#include <toku_stdint.h>
#include <unistd.h>
Expand Down
2 changes: 1 addition & 1 deletion portability/toku_assert.cc
Original file line number Diff line number Diff line change
Expand Up @@ -88,7 +88,7 @@ PATENT RIGHTS GRANT:

#ident "Copyright (c) 2007-2013 Tokutek Inc. All rights reserved."

#include "toku_config.h"
#include <portability/toku_config.h>

#include <toku_portability.h>
#include "toku_assert.h"
Expand Down
3 changes: 1 addition & 2 deletions toku_include/toku_assert.h → portability/toku_assert.h
Original file line number Diff line number Diff line change
Expand Up @@ -94,7 +94,7 @@ PATENT RIGHTS GRANT:
/* This version will complain if NDEBUG is set. */
/* It evaluates the argument and then calls a function toku_do_assert() which takes all the hits for the branches not taken. */

#include "toku_config.h"
#include <portability/toku_config.h>

#include <stdint.h>
#include <errno.h>
Expand All @@ -103,7 +103,6 @@ PATENT RIGHTS GRANT:
#error NDEBUG should not be set
#endif


static inline int get_error_errno(void);

static inline int
Expand Down
3 changes: 2 additions & 1 deletion portability/toku_atomic.h
Original file line number Diff line number Diff line change
Expand Up @@ -91,8 +91,9 @@ PATENT RIGHTS GRANT:
#ifndef TOKU_ATOMIC_H
#define TOKU_ATOMIC_H

#include "toku_config.h"
#include <portability/toku_config.h>
#include <toku_assert.h>

#include <stdbool.h>
#include <stdint.h>
#include <stddef.h>
Expand Down
2 changes: 1 addition & 1 deletion portability/toku_byteswap.h
Original file line number Diff line number Diff line change
Expand Up @@ -91,7 +91,7 @@ PATENT RIGHTS GRANT:
#ifndef TOKU_BYTESWAP_H
#define TOKU_BYTESWAP_H

#include "toku_config.h"
#include <portability/toku_config.h>

#if defined(HAVE_BYTESWAP_H)
# include <byteswap.h>
Expand Down
File renamed without changes.
2 changes: 1 addition & 1 deletion toku_include/toku_htod.h → portability/toku_htod.h
Original file line number Diff line number Diff line change
Expand Up @@ -109,7 +109,7 @@ PATENT RIGHTS GRANT:
#ifndef _TOKU_HTOD_H
#define _TOKU_HTOD_H

#include "toku_config.h"
#include <portability/toku_config.h>

#if defined(HAVE_ENDIAN_H)
# include <endian.h>
Expand Down
1 change: 0 additions & 1 deletion portability/toku_htonl.h
Original file line number Diff line number Diff line change
Expand Up @@ -95,7 +95,6 @@ PATENT RIGHTS GRANT:
//#error
#endif

// TODO: This byte order stuff should all be in once place (ie: portability layer, not toku_include)
#include <toku_htod.h>
#include <arpa/inet.h>

Expand Down
File renamed without changes.
File renamed without changes.
Original file line number Diff line number Diff line change
Expand Up @@ -91,7 +91,7 @@ PATENT RIGHTS GRANT:
#ifndef TOKU_PORTABILITY_H
#define TOKU_PORTABILITY_H

#include "toku_config.h"
#include <portability/toku_config.h>

// Tokutek portability layer

Expand Down
2 changes: 1 addition & 1 deletion portability/toku_pthread.cc
Original file line number Diff line number Diff line change
Expand Up @@ -89,7 +89,7 @@ PATENT RIGHTS GRANT:
#ident "Copyright (c) 2007-2013 Tokutek Inc. All rights reserved."

#define _GNU_SOURCE 1
#include "toku_config.h"
#include <portability/toku_config.h>
#include <toku_pthread.h>

int toku_pthread_yield(void) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -91,7 +91,7 @@ PATENT RIGHTS GRANT:
#ifndef TOKU_RACE_TOOLS_H
#define TOKU_RACE_TOOLS_H

#include "toku_config.h"
#include <portability/toku_config.h>

#if defined(__linux__) && USE_VALGRIND

Expand Down
2 changes: 1 addition & 1 deletion portability/toku_random.h
Original file line number Diff line number Diff line change
Expand Up @@ -91,7 +91,7 @@ PATENT RIGHTS GRANT:
#ifndef TOKU_RANDOM_H
#define TOKU_RANDOM_H

#include "toku_config.h"
#include <portability/toku_config.h>
#include <toku_portability.h>
#include <toku_assert.h>
#include <stdlib.h>
Expand Down
2 changes: 1 addition & 1 deletion portability/toku_time.h
Original file line number Diff line number Diff line change
Expand Up @@ -91,7 +91,7 @@ PATENT RIGHTS GRANT:
#ifndef TOKU_TIME_H
#define TOKU_TIME_H

#include "toku_config.h"
#include <portability/toku_config.h>
#include <time.h>
#include <sys/time.h>
#include <stdint.h>
Expand Down
2 changes: 1 addition & 1 deletion src/tests/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -400,7 +400,7 @@ if(BUILD_TESTING OR BUILD_SRC_TESTS)
set_property(TARGET ${base}.bdb APPEND PROPERTY
COMPILE_DEFINITIONS "USE_BDB;IS_TDB=0;TOKU_ALLOW_DEPRECATED")
set_target_properties(${base}.bdb PROPERTIES
INCLUDE_DIRECTORIES "${BDB_INCLUDE_DIR};${CMAKE_CURRENT_BINARY_DIR}/../../toku_include;${CMAKE_CURRENT_SOURCE_DIR}/../../toku_include;${CMAKE_CURRENT_SOURCE_DIR}/../../portability;${CMAKE_CURRENT_SOURCE_DIR}/../..")
INCLUDE_DIRECTORIES "${BDB_INCLUDE_DIR};${CMAKE_CURRENT_SOURCE_DIR}/../../portability;${CMAKE_CURRENT_SOURCE_DIR}/../..")
target_link_libraries(${base}.bdb ${LIBTOKUPORTABILITY} ${BDB_LIBRARIES})
add_space_separated_property(TARGET ${base}.bdb COMPILE_FLAGS -fvisibility=hidden)
endforeach(bin)
Expand Down
17 changes: 0 additions & 17 deletions toku_include/CMakeLists.txt

This file was deleted.

2 changes: 1 addition & 1 deletion tools/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ foreach(util ${utils})
set_property(TARGET ${util}.bdb APPEND PROPERTY
COMPILE_DEFINITIONS "IS_TDB=0;USE_BDB=1;TOKU_ALLOW_DEPRECATED")
set_target_properties(${util}.bdb PROPERTIES
INCLUDE_DIRECTORIES "${BDB_INCLUDE_DIR};${CMAKE_CURRENT_BINARY_DIR}/../toku_include;${CMAKE_CURRENT_SOURCE_DIR}/../toku_include;${CMAKE_CURRENT_SOURCE_DIR}/../portability;${CMAKE_CURRENT_SOURCE_DIR}/..")
INCLUDE_DIRECTORIES "${BDB_INCLUDE_DIR};${CMAKE_CURRENT_SOURCE_DIR}/../portability;${CMAKE_CURRENT_SOURCE_DIR}/..")
target_link_libraries(${util}.bdb ${LIBTOKUPORTABILITY} ${BDB_LIBRARIES})
add_space_separated_property(TARGET ${util}.bdb COMPILE_FLAGS -fvisibility=hidden)
endif()
Expand Down
2 changes: 1 addition & 1 deletion util/context.h
Original file line number Diff line number Diff line change
Expand Up @@ -91,7 +91,7 @@ PATENT RIGHTS GRANT:
#ident "Copyright (c) 2007-2014 Tokutek Inc. All rights reserved."
#ident "The technology is licensed by the Massachusetts Institute of Technology, Rutgers State University of New Jersey, and the Research Foundation of State University of New York at Stony Brook under United States of America Serial No. 11/760379 and to the patents and/or patent applications resulting from it."

#include <toku_include/toku_portability.h>
#include <portability/toku_portability.h>

#include <db.h>

Expand Down
2 changes: 1 addition & 1 deletion util/dmt.cc
Original file line number Diff line number Diff line change
Expand Up @@ -91,7 +91,7 @@ PATENT RIGHTS GRANT:
#include <string.h>
#include <db.h>

#include <toku_include/memory.h>
#include <portability/memory.h>
#include <limits.h>

namespace toku {
Expand Down
2 changes: 1 addition & 1 deletion util/doubly_linked_list.h
Original file line number Diff line number Diff line change
Expand Up @@ -117,7 +117,7 @@ PATENT RIGHTS GRANT:
//******************************************************************************

#include <stdbool.h>
#include <toku_include/toku_assert.h>
#include <portability/toku_assert.h>

namespace toku {

Expand Down
6 changes: 4 additions & 2 deletions util/kibbutz.cc
Original file line number Diff line number Diff line change
Expand Up @@ -89,11 +89,13 @@ PATENT RIGHTS GRANT:
#ident "Copyright (c) 2011-2013 Tokutek Inc. All rights reserved."
#ident "The technology is licensed by the Massachusetts Institute of Technology, Rutgers State University of New Jersey, and the Research Foundation of State University of New York at Stony Brook under United States of America Serial No. 11/760379 and to the patents and/or patent applications resulting from it."

#include "kibbutz.h"
#include "toku_config.h"
#include <memory.h>

#include <portability/toku_config.h>
#include <toku_pthread.h>

#include "kibbutz.h"

// A Kibbutz is a collection of workers and some work to do.
struct todo {
void (*f)(void *extra);
Expand Down
2 changes: 1 addition & 1 deletion util/omt.cc
Original file line number Diff line number Diff line change
Expand Up @@ -92,7 +92,7 @@ PATENT RIGHTS GRANT:
#include <string.h>
#include <db.h>

#include <toku_include/memory.h>
#include <portability/memory.h>

namespace toku {

Expand Down
Loading

0 comments on commit 1f07a7d

Please sign in to comment.