From a0cdddf316f4119f31ca4939a7e0ba8d4ceb38e2 Mon Sep 17 00:00:00 2001 From: Michael Vrable Date: Tue, 27 Oct 2015 21:19:49 -0700 Subject: [PATCH] Fix BlueSky build on modern Linux and libs3. - Update S3_initialize calls to current API (3-argument form). - Minor CMakeLists updates. - dirfd is now a system function so avoid that name in our code. --- CMakeLists.txt | 2 +- bluesky/store-s3.c | 2 +- cloudbench/CMakeLists.txt | 2 +- cloudbench/readbench.c | 2 +- cloudbench/readdelay.c | 2 +- cloudbench/readlatency.c | 2 +- logbench/logbench.c | 10 +++++----- 7 files changed, 11 insertions(+), 11 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 379a92c..059c766 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -5,7 +5,7 @@ set(CMAKE_BUILD_TYPE Debug) include(FindPkgConfig) pkg_check_modules(GLIB REQUIRED glib-2.0 gthread-2.0) -set(LIBS3_BUILD_DIR "${CMAKE_SOURCE_DIR}/libs3-1.4/build") +set(LIBS3_BUILD_DIR "${CMAKE_SOURCE_DIR}/libs3/build") add_definitions(-D_FILE_OFFSET_BITS=64) add_subdirectory(kvstore) diff --git a/bluesky/store-s3.c b/bluesky/store-s3.c index fd2da4f..0c9e33d 100644 --- a/bluesky/store-s3.c +++ b/bluesky/store-s3.c @@ -256,6 +256,6 @@ static BlueSkyStoreImplementation store_impl = { void bluesky_store_init_s3(void) { - S3_initialize(NULL, S3_INIT_ALL); + S3_initialize(NULL, S3_INIT_ALL, NULL); bluesky_store_register(&store_impl, "s3"); } diff --git a/cloudbench/CMakeLists.txt b/cloudbench/CMakeLists.txt index 6a9070d..e58b6b3 100644 --- a/cloudbench/CMakeLists.txt +++ b/cloudbench/CMakeLists.txt @@ -8,6 +8,6 @@ add_executable(s3readdelay readdelay.c) set(CMAKE_C_FLAGS "-Wall -std=gnu99 ${CMAKE_C_FLAGS}") set(INSTALL_RPATH_USE_LINK_PATH 1) -target_link_libraries(s3readbench pthread s3) +target_link_libraries(s3readbench m pthread s3) target_link_libraries(s3readlatency pthread s3) target_link_libraries(s3readdelay pthread s3) diff --git a/cloudbench/readbench.c b/cloudbench/readbench.c index 7f1ff12..ac4185e 100644 --- a/cloudbench/readbench.c +++ b/cloudbench/readbench.c @@ -254,7 +254,7 @@ int main(int argc, char *argv[]) return 1; } - S3_initialize(NULL, S3_INIT_ALL); + S3_initialize(NULL, S3_INIT_ALL, NULL); bucket.bucketName = "mvrable-benchmark"; bucket.protocol = S3ProtocolHTTP; diff --git a/cloudbench/readdelay.c b/cloudbench/readdelay.c index c733e09..cc82c7a 100644 --- a/cloudbench/readdelay.c +++ b/cloudbench/readdelay.c @@ -101,7 +101,7 @@ void run_test(int64_t delay_ns) int main(int argc, char *argv[]) { - S3_initialize(NULL, S3_INIT_ALL); + S3_initialize(NULL, S3_INIT_ALL, NULL); bucket.bucketName = "mvrable-benchmark"; bucket.protocol = S3ProtocolHTTP; diff --git a/cloudbench/readlatency.c b/cloudbench/readlatency.c index 1fb8c20..05fbaa7 100644 --- a/cloudbench/readlatency.c +++ b/cloudbench/readlatency.c @@ -201,7 +201,7 @@ int main(int argc, char *argv[]) return 1; } - S3_initialize(NULL, S3_INIT_ALL); + S3_initialize(NULL, S3_INIT_ALL, NULL); bucket.bucketName = "mvrable-benchmark"; bucket.protocol = S3ProtocolHTTP; diff --git a/logbench/logbench.c b/logbench/logbench.c index 6f3a858..c421be1 100644 --- a/logbench/logbench.c +++ b/logbench/logbench.c @@ -84,14 +84,14 @@ void writebuf(int fd, const char *buf, size_t len) } /************************ Direct-to-filesystem logging ***********************/ -static int dirfd = -1; +static int dir_fd = -1; gpointer fslog_thread(gpointer d) { while (TRUE) { struct item *item = get_item(); - int fd = openat(dirfd, item->key, O_CREAT|O_WRONLY|O_TRUNC, 0666); + int fd = openat(dir_fd, item->key, O_CREAT|O_WRONLY|O_TRUNC, 0666); g_assert(fd >= 0); writebuf(fd, item->data, item->len); @@ -99,7 +99,7 @@ gpointer fslog_thread(gpointer d) finish_item(item); fsync(fd); - fsync(dirfd); + fsync(dir_fd); close(fd); } @@ -108,8 +108,8 @@ gpointer fslog_thread(gpointer d) void launch_fslog() { - dirfd = open(".", O_DIRECTORY); - g_assert(dirfd >= 0); + dir_fd = open(".", O_DIRECTORY); + g_assert(dir_fd >= 0); for (int i = 0; i < 1; i++) g_thread_create(fslog_thread, NULL, FALSE, NULL); -- 2.20.1