message(FATAL_ERROR "Cannot have WITH_KRBD with WITH_RBD.")
endif()
-# embedded ceph daemon static library
-# NOTE: Ceph is mostly LGPL (see COPYING), which means that
-# static linking brings with it restrictions. Please be sure
-# to look at the LGPL license carefully before linking this library to
-# your code. See http://www.gnu.org/licenses/gpl-faq.html#LGPLStaticVsDynamic.
-option(WITH_EMBEDDED "build the embedded ceph daemon library" ON)
-
option(WITH_LEVELDB "LevelDB is here" ON)
if(WITH_LEVELDB)
if(LEVELDB_PREFIX)
### Build
```
-./run-make-check.sh -DWITH_EMBEDDED=OFF -DWITH_SYSTEM_BOOST=ON -DWITH_LTTNG=OFF -DWITH_REENTRANT_STRSIGNAL=ON -DWITH_THREAD_SAFE_RES_QUERY=ON
+./run-make-check.sh -DWITH_SYSTEM_BOOST=ON -DWITH_LTTNG=OFF -DWITH_REENTRANT_STRSIGNAL=ON -DWITH_THREAD_SAFE_RES_QUERY=ON
```
### Packaging
or
-./test/docker-test.sh --os-type alpine --os-version edge -- ./run-make-check.sh -DWITH_EMBEDDED=OFF -DWITH_SYSTEM_BOOST=ON -DWITH_LTTNG=OFF -DWITH_REENTRANT_STRSIGNAL=ON -DWITH_THREAD_SAFE_RES_QUERY=ON
+./test/docker-test.sh --os-type alpine --os-version edge -- ./run-make-check.sh -DWITH_SYSTEM_BOOST=ON -DWITH_LTTNG=OFF -DWITH_REENTRANT_STRSIGNAL=ON -DWITH_THREAD_SAFE_RES_QUERY=ON
```
-DWITH_PYTHON3=OFF \
-DWITH_LTTNG=OFF \
-DWITH_SYSTEM_BOOST=ON \
- -DWITH_EMBEDDED=OFF \
-DWITH_TESTS=${_with_tests:-OFF} \
|| return 1
make -j${JOBS:-2} || return 1
-DCMAKE_INSTALL_MANDIR=%{_mandir} \
-DCMAKE_INSTALL_DOCDIR=%{_docdir}/ceph \
-DCMAKE_INSTALL_INCLUDEDIR=%{_includedir} \
- -DWITH_EMBEDDED=OFF \
-DWITH_MANPAGE=ON \
-DWITH_PYTHON3=ON \
-DWITH_MGR_DASHBOARD_FRONTEND=OFF \
+++ /dev/null
-# This function is a helper that will merge static libraries.
-# For example,
-#
-# merge_static_libraries(mylib staticlibX staticlibY)
-#
-# mylib.a will generate a new static library mylib that is
-# a combination of staticlibX and staticlibY
-#
-function(merge_static_libraries target)
-
- set(dummy_source ${CMAKE_CURRENT_BINARY_DIR}/${target}_dummy.c)
- add_library(${target} STATIC ${dummy_source})
-
- # remove duplicates
- set(libs ${ARGN})
- list(REMOVE_DUPLICATES libs)
-
- # validate that all libs are static
- foreach(lib ${libs})
- if (NOT TARGET ${lib})
- message(FATAL_ERROR "${lib} not a valid target")
- endif()
-
- get_target_property(libtype ${lib} TYPE)
- if(NOT libtype STREQUAL "STATIC_LIBRARY")
- message(FATAL_ERROR "${lib} not a static library")
- endif()
-
- # add a dependency on the lib
- add_dependencies(${target} ${lib})
- endforeach()
-
- # Force the merged Make the generated dummy source file depended on all static input
- # libs. If input lib changes,the source file is touched
- # which causes the desired effect (relink).
- add_custom_command(
- OUTPUT ${dummy_source}
- COMMAND ${CMAKE_COMMAND} -E touch ${dummy_source}
- DEPENDS ${libs})
-
- # only LINUX is currently supported. OSX's libtool and windows lib.exe
- # have native support for merging static libraries, and support for them
- # can be easily added if required.
- if(LINUX)
- # generate a script to merge the static libraries in to the target
- # library. see https://sourceware.org/binutils/docs/binutils/ar-scripts.html
- set(mri_script "open $<TARGET_FILE:${target}>=")
- foreach(lib ${libs})
- # we use the generator expression TARGET_FILE to get the location
- # of the library. this will not be expanded until the script file
- # is written below
- set(mri_script "${mri_script} addlib $<TARGET_FILE:${lib}>=")
- endforeach()
- set(mri_script "${mri_script} save=end")
-
- add_custom_command(
- TARGET ${target} POST_BUILD
- COMMAND echo ${mri_script} | tr = \\\\n | ${CMAKE_AR} -M)
- endif(LINUX)
-
- message("-- MergeStaticLibraries: ${target}: merged ${libs}")
-
- # we want to set the target_link_libraries correctly for the new merged
- # static library. First we get the list of link libraries for each
- # of the libs we are merging
- set(link_libs)
- foreach(lib ${libs})
- get_property(trans TARGET ${lib} PROPERTY LINK_LIBRARIES)
- list(APPEND link_libs ${trans})
- endforeach()
-
- if (link_libs)
- # now remove the duplicates and any of the libraries we already merged
- list(REMOVE_DUPLICATES link_libs)
- foreach(lib ${libs})
- list(REMOVE_ITEM link_libs ${lib})
- endforeach()
-
- # set the target link libraries
- target_link_libraries(${target} ${link_libs})
-
- message("-- MergeStaticLibraries: ${target}: remaining ${link_libs}")
- endif()
-
-endfunction()
export DEB_HOST_ARCH ?= $(shell dpkg-architecture -qDEB_HOST_ARCH)
-extraopts += -DUSE_CRYPTOPP=OFF -DWITH_OCF=ON -DWITH_LTTNG=ON -DWITH_PYTHON3=ON -DWITH_EMBEDDED=OFF -DWITH_MGR_DASHBOARD_FRONTEND=OFF
+extraopts += -DUSE_CRYPTOPP=OFF -DWITH_OCF=ON -DWITH_LTTNG=ON -DWITH_PYTHON3=ON -DWITH_MGR_DASHBOARD_FRONTEND=OFF
extraopts += -DWITH_CEPHFS_JAVA=ON
extraopts += -DWITH_SYSTEMD=ON -DCEPH_SYSTEMD_ENV_DIR=/etc/default
# assumes that ceph is exmpt from multiarch support, so we override the libdir.
-D CEPH_MAN_DIR=man \
-D WITH_LIBCEPHFS=OFF \
-D WITH_CEPHFS=OFF \
- -D WITH_EMBEDDED=OFF \
-D WITH_MGR=YES \
-D WITH_SPDK=OFF \
2>&1 | tee cmake.log
CXX=/usr/local/opt/llvm/bin/clang++ \
cmake .. -DBOOST_J=4 \
-DENABLE_GIT_VERSION=OFF \
- -DWITH_EMBEDDED=OFF \
-DWITH_MANPAGE=OFF \
-DWITH_LIBCEPHFS=OFF \
-DWITH_XFS=OFF \
endif()
add_subdirectory(script)
-
-if(WITH_EMBEDDED)
- add_subdirectory(libcephd)
-endif()
mds->handle_signal(signum);
}
-#ifdef BUILDING_FOR_EMBEDDED
-extern "C" int cephd_mds(int argc, const char **argv)
-#else
int main(int argc, const char **argv)
-#endif
{
ceph_pthread_setname(pthread_self(), "ceph-mds");
generic_server_usage();
}
-#ifdef BUILDING_FOR_EMBEDDED
-void cephd_preload_embedded_plugins();
-extern "C" int cephd_mon(int argc, const char **argv)
-#else
int main(int argc, const char **argv)
-#endif
{
int err;
}
common_init_finish(g_ceph_context);
global_init_chdir(g_ceph_context);
-#ifndef BUILDING_FOR_EMBEDDED
if (global_init_preload_erasure_code(g_ceph_context) < 0)
prefork.exit(1);
-#else
- cephd_preload_embedded_plugins();
-#endif
}
// set up signal handlers, now that we've daemonized/forked.
generic_server_usage();
}
-#ifdef BUILDING_FOR_EMBEDDED
-void cephd_preload_embedded_plugins();
-void cephd_preload_rados_classes(OSD *osd);
-extern "C" int cephd_osd(int argc, const char **argv)
-#else
int main(int argc, const char **argv)
-#endif
{
vector<const char*> args;
argv_to_vec(argc, argv, args);
forker.exit(-ENODEV);
}
-#ifdef BUILDING_FOR_EMBEDDED
- cephd_preload_embedded_plugins();
-#endif
if (mkkey) {
common_init_finish(g_ceph_context);
return -1;
global_init_chdir(g_ceph_context);
-#ifndef BUILDING_FOR_EMBEDDED
if (global_init_preload_erasure_code(g_ceph_context) < 0) {
forker.exit(1);
}
-#endif
osd = new OSD(g_ceph_context,
store,
}
-#ifdef BUILDING_FOR_EMBEDDED
- cephd_preload_rados_classes(osd);
-#endif
-
register_async_signal_handler_oneshot(SIGINT, handle_osd_signal);
register_async_signal_handler_oneshot(SIGTERM, handle_osd_signal);
## Rados object classes
set(cls_dir ${CMAKE_INSTALL_LIBDIR}/rados-classes)
-set(cls_embedded_srcs)
# cls_sdk
add_library(cls_sdk SHARED sdk/cls_sdk.cc)
INSTALL_RPATH ""
CXX_VISIBILITY_PRESET hidden)
install(TARGETS cls_hello DESTINATION ${cls_dir})
-list(APPEND cls_embedded_srcs ${cls_hello_srcs})
# cls_numops
set(cls_numops_srcs numops/cls_numops.cc)
set(cls_numops_client_srcs numops/cls_numops_client.cc)
add_library(cls_numops_client STATIC ${cls_numops_client_srcs})
-list(APPEND cls_embedded_srcs ${cls_numops_srcs} ${cls_numops_client_srcs})
# cls_rbd
if (WITH_RBD)
add_library(cls_rbd_client STATIC ${cls_rbd_client_srcs})
target_link_libraries(cls_rbd_client cls_lock_client)
- list(APPEND cls_embedded_srcs ${cls_rbd_srcs} ${cls_rbd_client_srcs})
endif (WITH_RBD)
# cls_lock
lock/cls_lock_ops.cc)
add_library(cls_lock_client STATIC ${cls_lock_client_srcs})
-list(APPEND cls_embedded_srcs ${cls_lock_srcs} ${cls_lock_client_srcs})
# cls_otp
set(cls_otp_srcs otp/cls_otp.cc)
otp/cls_otp_types.cc
)
add_library(cls_otp_client STATIC ${cls_otp_client_srcs})
-list(APPEND cls_embedded_srcs ${cls_otp_srcs} ${cls_otp_client_srcs})
# cls_refcount
set(cls_refcount_srcs
refcount/cls_refcount_ops.cc)
add_library(cls_refcount_client STATIC ${cls_refcount_client_srcs})
-list(APPEND cls_embedded_srcs ${cls_refcount_srcs} ${cls_refcount_client_srcs})
# cls_version
set(cls_version_srcs version/cls_version.cc)
version/cls_version_types.cc)
add_library(cls_version_client STATIC ${cls_version_client_srcs})
-list(APPEND cls_embedded_srcs ${cls_version_srcs} ${cls_version_client_srcs})
# cls_log
set(cls_log_srcs log/cls_log.cc)
set(cls_log_client_srcs log/cls_log_client.cc)
add_library(cls_log_client STATIC ${cls_log_client_srcs})
-list(APPEND cls_embedded_srcs ${cls_log_srcs} ${cls_log_client_srcs})
# cls_statelog
set(cls_statelog_srcs statelog/cls_statelog.cc)
set(cls_statelog_client_srcs statelog/cls_statelog_client.cc)
add_library(cls_statelog_client STATIC ${cls_statelog_client_srcs})
-list(APPEND cls_embedded_srcs ${cls_statelog_srcs} ${cls_statelog_client_srcs})
# cls_timeindex
set(cls_timeindex_srcs timeindex/cls_timeindex.cc)
set(cls_timeindex_client_srcs timeindex/cls_timeindex_client.cc)
add_library(cls_timeindex_client STATIC ${cls_timeindex_client_srcs})
-list(APPEND cls_embedded_srcs ${cls_timeindex_srcs} ${cls_timeindex_client_srcs})
# cls_user
set(cls_user_srcs user/cls_user.cc)
user/cls_user_ops.cc)
add_library(cls_user_client STATIC ${cls_user_client_srcs})
-list(APPEND cls_embedded_srcs ${cls_user_srcs} ${cls_user_client_srcs})
# cls_journal
set(cls_journal_srcs
journal/cls_journal_types.cc)
add_library(cls_journal_client STATIC ${cls_journal_client_srcs})
-list(APPEND cls_embedded_srcs ${cls_journal_srcs} ${cls_journal_client_srcs})
# cls_rgw
if (WITH_RADOSGW)
rgw/cls_rgw_ops.cc)
add_library(cls_rgw_client STATIC ${cls_rgw_client_srcs})
- list(APPEND cls_embedded_srcs ${cls_rgw_srcs} ${cls_rgw_client_srcs})
endif (WITH_RADOSGW)
# cls_cephfs
cephfs/cls_cephfs_client.cc)
add_library(cls_cephfs_client STATIC ${cls_cephfs_client_srcs})
- list(APPEND cls_embedded_srcs ${cls_cephfs_srcs} ${cls_cephfs_client_srcs})
endif (WITH_CEPHFS)
# cls_lua
lua/cls_lua_client.cc)
add_library(cls_lua_client STATIC ${cls_lua_client_srcs})
-list(APPEND cls_embedded_srcs ${cls_lua_srcs} ${cls_lua_client_srcs})
-
-if(WITH_EMBEDDED)
- include(MergeStaticLibraries)
- list(REMOVE_DUPLICATES cls_embedded_srcs)
- add_library(cephd_cls_base STATIC ${cls_embedded_srcs})
- # while not necessary this seems to bring in the lua's include directories
- # so that cls_lua srcs build correctly
- target_link_libraries(cephd_cls_base liblua)
- set_target_properties(cephd_cls_base PROPERTIES COMPILE_DEFINITIONS BUILDING_FOR_EMBEDDED)
- merge_static_libraries(cephd_cls cephd_cls_base liblua)
-endif()
add_custom_target(compressor_plugins DEPENDS
${ceph_compressor_libs})
-
-if(WITH_EMBEDDED)
- include(MergeStaticLibraries)
- add_library(cephd_compressor_base STATIC ${compressor_srcs})
- if(HAVE_QATZIP)
- target_link_libraries(cephd_compressor_base ${QATZIP_LIBRARIES})
- endif()
- set_target_properties(cephd_compressor_base PROPERTIES COMPILE_DEFINITIONS BUILDING_FOR_EMBEDDED)
- set(cephd_compressor_libs
- cephd_compressor_base
- cephd_compressor_snappy
- cephd_compressor_zlib
- cephd_compressor_zstd)
- if(HAVE_LZ4)
- list(APPEND cephd_compressor_libs cephd_compressor_lz4)
- endif()
- if(HAVE_BROTLI)
- list(APPEND cephd_compressor_libs cephd_compressor_brotli)
- endif()
- merge_static_libraries(cephd_compressor ${cephd_compressor_libs})
-endif()
List(REVERSE bortli_libs)
target_link_libraries(ceph_brotli ${BROTLI_LIBRARIES})
install(TARGETS ceph_brotli DESTINATION ${compressor_plugin_dir})
-
-if(WITH_EMBEDDED)
- add_library(cephd_compressor_brotli STATIC ${brotli_sources})
- target_include_directories(cephd_compressor_brotli PRIVATE "${CMAKE_BINARY_DIR}/src/brotli/c/include")
- set_target_properties(cephd_compressor_brotli PROPERTIES COMPILE_DEFINITIONS BUILDING_FOR_EMBEDDED)
-endif()
#include "ceph_ver.h"
#include "CompressionPluginBrotli.h"
-#ifndef BUILDING_FOR_EMBEDDED
-
const char *__ceph_plugin_version()
{
return CEPH_GIT_NICE_VER;
return instance->add(type, name, new CompressionPluginBrotli(cct));
}
-#endif // !BUILDING_FOR_EMBEDDED
SOVERSION 2
INSTALL_RPATH "")
install(TARGETS ceph_lz4 DESTINATION ${compressor_plugin_dir})
-
-if(WITH_EMBEDDED)
- add_library(cephd_compressor_lz4 STATIC ${lz4_sources})
- set_target_properties(cephd_compressor_lz4 PROPERTIES COMPILE_DEFINITIONS BUILDING_FOR_EMBEDDED)
-endif()
#include "ceph_ver.h"
#include "CompressionPluginLZ4.h"
-#ifndef BUILDING_FOR_EMBEDDED
-
// -----------------------------------------------------------------------------
const char *__ceph_plugin_version()
return instance->add(type, name, new CompressionPluginLZ4(cct));
}
-
-#endif // !BUILDING_FOR_EMBEDDED
SOVERSION 2
INSTALL_RPATH "")
install(TARGETS ceph_snappy DESTINATION ${compressor_plugin_dir})
-
-if(WITH_EMBEDDED)
- add_library(cephd_compressor_snappy STATIC ${snappy_sources})
- set_target_properties(cephd_compressor_snappy PROPERTIES COMPILE_DEFINITIONS BUILDING_FOR_EMBEDDED)
-endif()
#include "ceph_ver.h"
#include "CompressionPluginSnappy.h"
-#ifndef BUILDING_FOR_EMBEDDED
-
// -----------------------------------------------------------------------------
const char *__ceph_plugin_version()
return instance->add(type, name, new CompressionPluginSnappy(cct));
}
-
-#endif // !BUILDING_FOR_EMBEDDED
SOVERSION 2
INSTALL_RPATH "")
install(TARGETS ceph_zlib DESTINATION ${compressor_plugin_dir})
-
-if(WITH_EMBEDDED)
- add_library(cephd_compressor_zlib STATIC ${zlib_sources})
- target_include_directories(cephd_compressor_zlib SYSTEM PRIVATE "${CMAKE_SOURCE_DIR}/src/isa-l/include")
- set_target_properties(cephd_compressor_zlib PROPERTIES COMPILE_DEFINITIONS BUILDING_FOR_EMBEDDED)
-endif()
#include "ceph_ver.h"
#include "CompressionPluginZlib.h"
-#ifndef BUILDING_FOR_EMBEDDED
// -----------------------------------------------------------------------------
const char *__ceph_plugin_version()
return instance->add(type, name, new CompressionPluginZlib(cct));
}
-
-#endif // !BUILDING_FOR_EMBEDDED
SOVERSION 2
INSTALL_RPATH "")
install(TARGETS ceph_zstd DESTINATION ${compressor_plugin_dir})
-
-if(WITH_EMBEDDED)
- add_library(cephd_compressor_zstd STATIC ${zstd_sources})
- set_target_properties(cephd_compressor_zstd PROPERTIES COMPILE_DEFINITIONS BUILDING_FOR_EMBEDDED)
-endif()
#include "ceph_ver.h"
#include "CompressionPluginZstd.h"
-#ifndef BUILDING_FOR_EMBEDDED
-
// -----------------------------------------------------------------------------
const char *__ceph_plugin_version()
return instance->add(type, name, new CompressionPluginZstd(cct));
}
-
-#endif // !BUILDING_FOR_EMBEDDED
if (HAVE_BETTER_YASM_ELF64)
add_subdirectory(isa)
set(EC_ISA_LIB ec_isa)
- set(EC_ISA_EMBEDDED_LIB cephd_ec_isa)
endif (HAVE_BETTER_YASM_ELF64)
add_library(erasure_code STATIC ErasureCodePlugin.cc)
ec_lrc
ec_jerasure
ec_shec)
-
-if(WITH_EMBEDDED)
- include(MergeStaticLibraries)
- add_library(cephd_ec_base STATIC $<TARGET_OBJECTS:erasure_code_objs>)
- set_target_properties(cephd_ec_base PROPERTIES COMPILE_DEFINITIONS BUILDING_FOR_EMBEDDED)
- merge_static_libraries(cephd_ec cephd_ec_base ${EC_ISA_EMBEDDED_LIB} cephd_ec_jerasure cephd_ec_lrc cephd_ec_shec)
-endif()
set_target_properties(ec_isa PROPERTIES
INSTALL_RPATH "")
install(TARGETS ec_isa DESTINATION ${erasure_plugin_dir})
-
-if(WITH_EMBEDDED)
- add_library(cephd_ec_isa STATIC ${isa_srcs})
- set_target_properties(cephd_ec_isa PROPERTIES COMPILE_DEFINITIONS BUILDING_FOR_EMBEDDED)
-endif()
return 0;
}
-#ifndef BUILDING_FOR_EMBEDDED
-
// -----------------------------------------------------------------------------
const char *__erasure_code_version()
return instance.add(plugin_name, new ErasureCodePluginIsa());
}
-
-#endif
install(TARGETS ${plugin_name} DESTINATION ${erasure_plugin_dir})
add_dependencies(ec_jerasure ${plugin_name})
endforeach()
-
-if(WITH_EMBEDDED)
- add_library(cephd_ec_jerasure STATIC
- $<TARGET_OBJECTS:gf-complete_objs>
- $<TARGET_OBJECTS:jerasure_objs>
- ${jerasure_utils_src})
- set_target_properties(cephd_ec_jerasure PROPERTIES COMPILE_DEFINITIONS BUILDING_FOR_EMBEDDED)
-endif()
return 0;
}
-#ifndef BUILDING_FOR_EMBEDDED
-
const char *__erasure_code_version() { return CEPH_GIT_NICE_VER; }
int __erasure_code_init(char *plugin_name, char *directory)
}
return instance.add(plugin_name, new ErasureCodePluginJerasure());
}
-
-#endif
\ No newline at end of file
INSTALL_RPATH "")
target_link_libraries(ec_lrc json_spirit)
install(TARGETS ec_lrc DESTINATION ${erasure_plugin_dir})
-
-if(WITH_EMBEDDED)
- add_library(cephd_ec_lrc STATIC ${lrc_srcs})
- set_target_properties(cephd_ec_lrc PROPERTIES COMPILE_DEFINITIONS BUILDING_FOR_EMBEDDED)
-endif()
return 0;
};
-#ifndef BUILDING_FOR_EMBEDDED
-
const char *__erasure_code_version() { return CEPH_GIT_NICE_VER; }
int __erasure_code_init(char *plugin_name, char *directory)
ErasureCodePluginRegistry &instance = ErasureCodePluginRegistry::instance();
return instance.add(plugin_name, new ErasureCodePluginLrc());
}
-
-#endif
install(TARGETS ${plugin_name} DESTINATION ${erasure_plugin_dir})
add_dependencies(ec_shec ${plugin_name})
endforeach()
-
-if(WITH_EMBEDDED)
- # note we rely on the fact this will always be statically linked with jerasure
- add_library(cephd_ec_shec STATIC ${shec_utils_srcs})
- set_target_properties(cephd_ec_shec PROPERTIES COMPILE_DEFINITIONS BUILDING_FOR_EMBEDDED)
-endif()
return 0;
}
-#ifndef BUILDING_FOR_EMBEDDED
-
const char *__erasure_code_version() { return CEPH_GIT_NICE_VER; }
int __erasure_code_init(char *plugin_name, char *directory = (char *)"")
}
return instance.add(plugin_name, new ErasureCodePluginShec());
}
-
-#endif
\ No newline at end of file
+++ /dev/null
-#pragma once
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-#define LIBCEPHD_VER_MAJOR 0
-#define LIBCEPHD_VER_MINOR 1
-#define LIBCEPHD_VER_PATCH 0
-
-#define LIBCEPHFD_VERSION(maj, min, extra) ((maj << 16) + (min << 8) + extra)
-#define LIBCEPHFD_VERSION_CODE LIBCEPHD_VERSION(LIBCEPHD_VER_MAJOR, LIBCEPHD_VER_MINOR, LIBCEPHD_VER_PATCH)
-
-#define CEPH_LIBCEPHD_API __attribute__ ((visibility ("default")))
-
-/**
- * Get the API version of libcephd. We use semantic versioning
- * for the API:
- *
- * - incrementing major is for backwards-incompatible changes
- * - incrementing minor is for backwards-compatible changes
- * - incrementing extra is for bug fixes
- *
- * @param pmajor where to store the major version number
- * @param pminor where to store the minor version number
- * @param ppatch where to store the patch version number
- */
-CEPH_LIBCEPHD_API void cephd_version(int *pmajor, int *pminor, int *ppatch);
-
-/**
- * Gets the runtime version of ceph.
- *
- * @param pmajor where to store the major version number
- * @param pminor where to store the minor version number
- * @param ppatch where to store the patch version number
- */
-CEPH_LIBCEPHD_API const char *ceph_version(int *pmajor, int *pminor, int *ppatch);
-
-/**
- * Generates a new cluster id (fsid) and returns a hexadecimal string.
- *
- * @param context where to the store the handle
- * @param buf where to write the fsid
- * @param len the size of buf in bytes (should be at least 37)
- * @returns 0 on success, negative error code on failure
- * @returns -ERANGE if the buffer is too short to contain the key
- */
-CEPH_LIBCEPHD_API int cephd_generate_fsid(char *buf, size_t len);
-
-/**
- * Generates a new secret key and returns a base64 encoded string.
- *
- * @param context where to the store the handle
- * @param buf where to write the fsid
- * @param len the size of buf in bytes
- * @returns 0 on success, negative error code on failure
- * @returns -ERANGE if the buffer is too short to contain the key
- */
-CEPH_LIBCEPHD_API int cephd_generate_secret_key(char *buf, size_t len);
-
-/**
- * Runs ceph-mon passing in command line args
- *
- * @param argc number of parameters
- * @param argv array of string arguments
- * @returns 0 on success, negative error code on failure
- */
-CEPH_LIBCEPHD_API int cephd_run_mon(int argc, const char **argv);
-
-/**
- * Runs ceph-osd passing in command line args
- *
- * @param argc number of parameters
- * @param argv array of string arguments
- * @returns 0 on success, negative error code on failure
- */
-CEPH_LIBCEPHD_API int cephd_run_osd(int argc, const char **argv);
-
-/**
- * Runs ceph-mds passing in command line args
- *
- * @param argc number of parameters
- * @param argv array of string arguments
- * @returns 0 on success, negative error code on failure
- */
-CEPH_LIBCEPHD_API int cephd_run_mds(int argc, const char **argv);
-
-/**
- * Runs ceph-rgw passing in command line args
- *
- * @param argc number of parameters
- * @param argv array of string arguments
- * @returns 0 on success, negative error code on failure
- */
-CEPH_LIBCEPHD_API int cephd_run_rgw(int argc, const char **argv);
-
-/**
- * Runs radosgw-admin passing in command line args
- *
- * @param argc number of parameters
- * @param argv array of string arguments
- * @returns 0 on success, negative error code on failure
- */
-CEPH_LIBCEPHD_API int cephd_run_rgw_admin(int argc, const char **argv);
-
-#ifdef __cplusplus
-}
-#endif
/* define if bluestore enabled */
#cmakedefine WITH_BLUESTORE
-/* define if embedded enabled */
-#cmakedefine WITH_EMBEDDED
-
/* define if cephfs enabled */
#cmakedefine WITH_CEPHFS
#define CEPH_CLS_API [[gnu::visibility("default")]]
-#ifndef BUILDING_FOR_EMBEDDED
#define CLS_VER(maj,min) \
int __cls_ver__## maj ## _ ##min = 0; \
int __cls_ver_maj = maj; \
#define CLS_INIT(name) \
CEPH_CLS_API void __cls_init()
-#else
-#define CLS_VER(maj,min)
-#define CLS_NAME(name)
-#define CLS_INIT(name) \
-CEPH_CLS_API void name##_cls_init()
-#endif
#define CLS_METHOD_RD 0x1 /// method executes read operations
#define CLS_METHOD_WR 0x2 /// method executes write operations
SOVERSION "1"
INSTALL_RPATH "")
install(TARGETS cls_kvs DESTINATION ${CMAKE_INSTALL_LIBDIR}/rados-classes)
-
-if(WITH_EMBEDDED)
- add_library(cephd_cls_kvs STATIC ${kvs_srcs})
- set_target_properties(cephd_cls_kvs PROPERTIES COMPILE_DEFINITIONS BUILDING_FOR_EMBEDDED)
-endif()
+++ /dev/null
-include(MergeStaticLibraries)
-
-add_library(cephd_base STATIC
- libcephd.cc
- ../ceph_mon.cc
- ../ceph_osd.cc
- ../ceph_mds.cc)
-
-set_target_properties(cephd_base PROPERTIES COMPILE_DEFINITIONS BUILDING_FOR_EMBEDDED)
-
-set(merge_libs
- cephd_base
- cephd_compressor
- cephd_ec
- cephd_cls
- cephd_cls_kvs
- cephd_rados
- common
- common_utf8
- erasure_code
- global
- json_spirit
- kv
- mds
- mon
- os
- osd
- osdc)
-
-if(NOT WITH_SYSTEM_ROCKSDB)
- list(APPEND merge_libs ${ROCKSDB_LIBRARIES})
-endif(NOT WITH_SYSTEM_ROCKSDB)
-
-if(WITH_RADOSGW)
- list(APPEND merge_libs cephd_rgw)
-endif(WITH_RADOSGW)
-
-if(WITH_RBD)
- list(APPEND merge_libs cephd_rbd)
-endif(WITH_RBD)
-
-if(HAVE_ARMV8_CRC)
- list(APPEND merge_libs common_crc_aarch64)
-endif(HAVE_ARMV8_CRC)
-
-merge_static_libraries(cephd ${merge_libs})
-
-# TODO: install these libraries and add them to rpm and deb packages
-#install(TARGETS cephd DESTINATION ${CMAKE_INSTALL_LIBDIR})
-#install(FILES ../include/cephd/libcephd.h
-# DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}/cephd)
+++ /dev/null
-#include "acconfig.h"
-#include "auth/Auth.h"
-#include "auth/Crypto.h"
-#include "auth/KeyRing.h"
-#include "common/ceph_argparse.h"
-#include "common/version.h"
-#include "common/PluginRegistry.h"
-#include "compressor/snappy/CompressionPluginSnappy.h"
-#include "compressor/zlib/CompressionPluginZlib.h"
-#include "compressor/zstd/CompressionPluginZstd.h"
-#include "erasure-code/ErasureCodePlugin.h"
-#if __x86_64__ && defined(HAVE_BETTER_YASM_ELF64)
-#include "erasure-code/isa/ErasureCodePluginIsa.h"
-#endif
-#include "erasure-code/jerasure/ErasureCodePluginJerasure.h"
-#include "erasure-code/jerasure/jerasure_init.h"
-#include "erasure-code/lrc/ErasureCodePluginLrc.h"
-#include "erasure-code/shec/ErasureCodePluginShec.h"
-#include "include/cephd/libcephd.h"
-#include "global/global_context.h"
-#include "global/global_init.h"
-#include "objclass/objclass.h"
-#include "osd/OSD.h"
-#include "osd/ClassHandler.h"
-
-// forward declarations of RADOS class init functions
-CLS_INIT(cephfs);
-CLS_INIT(hello);
-CLS_INIT(journal);
-CLS_INIT(kvs);
-CLS_INIT(lock);
-CLS_INIT(log);
-CLS_INIT(lua);
-CLS_INIT(numops);
-CLS_INIT(rbd);
-CLS_INIT(refcount);
-CLS_INIT(rgw);
-CLS_INIT(statelog);
-CLS_INIT(timeindex);
-CLS_INIT(user);
-CLS_INIT(version);
-
-extern "C" void cephd_version(int *pmajor, int *pminor, int *ppatch)
-{
- if (pmajor)
- *pmajor = LIBCEPHD_VER_MAJOR;
- if (pminor)
- *pminor = LIBCEPHD_VER_MINOR;
- if (ppatch)
- *ppatch = LIBCEPHD_VER_PATCH;
-}
-
-extern "C" const char *ceph_version(int *pmajor, int *pminor, int *ppatch)
-{
- int major, minor, patch;
- const char *v = ceph_version_to_str();
-
- int n = sscanf(v, "%d.%d.%d", &major, &minor, &patch);
- if (pmajor)
- *pmajor = (n >= 1) ? major : 0;
- if (pminor)
- *pminor = (n >= 2) ? minor : 0;
- if (ppatch)
- *ppatch = (n >= 3) ? patch : 0;
- return v;
-}
-
-extern "C" int cephd_generate_fsid(char *buf, size_t len)
-{
- if (len < sizeof("b06ad912-70d7-4263-a5ff-011462a5929a")) {
- return -ERANGE;
- }
-
- uuid_d fsid;
- fsid.generate_random();
- fsid.print(buf);
-
- return 0;
-}
-
-extern "C" int cephd_generate_secret_key(char *buf, size_t len)
-{
- CephInitParameters iparams(CEPH_ENTITY_TYPE_MON);
- CephContext *cct = common_preinit(iparams, CODE_ENVIRONMENT_LIBRARY, 0);
- cct->_conf->apply_changes(NULL);
- cct->init_crypto();
-
- CryptoKey key;
- key.create(cct, CEPH_CRYPTO_AES);
-
- cct->put();
-
- string keystr;
- key.encode_base64(keystr);
- if (keystr.length() >= len) {
- return -ERANGE;
- }
- strcpy(buf, keystr.c_str());
- return keystr.length();
-}
-
-// load the embedded plugins. This is safe to call multiple
-// times in the same process
-void cephd_preload_embedded_plugins()
-{
- int r;
-
- // load erasure coding plugins
- {
- ErasureCodePlugin* plugin;
- ErasureCodePluginRegistry& reg = ErasureCodePluginRegistry::instance();
- Mutex::Locker l(reg.lock);
- reg.disable_dlclose = true;
-
- // initialize jerasure (and gf-complete)
- int w[] = { 4, 8, 16, 32 };
- r = jerasure_init(4, w);
- assert(r == 0);
-
- plugin = new ErasureCodePluginJerasure();
- r = reg.add("jerasure", plugin);
- if (r == -EEXIST) {
- delete plugin;
- }
- assert(r == 0);
-
- plugin = new ErasureCodePluginLrc();
- r = reg.add("lrc", plugin);
- if (r == -EEXIST) {
- delete plugin;
- }
- assert(r == 0);
-
- plugin = new ErasureCodePluginShec();
- r = reg.add("shec", plugin);
- if (r == -EEXIST) {
- delete plugin;
- }
- assert(r == 0);
-
-#if __x86_64__ && defined(HAVE_BETTER_YASM_ELF64)
- plugin = new ErasureCodePluginIsa();
- r = reg.add("isa", plugin);
- if (r == -EEXIST) {
- delete plugin;
- }
- assert(r == 0);
-#endif
- }
-
- // now load the compression plugins
- {
- Plugin *plugin;
- PluginRegistry *reg = g_ceph_context->get_plugin_registry();
- Mutex::Locker l(reg->lock);
- reg->disable_dlclose = true;
-
- plugin = new CompressionPluginSnappy(g_ceph_context);
- r = reg->add("compressor", "snappy", plugin);
- if (r == -EEXIST) {
- delete plugin;
- }
- assert(r == 0);
-
- plugin = new CompressionPluginZlib(g_ceph_context);
- r = reg->add("compressor", "zlib", plugin);
- if (r == -EEXIST) {
- delete plugin;
- }
- assert(r == 0);
-
- plugin = new CompressionPluginZstd(g_ceph_context);
- r = reg->add("compressor", "zstd", plugin);
- if (r == -EEXIST) {
- delete plugin;
- }
- assert(r == 0);
- }
-}
-
-void cephd_preload_rados_classes(OSD *osd)
-{
- // intialize RADOS classes
- {
- ClassHandler *class_handler = osd->class_handler;
- Mutex::Locker l(class_handler->mutex);
-
-#ifdef WITH_CEPHFS
- class_handler->add_embedded_class("cephfs");
- cephfs_cls_init();
-#endif
- class_handler->add_embedded_class("hello");
- hello_cls_init();
- class_handler->add_embedded_class("journal");
- journal_cls_init();
-#ifdef WITH_KVS
- class_handler->add_embedded_class("kvs");
- kvs_cls_init();
-#endif
- class_handler->add_embedded_class("lock");
- lock_cls_init();
- class_handler->add_embedded_class("log");
- log_cls_init();
- class_handler->add_embedded_class("lua");
- lua_cls_init();
- class_handler->add_embedded_class("numops");
- numops_cls_init();
-#ifdef WITH_RBD
- class_handler->add_embedded_class("rbd");
- rbd_cls_init();
-#endif
- class_handler->add_embedded_class("refcount");
- refcount_cls_init();
-#ifdef WITH_RADOSGW
- class_handler->add_embedded_class("rgw");
- rgw_cls_init();
-#endif
- class_handler->add_embedded_class("statelog");
- statelog_cls_init();
- class_handler->add_embedded_class("timeindex");
- timeindex_cls_init();
- class_handler->add_embedded_class("user");
- user_cls_init();
- class_handler->add_embedded_class("version");
- version_cls_init();
- }
-}
-
-extern "C" int cephd_mon(int argc, const char **argv);
-extern "C" int cephd_osd(int argc, const char **argv);
-extern "C" int cephd_mds(int argc, const char **argv);
-extern "C" int cephd_rgw(int argc, const char **argv);
-extern "C" int cephd_rgw_admin(int argc, const char **argv);
-
-int cephd_run_mon(int argc, const char **argv)
-{
- return cephd_mon(argc, argv);
-}
-
-int cephd_run_osd(int argc, const char **argv)
-{
- return cephd_osd(argc, argv);
-}
-
-int cephd_run_mds(int argc, const char **argv)
-{
- return cephd_mds(argc, argv);
-}
-
-
-int cephd_run_rgw(int argc, const char **argv)
-{
- return cephd_rgw(argc, argv);
-}
-
-int cephd_run_rgw_admin(int argc, const char **argv)
-{
- return cephd_rgw_admin(argc, argv);
-}
target_link_libraries(librados ${rados_libs})
install(TARGETS librados DESTINATION ${CMAKE_INSTALL_LIBDIR})
-if(WITH_EMBEDDED)
- add_library(cephd_rados STATIC
- $<TARGET_OBJECTS:librados_api_obj>
- $<TARGET_OBJECTS:librados_objs>)
-endif()
if(WITH_LTTNG AND WITH_EVENTTRACE)
add_dependencies(librados_api_obj eventtrace_tp)
endif()
endif()
endif(ENABLE_SHARED)
install(TARGETS librbd DESTINATION ${CMAKE_INSTALL_LIBDIR})
-
-if(WITH_EMBEDDED)
- add_library(cephd_rbd_base STATIC librbd.cc ${CMAKE_SOURCE_DIR}/src/common/ContextCompletion.cc)
- merge_static_libraries(cephd_rbd cephd_rbd_base rbd_internal rbd_types journal)
-endif()
set_target_properties(rgw PROPERTIES OUTPUT_NAME rgw VERSION 2.0.0
SOVERSION 2)
install(TARGETS rgw DESTINATION ${CMAKE_INSTALL_LIBDIR})
-
-if(WITH_EMBEDDED)
- include(MergeStaticLibraries)
- add_library(cephd_rgw_base STATIC rgw_main.cc ${radosgw_admin_srcs})
- if(WITH_RADOSGW_FCGI_FRONTEND)
- target_include_directories(cephd_rgw_base SYSTEM PUBLIC ${FCGI_INCLUDE_DIR})
- endif()
- set_target_properties(cephd_rgw_base PROPERTIES COMPILE_DEFINITIONS BUILDING_FOR_EMBEDDED)
- merge_static_libraries(cephd_rgw cephd_rgw_base rgw_a radosgw_a)
- if(WITH_RADOSGW_FCGI_FRONTEND)
- target_link_libraries(cephd_rgw ${FCGI_LIBRARY})
- endif()
-endif()
return -ENOENT;
}
-#ifdef BUILDING_FOR_EMBEDDED
-extern "C" int cephd_rgw_admin(int argc, const char **argv)
-#else
int main(int argc, const char **argv)
-#endif
{
vector<const char*> args;
argv_to_vec(argc, (const char **)argv, args);
/*
* start up the RADOS connection and then handle HTTP messages as they come in
*/
-#ifdef BUILDING_FOR_EMBEDDED
-extern "C" int cephd_rgw(int argc, const char **argv)
-#else
int main(int argc, const char **argv)
-#endif
{
// dout() messages will be sent to stderr, but FCGX wants messages on stdout
// Redirect stderr to stdout.
add_subdirectory(filestore)
add_subdirectory(fs)
add_subdirectory(journal)
-if(WITH_EMBEDDED)
- add_subdirectory(libcephd)
-endif(WITH_EMBEDDED)
add_subdirectory(libcephfs)
add_subdirectory(librados)
add_subdirectory(librados_test_stub)
+++ /dev/null
-# cephdtest
-set(cephdtest_srcs
- test.cc)
-add_library(cephdtest STATIC ${cephdtest_srcs})
-set_target_properties(cephdtest PROPERTIES COMPILE_FLAGS ${UNITTEST_CXX_FLAGS})
-
-#Enable spdk
-if(HAVE_SPDK)
-link_directories("${CMAKE_SOURCE_DIR}/src/spdk/build/lib/")
-endif(HAVE_SPDK)
-
-# ceph_test_cephd_api_misc
-add_executable(ceph_test_cephd_api_misc
- misc.cc
- )
-set_target_properties(ceph_test_cephd_api_misc PROPERTIES COMPILE_FLAGS
- ${UNITTEST_CXX_FLAGS})
-target_link_libraries(ceph_test_cephd_api_misc
- cephd global ${UNITTEST_LIBS} cephdtest z snappy ceph_zstd)
-
-install(TARGETS
- ceph_test_cephd_api_misc
- DESTINATION ${CMAKE_INSTALL_BINDIR})
+++ /dev/null
-#include "gtest/gtest.h"
-#include "include/cephd/libcephd.h"
-
-TEST(LibCephdMiscVersion, Version) {
- int major, minor, extra;
- cephd_version(&major, &minor, &extra);
-}
+++ /dev/null
-void doNothing() {
-}