if(WITH_RBD)
set(DENCODER_EXTRALIBS
${DENCODER_EXTRALIBS}
+ rbd_types
+ cls_rbd_client
rbd_replay_types)
if(LINUX)
list(APPEND dencoder_srcs
#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)
## Rados object classes
set(cls_dir ${CMAKE_INSTALL_LIBDIR}/rados-classes)
+set(cls_embedded_srcs)
# cls_hello
-add_library(cls_hello SHARED hello/cls_hello.cc)
+set(cls_hello_srcs hello/cls_hello.cc)
+add_library(cls_hello SHARED ${cls_hello_srcs})
set_target_properties(cls_hello PROPERTIES VERSION "1.0.0" SOVERSION "1")
install(TARGETS cls_hello DESTINATION ${cls_dir})
+list(APPEND cls_embedded_srcs ${cls_hello_srcs})
# cls_numops
-add_library(cls_numops SHARED numops/cls_numops.cc)
+set(cls_numops_srcs numops/cls_numops.cc)
+add_library(cls_numops SHARED ${cls_numops_srcs})
set_target_properties(cls_numops PROPERTIES VERSION "1.0.0" SOVERSION "1")
install(TARGETS cls_numops DESTINATION ${cls_dir})
+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 SHARED rbd/cls_rbd.cc rbd/cls_rbd_types.cc)
+ set(cls_rbd_srcs rbd/cls_rbd.cc rbd/cls_rbd_types.cc)
+ add_library(cls_rbd SHARED ${cls_rbd_srcs})
set_target_properties(cls_rbd PROPERTIES VERSION "1.0.0" SOVERSION "1")
install(TARGETS cls_rbd DESTINATION ${cls_dir})
- add_library(cls_rbd_client STATIC rbd/cls_rbd_client.cc rbd/cls_rbd_types.cc)
+ set(cls_rbd_client_srcs rbd/cls_rbd_client.cc rbd/cls_rbd_types.cc)
+ 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
-add_library(cls_lock SHARED lock/cls_lock.cc)
+set(cls_lock_srcs lock/cls_lock.cc)
+add_library(cls_lock SHARED ${cls_lock_srcs})
set_target_properties(cls_lock PROPERTIES VERSION "1.0.0" SOVERSION "1")
install(TARGETS cls_lock DESTINATION ${cls_dir})
-add_library(cls_lock_client STATIC
+set(cls_lock_client_srcs
lock/cls_lock_client.cc
lock/cls_lock_types.cc
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_refcount
-add_library(cls_refcount SHARED
+set(cls_refcount_srcs
refcount/cls_refcount.cc
refcount/cls_refcount_ops.cc
${CMAKE_SOURCE_DIR}/src/common/ceph_json.cc)
+add_library(cls_refcount SHARED ${cls_refcount_srcs})
target_link_libraries(cls_refcount json_spirit)
set_target_properties(cls_refcount PROPERTIES VERSION "1.0.0" SOVERSION "1")
install(TARGETS cls_refcount DESTINATION ${cls_dir})
-add_library(cls_refcount_client STATIC
+set(cls_refcount_client_srcs
refcount/cls_refcount_client.cc
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
-add_library(cls_version SHARED version/cls_version.cc)
+set(cls_version_srcs version/cls_version.cc)
+add_library(cls_version SHARED ${cls_version_srcs})
set_target_properties(cls_version PROPERTIES VERSION "1.0.0" SOVERSION "1")
install(TARGETS cls_version DESTINATION ${cls_dir})
-add_library(cls_version_client STATIC
+set(cls_version_client_srcs
version/cls_version_client.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
-add_library(cls_log SHARED log/cls_log.cc)
+set(cls_log_srcs log/cls_log.cc)
+add_library(cls_log SHARED ${cls_log_srcs})
set_target_properties(cls_log PROPERTIES VERSION "1.0.0" SOVERSION "1")
install(TARGETS cls_log DESTINATION ${cls_dir})
-add_library(cls_log_client STATIC log/cls_log_client.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
-add_library(cls_statelog SHARED statelog/cls_statelog.cc)
+set(cls_statelog_srcs statelog/cls_statelog.cc)
+add_library(cls_statelog SHARED ${cls_statelog_srcs})
set_target_properties(cls_statelog PROPERTIES VERSION "1.0.0" SOVERSION "1")
install(TARGETS cls_statelog DESTINATION ${cls_dir})
-add_library(cls_statelog_client STATIC statelog/cls_statelog_client.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
-add_library(cls_timeindex SHARED timeindex/cls_timeindex.cc)
+set(cls_timeindex_srcs timeindex/cls_timeindex.cc)
+add_library(cls_timeindex SHARED ${cls_timeindex_srcs})
set_target_properties(cls_timeindex PROPERTIES VERSION "1.0.0" SOVERSION "1")
install(TARGETS cls_timeindex DESTINATION ${cls_dir})
-add_library(cls_timeindex_client STATIC timeindex/cls_timeindex_client.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_replica_log
-add_library(cls_replica_log SHARED replica_log/cls_replica_log.cc)
+set(cls_replica_log_srcs replica_log/cls_replica_log.cc)
+add_library(cls_replica_log SHARED ${cls_replica_log_srcs})
set_target_properties(cls_replica_log PROPERTIES VERSION "1.0.0" SOVERSION "1")
install(TARGETS cls_replica_log DESTINATION ${cls_dir})
-add_library(cls_replica_log_client STATIC
+set(cls_replica_log_client_srcs
replica_log/cls_replica_log_types.cc
replica_log/cls_replica_log_ops.cc
replica_log/cls_replica_log_client.cc)
+add_library(cls_replica_log_client STATIC ${cls_replica_log_client_srcs})
+
+list(APPEND cls_embedded_srcs ${cls_replica_log_srcs} ${cls_replica_log_client_srcs})
# cls_user
-add_library(cls_user SHARED user/cls_user.cc)
+set(cls_user_srcs user/cls_user.cc)
+add_library(cls_user SHARED ${cls_user_srcs})
set_target_properties(cls_user PROPERTIES VERSION "1.0.0" SOVERSION "1")
install(TARGETS cls_user DESTINATION ${cls_dir})
-add_library(cls_user_client STATIC
+set(cls_user_client_srcs
user/cls_user_client.cc
user/cls_user_types.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
-add_library(cls_journal SHARED
+set(cls_journal_srcs
journal/cls_journal.cc
journal/cls_journal_types.cc)
+add_library(cls_journal SHARED ${cls_journal_srcs})
set_target_properties(cls_journal PROPERTIES VERSION "1.0.0" SOVERSION "1")
install(TARGETS cls_journal DESTINATION ${cls_dir})
-add_library(cls_journal_client STATIC
+set(cls_journal_client_srcs
journal/cls_journal_client.cc
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)
- add_library(cls_rgw SHARED
+ set(cls_rgw_srcs
rgw/cls_rgw.cc
rgw/cls_rgw_ops.cc
rgw/cls_rgw_types.cc
${CMAKE_SOURCE_DIR}/src/common/ceph_json.cc)
+ add_library(cls_rgw SHARED ${cls_rgw_srcs})
target_link_libraries(cls_rgw json_spirit)
set_target_properties(cls_rgw PROPERTIES VERSION "1.0.0" SOVERSION "1")
install(TARGETS cls_rgw DESTINATION ${cls_dir})
- add_library(cls_rgw_client STATIC
+ set(cls_rgw_client_srcs
rgw/cls_rgw_client.cc
rgw/cls_rgw_types.cc
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
if (WITH_CEPHFS)
- add_library(cls_cephfs SHARED
+ set(cls_cephfs_srcs
cephfs/cls_cephfs.cc)
+ add_library(cls_cephfs SHARED ${cls_cephfs_srcs})
set_target_properties(cls_cephfs PROPERTIES VERSION "1.0.0" SOVERSION "1")
install(TARGETS cls_cephfs DESTINATION ${cls_dir})
- add_library(cls_cephfs_client STATIC
+ set(cls_cephfs_client_srcs
cephfs/cls_cephfs_client.cc)
-endif (WITH_CEPHFS)
+ add_library(cls_cephfs_client STATIC ${cls_cephfs_client_srcs})
-add_library(cls_numops_client STATIC numops/cls_numops_client.cc)
+ list(APPEND cls_embedded_srcs ${cls_cephfs_srcs} ${cls_cephfs_client_srcs})
+endif (WITH_CEPHFS)
-add_library(cls_lua SHARED
+# cls_lua
+set(cls_lua_srcs
lua/cls_lua.cc
- lua/lua_bufferlist.cc
-)
+ lua/lua_bufferlist.cc)
+add_library(cls_lua SHARED ${cls_lua_srcs})
set_target_properties(cls_lua PROPERTIES VERSION "1.0.0" SOVERSION "1")
install(TARGETS cls_lua DESTINATION ${cls_dir})
target_link_libraries(cls_lua
liblua
- json_spirit
-)
-
-add_library(cls_lua_client STATIC
- lua/cls_lua_client.cc
-)
+ json_spirit)
+
+set(cls_lua_client_srcs
+ 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()
#include "cls_cephfs.h"
CLS_VER(1,0)
-CLS_NAME(cephfs_size_scan)
-
-cls_handle_t h_class;
-cls_method_handle_t h_accumulate_inode_metadata;
-
+CLS_NAME(cephfs)
std::ostream &operator<<(std::ostream &out, const ObjCeiling &in)
* We do two things here: we register the new class, and then register
* all of the class's methods.
*/
-void __cls_init()
+CLS_INIT(cephfs)
{
// this log message, at level 0, will always appear in the ceph-osd
// log file.
- CLS_LOG(0, "loading cephfs_size_scan");
+ CLS_LOG(0, "loading cephfs");
+
+ cls_handle_t h_class;
+ cls_method_handle_t h_accumulate_inode_metadata;
cls_register("cephfs", &h_class);
cls_register_cxx_method(h_class, "accumulate_inode_metadata",
CLS_VER(1,0)
CLS_NAME(hello)
-cls_handle_t h_class;
-cls_method_handle_t h_say_hello;
-cls_method_handle_t h_record_hello;
-cls_method_handle_t h_replay;
-cls_method_handle_t h_writes_dont_return_data;
-cls_method_handle_t h_turn_it_to_11;
-cls_method_handle_t h_bad_reader;
-cls_method_handle_t h_bad_writer;
-
/**
* say hello - a "read" method that does not depend on the object
*
* We do two things here: we register the new class, and then register
* all of the class's methods.
*/
-void __cls_init()
+CLS_INIT(hello)
{
// this log message, at level 0, will always appear in the ceph-osd
// log file.
CLS_LOG(0, "loading cls_hello");
+ cls_handle_t h_class;
+ cls_method_handle_t h_say_hello;
+ cls_method_handle_t h_record_hello;
+ cls_method_handle_t h_replay;
+ cls_method_handle_t h_writes_dont_return_data;
+ cls_method_handle_t h_turn_it_to_11;
+ cls_method_handle_t h_bad_reader;
+ cls_method_handle_t h_bad_writer;
+
cls_register("hello", &h_class);
// There are two flags we specify for methods:
CLS_VER(1, 0)
CLS_NAME(journal)
-cls_handle_t h_class;
-cls_method_handle_t h_journal_create;
-cls_method_handle_t h_journal_get_order;
-cls_method_handle_t h_journal_get_splay_width;
-cls_method_handle_t h_journal_get_pool_id;
-cls_method_handle_t h_journal_get_minimum_set;
-cls_method_handle_t h_journal_set_minimum_set;
-cls_method_handle_t h_journal_get_active_set;
-cls_method_handle_t h_journal_set_active_set;
-cls_method_handle_t h_journal_get_client;
-cls_method_handle_t h_journal_client_register;
-cls_method_handle_t h_journal_client_update_data;
-cls_method_handle_t h_journal_client_update_state;
-cls_method_handle_t h_journal_client_unregister;
-cls_method_handle_t h_journal_client_commit;
-cls_method_handle_t h_journal_client_list;
-cls_method_handle_t h_journal_get_next_tag_tid;
-cls_method_handle_t h_journal_get_tag;
-cls_method_handle_t h_journal_tag_create;
-cls_method_handle_t h_journal_tag_list;
-cls_method_handle_t h_journal_object_guard_append;
-
namespace {
static const uint64_t MAX_KEYS_READ = 64;
return 0;
}
-#if __GNUC__ >= 4
- #define CEPH_CLS_API __attribute__ ((visibility ("default")))
-#else
- #define CEPH_CLS_API
-#endif
-
-void CEPH_CLS_API __cls_init()
+CLS_INIT(journal)
{
CLS_LOG(20, "Loaded journal class!");
+ cls_handle_t h_class;
+ cls_method_handle_t h_journal_create;
+ cls_method_handle_t h_journal_get_order;
+ cls_method_handle_t h_journal_get_splay_width;
+ cls_method_handle_t h_journal_get_pool_id;
+ cls_method_handle_t h_journal_get_minimum_set;
+ cls_method_handle_t h_journal_set_minimum_set;
+ cls_method_handle_t h_journal_get_active_set;
+ cls_method_handle_t h_journal_set_active_set;
+ cls_method_handle_t h_journal_get_client;
+ cls_method_handle_t h_journal_client_register;
+ cls_method_handle_t h_journal_client_update_data;
+ cls_method_handle_t h_journal_client_update_state;
+ cls_method_handle_t h_journal_client_unregister;
+ cls_method_handle_t h_journal_client_commit;
+ cls_method_handle_t h_journal_client_list;
+ cls_method_handle_t h_journal_get_next_tag_tid;
+ cls_method_handle_t h_journal_get_tag;
+ cls_method_handle_t h_journal_tag_create;
+ cls_method_handle_t h_journal_tag_list;
+ cls_method_handle_t h_journal_object_guard_append;
+
cls_register("journal", &h_class);
/// methods for journal.$journal_id objects
CLS_VER(1,0)
CLS_NAME(lock)
-cls_handle_t h_class;
-cls_method_handle_t h_lock_op;
-cls_method_handle_t h_unlock_op;
-cls_method_handle_t h_break_lock;
-cls_method_handle_t h_get_info;
-cls_method_handle_t h_list_locks;
-cls_method_handle_t h_assert_locked;
-cls_method_handle_t h_set_cookie;
-
#define LOCK_PREFIX "lock."
typedef struct lock_info_s {
return 0;
}
-void __cls_init()
+CLS_INIT(lock)
{
CLS_LOG(20, "Loaded lock class!");
+ cls_handle_t h_class;
+ cls_method_handle_t h_lock_op;
+ cls_method_handle_t h_unlock_op;
+ cls_method_handle_t h_break_lock;
+ cls_method_handle_t h_get_info;
+ cls_method_handle_t h_list_locks;
+ cls_method_handle_t h_assert_locked;
+ cls_method_handle_t h_set_cookie;
+
cls_register("lock", &h_class);
cls_register_cxx_method(h_class, "lock",
CLS_METHOD_RD | CLS_METHOD_WR | CLS_METHOD_PROMOTE,
CLS_VER(1,0)
CLS_NAME(log)
-cls_handle_t h_class;
-cls_method_handle_t h_log_add;
-cls_method_handle_t h_log_list;
-cls_method_handle_t h_log_trim;
-cls_method_handle_t h_log_info;
-
static string log_index_prefix = "1_";
return 0;
}
-void __cls_init()
+CLS_INIT(log)
{
CLS_LOG(1, "Loaded log class!");
+ cls_handle_t h_class;
+ cls_method_handle_t h_log_add;
+ cls_method_handle_t h_log_list;
+ cls_method_handle_t h_log_trim;
+ cls_method_handle_t h_log_info;
+
cls_register("log", &h_class);
/* log */
CLS_VER(1,0)
CLS_NAME(lua)
-cls_handle_t h_class;
-cls_method_handle_t h_eval_json;
-cls_method_handle_t h_eval_bufferlist;
-
/*
* Jump point for recovering from Lua panic.
*/
return eval_generic(hctx, in, out, BUFFERLIST_ENC);
}
-void __cls_init()
+CLS_INIT(lua)
{
CLS_LOG(20, "Loaded lua class!");
+ cls_handle_t h_class;
+ cls_method_handle_t h_eval_json;
+ cls_method_handle_t h_eval_bufferlist;
+
cls_register("lua", &h_class);
cls_register_cxx_method(h_class, "eval_json",
CLS_VER(1,0)
CLS_NAME(numops)
-cls_handle_t h_class;
-cls_method_handle_t h_add;
-cls_method_handle_t h_mul;
-
static int add(cls_method_context_t hctx, bufferlist *in, bufferlist *out)
{
string key, diff_str;
return cls_cxx_map_set_val(hctx, key, &new_value);
}
-void __cls_init()
+CLS_INIT(numops)
{
CLS_LOG(20, "loading cls_numops");
+ cls_handle_t h_class;
+ cls_method_handle_t h_add;
+ cls_method_handle_t h_mul;
+
cls_register("numops", &h_class);
cls_register_cxx_method(h_class, "add",
CLS_VER(2,0)
CLS_NAME(rbd)
-cls_handle_t h_class;
-cls_method_handle_t h_create;
-cls_method_handle_t h_get_features;
-cls_method_handle_t h_set_features;
-cls_method_handle_t h_get_size;
-cls_method_handle_t h_set_size;
-cls_method_handle_t h_get_parent;
-cls_method_handle_t h_set_parent;
-cls_method_handle_t h_get_protection_status;
-cls_method_handle_t h_set_protection_status;
-cls_method_handle_t h_get_stripe_unit_count;
-cls_method_handle_t h_set_stripe_unit_count;
-cls_method_handle_t h_get_flags;
-cls_method_handle_t h_set_flags;
-cls_method_handle_t h_remove_parent;
-cls_method_handle_t h_add_child;
-cls_method_handle_t h_remove_child;
-cls_method_handle_t h_get_children;
-cls_method_handle_t h_get_snapcontext;
-cls_method_handle_t h_get_object_prefix;
-cls_method_handle_t h_get_data_pool;
-cls_method_handle_t h_get_snapshot_name;
-cls_method_handle_t h_get_snapshot_namespace;
-cls_method_handle_t h_snapshot_add;
-cls_method_handle_t h_snapshot_remove;
-cls_method_handle_t h_snapshot_rename;
-cls_method_handle_t h_get_all_features;
-cls_method_handle_t h_copyup;
-cls_method_handle_t h_get_id;
-cls_method_handle_t h_set_id;
-cls_method_handle_t h_dir_get_id;
-cls_method_handle_t h_dir_get_name;
-cls_method_handle_t h_dir_list;
-cls_method_handle_t h_dir_add_image;
-cls_method_handle_t h_dir_remove_image;
-cls_method_handle_t h_dir_rename_image;
-cls_method_handle_t h_object_map_load;
-cls_method_handle_t h_object_map_save;
-cls_method_handle_t h_object_map_resize;
-cls_method_handle_t h_object_map_update;
-cls_method_handle_t h_object_map_snap_add;
-cls_method_handle_t h_object_map_snap_remove;
-cls_method_handle_t h_metadata_set;
-cls_method_handle_t h_metadata_remove;
-cls_method_handle_t h_metadata_list;
-cls_method_handle_t h_metadata_get;
-cls_method_handle_t h_snapshot_get_limit;
-cls_method_handle_t h_snapshot_set_limit;
-cls_method_handle_t h_old_snapshots_list;
-cls_method_handle_t h_old_snapshot_add;
-cls_method_handle_t h_old_snapshot_remove;
-cls_method_handle_t h_old_snapshot_rename;
-cls_method_handle_t h_mirror_uuid_get;
-cls_method_handle_t h_mirror_uuid_set;
-cls_method_handle_t h_mirror_mode_get;
-cls_method_handle_t h_mirror_mode_set;
-cls_method_handle_t h_mirror_peer_list;
-cls_method_handle_t h_mirror_peer_add;
-cls_method_handle_t h_mirror_peer_remove;
-cls_method_handle_t h_mirror_peer_set_client;
-cls_method_handle_t h_mirror_peer_set_cluster;
-cls_method_handle_t h_mirror_image_list;
-cls_method_handle_t h_mirror_image_get_image_id;
-cls_method_handle_t h_mirror_image_get;
-cls_method_handle_t h_mirror_image_set;
-cls_method_handle_t h_mirror_image_remove;
-cls_method_handle_t h_mirror_image_status_set;
-cls_method_handle_t h_mirror_image_status_remove;
-cls_method_handle_t h_mirror_image_status_get;
-cls_method_handle_t h_mirror_image_status_list;
-cls_method_handle_t h_mirror_image_status_get_summary;
-cls_method_handle_t h_mirror_image_status_remove_down;
-cls_method_handle_t h_group_create;
-cls_method_handle_t h_group_dir_list;
-cls_method_handle_t h_group_dir_add;
-cls_method_handle_t h_group_dir_remove;
-cls_method_handle_t h_group_image_remove;
-cls_method_handle_t h_group_image_list;
-cls_method_handle_t h_group_image_set;
-cls_method_handle_t h_image_add_group;
-cls_method_handle_t h_image_remove_group;
-cls_method_handle_t h_image_get_group;
-
#define RBD_MAX_KEYS_READ 64
#define RBD_SNAP_KEY_PREFIX "snapshot_"
#define RBD_DIR_ID_KEY_PREFIX "id_"
return 0;
}
-void __cls_init()
+CLS_INIT(rbd)
{
CLS_LOG(20, "Loaded rbd class!");
+ cls_handle_t h_class;
+ cls_method_handle_t h_create;
+ cls_method_handle_t h_get_features;
+ cls_method_handle_t h_set_features;
+ cls_method_handle_t h_get_size;
+ cls_method_handle_t h_set_size;
+ cls_method_handle_t h_get_parent;
+ cls_method_handle_t h_set_parent;
+ cls_method_handle_t h_get_protection_status;
+ cls_method_handle_t h_set_protection_status;
+ cls_method_handle_t h_get_stripe_unit_count;
+ cls_method_handle_t h_set_stripe_unit_count;
+ cls_method_handle_t h_get_flags;
+ cls_method_handle_t h_set_flags;
+ cls_method_handle_t h_remove_parent;
+ cls_method_handle_t h_add_child;
+ cls_method_handle_t h_remove_child;
+ cls_method_handle_t h_get_children;
+ cls_method_handle_t h_get_snapcontext;
+ cls_method_handle_t h_get_object_prefix;
+ cls_method_handle_t h_get_data_pool;
+ cls_method_handle_t h_get_snapshot_name;
+ cls_method_handle_t h_get_snapshot_namespace;
+ cls_method_handle_t h_snapshot_add;
+ cls_method_handle_t h_snapshot_remove;
+ cls_method_handle_t h_snapshot_rename;
+ cls_method_handle_t h_get_all_features;
+ cls_method_handle_t h_copyup;
+ cls_method_handle_t h_get_id;
+ cls_method_handle_t h_set_id;
+ cls_method_handle_t h_dir_get_id;
+ cls_method_handle_t h_dir_get_name;
+ cls_method_handle_t h_dir_list;
+ cls_method_handle_t h_dir_add_image;
+ cls_method_handle_t h_dir_remove_image;
+ cls_method_handle_t h_dir_rename_image;
+ cls_method_handle_t h_object_map_load;
+ cls_method_handle_t h_object_map_save;
+ cls_method_handle_t h_object_map_resize;
+ cls_method_handle_t h_object_map_update;
+ cls_method_handle_t h_object_map_snap_add;
+ cls_method_handle_t h_object_map_snap_remove;
+ cls_method_handle_t h_metadata_set;
+ cls_method_handle_t h_metadata_remove;
+ cls_method_handle_t h_metadata_list;
+ cls_method_handle_t h_metadata_get;
+ cls_method_handle_t h_snapshot_get_limit;
+ cls_method_handle_t h_snapshot_set_limit;
+ cls_method_handle_t h_old_snapshots_list;
+ cls_method_handle_t h_old_snapshot_add;
+ cls_method_handle_t h_old_snapshot_remove;
+ cls_method_handle_t h_old_snapshot_rename;
+ cls_method_handle_t h_mirror_uuid_get;
+ cls_method_handle_t h_mirror_uuid_set;
+ cls_method_handle_t h_mirror_mode_get;
+ cls_method_handle_t h_mirror_mode_set;
+ cls_method_handle_t h_mirror_peer_list;
+ cls_method_handle_t h_mirror_peer_add;
+ cls_method_handle_t h_mirror_peer_remove;
+ cls_method_handle_t h_mirror_peer_set_client;
+ cls_method_handle_t h_mirror_peer_set_cluster;
+ cls_method_handle_t h_mirror_image_list;
+ cls_method_handle_t h_mirror_image_get_image_id;
+ cls_method_handle_t h_mirror_image_get;
+ cls_method_handle_t h_mirror_image_set;
+ cls_method_handle_t h_mirror_image_remove;
+ cls_method_handle_t h_mirror_image_status_set;
+ cls_method_handle_t h_mirror_image_status_remove;
+ cls_method_handle_t h_mirror_image_status_get;
+ cls_method_handle_t h_mirror_image_status_list;
+ cls_method_handle_t h_mirror_image_status_get_summary;
+ cls_method_handle_t h_mirror_image_status_remove_down;
+ cls_method_handle_t h_group_create;
+ cls_method_handle_t h_group_dir_list;
+ cls_method_handle_t h_group_dir_add;
+ cls_method_handle_t h_group_dir_remove;
+ cls_method_handle_t h_group_image_remove;
+ cls_method_handle_t h_group_image_list;
+ cls_method_handle_t h_group_image_set;
+ cls_method_handle_t h_image_add_group;
+ cls_method_handle_t h_image_remove_group;
+ cls_method_handle_t h_image_get_group;
+
cls_register("rbd", &h_class);
cls_register_cxx_method(h_class, "create",
CLS_METHOD_RD | CLS_METHOD_WR,
CLS_VER(1,0)
CLS_NAME(refcount)
-cls_handle_t h_class;
-cls_method_handle_t h_refcount_get;
-cls_method_handle_t h_refcount_put;
-cls_method_handle_t h_refcount_set;
-cls_method_handle_t h_refcount_read;
-
#define REFCOUNT_ATTR "refcount"
return 0;
}
-void __cls_init()
+CLS_INIT(refcount)
{
CLS_LOG(1, "Loaded refcount class!");
+ cls_handle_t h_class;
+ cls_method_handle_t h_refcount_get;
+ cls_method_handle_t h_refcount_put;
+ cls_method_handle_t h_refcount_set;
+ cls_method_handle_t h_refcount_read;
+
cls_register("refcount", &h_class);
/* refcount */
CLS_VER(1, 0)
CLS_NAME(replica_log)
-cls_handle_t h_class;
-cls_method_handle_t h_replica_log_set;
-cls_method_handle_t h_replica_log_delete;
-cls_method_handle_t h_replica_log_get;
-
static const string replica_log_prefix = "rl_";
static const string replica_log_bounds = replica_log_prefix + "bounds";
return 0;
}
-void __cls_init()
+CLS_INIT(replica_log)
{
CLS_LOG(1, "Loaded replica log class!");
+ cls_handle_t h_class;
+ cls_method_handle_t h_replica_log_set;
+ cls_method_handle_t h_replica_log_delete;
+ cls_method_handle_t h_replica_log_get;
+
cls_register("replica_log", &h_class);
cls_register_cxx_method(h_class, "set", CLS_METHOD_RD | CLS_METHOD_WR,
CLS_VER(1,0)
CLS_NAME(rgw)
-cls_handle_t h_class;
-cls_method_handle_t h_rgw_bucket_init_index;
-cls_method_handle_t h_rgw_bucket_set_tag_timeout;
-cls_method_handle_t h_rgw_bucket_list;
-cls_method_handle_t h_rgw_bucket_check_index;
-cls_method_handle_t h_rgw_bucket_rebuild_index;
-cls_method_handle_t h_rgw_bucket_update_stats;
-cls_method_handle_t h_rgw_bucket_prepare_op;
-cls_method_handle_t h_rgw_bucket_complete_op;
-cls_method_handle_t h_rgw_bucket_link_olh;
-cls_method_handle_t h_rgw_bucket_unlink_instance_op;
-cls_method_handle_t h_rgw_bucket_read_olh_log;
-cls_method_handle_t h_rgw_bucket_trim_olh_log;
-cls_method_handle_t h_rgw_bucket_clear_olh;
-cls_method_handle_t h_rgw_obj_remove;
-cls_method_handle_t h_rgw_obj_store_pg_ver;
-cls_method_handle_t h_rgw_obj_check_attrs_prefix;
-cls_method_handle_t h_rgw_obj_check_mtime;
-cls_method_handle_t h_rgw_bi_get_op;
-cls_method_handle_t h_rgw_bi_put_op;
-cls_method_handle_t h_rgw_bi_list_op;
-cls_method_handle_t h_rgw_bi_log_list_op;
-cls_method_handle_t h_rgw_dir_suggest_changes;
-cls_method_handle_t h_rgw_user_usage_log_add;
-cls_method_handle_t h_rgw_user_usage_log_read;
-cls_method_handle_t h_rgw_user_usage_log_trim;
-cls_method_handle_t h_rgw_gc_set_entry;
-cls_method_handle_t h_rgw_gc_list;
-cls_method_handle_t h_rgw_gc_remove;
-cls_method_handle_t h_rgw_lc_set_entry;
-cls_method_handle_t h_rgw_lc_rm_entry;
-cls_method_handle_t h_rgw_lc_get_next_entry;
-cls_method_handle_t h_rgw_lc_put_head;
-cls_method_handle_t h_rgw_lc_get_head;
-cls_method_handle_t h_rgw_lc_list_entries;
-
#define BI_PREFIX_CHAR 0x80
return 0;
}
-void __cls_init()
+CLS_INIT(rgw)
{
CLS_LOG(1, "Loaded rgw class!");
+ cls_handle_t h_class;
+ cls_method_handle_t h_rgw_bucket_init_index;
+ cls_method_handle_t h_rgw_bucket_set_tag_timeout;
+ cls_method_handle_t h_rgw_bucket_list;
+ cls_method_handle_t h_rgw_bucket_check_index;
+ cls_method_handle_t h_rgw_bucket_rebuild_index;
+ cls_method_handle_t h_rgw_bucket_update_stats;
+ cls_method_handle_t h_rgw_bucket_prepare_op;
+ cls_method_handle_t h_rgw_bucket_complete_op;
+ cls_method_handle_t h_rgw_bucket_link_olh;
+ cls_method_handle_t h_rgw_bucket_unlink_instance_op;
+ cls_method_handle_t h_rgw_bucket_read_olh_log;
+ cls_method_handle_t h_rgw_bucket_trim_olh_log;
+ cls_method_handle_t h_rgw_bucket_clear_olh;
+ cls_method_handle_t h_rgw_obj_remove;
+ cls_method_handle_t h_rgw_obj_store_pg_ver;
+ cls_method_handle_t h_rgw_obj_check_attrs_prefix;
+ cls_method_handle_t h_rgw_obj_check_mtime;
+ cls_method_handle_t h_rgw_bi_get_op;
+ cls_method_handle_t h_rgw_bi_put_op;
+ cls_method_handle_t h_rgw_bi_list_op;
+ cls_method_handle_t h_rgw_bi_log_list_op;
+ cls_method_handle_t h_rgw_dir_suggest_changes;
+ cls_method_handle_t h_rgw_user_usage_log_add;
+ cls_method_handle_t h_rgw_user_usage_log_read;
+ cls_method_handle_t h_rgw_user_usage_log_trim;
+ cls_method_handle_t h_rgw_gc_set_entry;
+ cls_method_handle_t h_rgw_gc_list;
+ cls_method_handle_t h_rgw_gc_remove;
+ cls_method_handle_t h_rgw_lc_set_entry;
+ cls_method_handle_t h_rgw_lc_rm_entry;
+ cls_method_handle_t h_rgw_lc_get_next_entry;
+ cls_method_handle_t h_rgw_lc_put_head;
+ cls_method_handle_t h_rgw_lc_get_head;
+ cls_method_handle_t h_rgw_lc_list_entries;
+
cls_register("rgw", &h_class);
/* bucket index */
CLS_VER(1,0)
CLS_NAME(statelog)
-cls_handle_t h_class;
-cls_method_handle_t h_statelog_add;
-cls_method_handle_t h_statelog_list;
-cls_method_handle_t h_statelog_remove;
-cls_method_handle_t h_statelog_check_state;
-
static string statelog_index_by_client_prefix = "1_";
static string statelog_index_by_object_prefix = "2_";
return 0;
}
-void __cls_init()
+CLS_INIT(statelog)
{
CLS_LOG(1, "Loaded log class!");
+ cls_handle_t h_class;
+ cls_method_handle_t h_statelog_add;
+ cls_method_handle_t h_statelog_list;
+ cls_method_handle_t h_statelog_remove;
+ cls_method_handle_t h_statelog_check_state;
+
cls_register("statelog", &h_class);
/* log */
CLS_VER(1,0)
CLS_NAME(timeindex)
-cls_handle_t h_class;
-cls_method_handle_t h_timeindex_add;
-cls_method_handle_t h_timeindex_list;
-cls_method_handle_t h_timeindex_trim;
-
static const size_t MAX_LIST_ENTRIES = 1000;
static const size_t MAX_TRIM_ENTRIES = 1000;
return 0;
}
-void __cls_init()
+CLS_INIT(timeindex)
{
CLS_LOG(1, "Loaded timeindex class!");
+ cls_handle_t h_class;
+ cls_method_handle_t h_timeindex_add;
+ cls_method_handle_t h_timeindex_list;
+ cls_method_handle_t h_timeindex_trim;
+
cls_register("timeindex", &h_class);
/* timeindex */
CLS_VER(1,0)
CLS_NAME(user)
-cls_handle_t h_class;
-cls_method_handle_t h_user_set_buckets_info;
-cls_method_handle_t h_user_complete_stats_sync;
-cls_method_handle_t h_user_remove_bucket;
-cls_method_handle_t h_user_list_buckets;
-cls_method_handle_t h_user_get_header;
-
static int write_entry(cls_method_context_t hctx, const string& key, const cls_user_bucket_entry& entry)
{
bufferlist bl;
return 0;
}
-void __cls_init()
+CLS_INIT(user)
{
CLS_LOG(1, "Loaded user class!");
+ cls_handle_t h_class;
+ cls_method_handle_t h_user_set_buckets_info;
+ cls_method_handle_t h_user_complete_stats_sync;
+ cls_method_handle_t h_user_remove_bucket;
+ cls_method_handle_t h_user_list_buckets;
+ cls_method_handle_t h_user_get_header;
+
cls_register("user", &h_class);
/* log */
CLS_VER(1,0)
CLS_NAME(version)
-cls_handle_t h_class;
-cls_method_handle_t h_version_set;
-cls_method_handle_t h_version_inc;
-cls_method_handle_t h_version_inc_conds;
-cls_method_handle_t h_version_read;
-cls_method_handle_t h_version_check_conds;
-
#define VERSION_ATTR "ceph.objclass.version"
return 0;
}
-void __cls_init()
+CLS_INIT(version)
{
CLS_LOG(1, "Loaded version class!");
+ cls_handle_t h_class;
+ cls_method_handle_t h_version_set;
+ cls_method_handle_t h_version_inc;
+ cls_method_handle_t h_version_inc_conds;
+ cls_method_handle_t h_version_read;
+ cls_method_handle_t h_version_check_conds;
+
cls_register("version", &h_class);
/* version */
CLS_VER(1,0)
CLS_NAME(acl)
-cls_handle_t h_class;
-cls_method_handle_t h_get;
-cls_method_handle_t h_set;
-
int get_method(cls_method_context_t ctx, char *indata, int datalen,
char **outdata, int *outdatalen)
{
return 0;
}
-void __cls_init()
+CLS_INIT(acl)
{
cls_log("Loaded acl class!");
+ cls_handle_t h_class;
+ cls_method_handle_t h_get;
+ cls_method_handle_t h_set;
+
cls_register("acl", &h_class);
cls_register_method(h_class, "get", CLS_METHOD_RD, get_method, &h_get);
cls_register_method(h_class, "set", CLS_METHOD_WR, set_method, &h_set);
CLS_VER(1,0)
CLS_NAME(crypto)
-cls_handle_t h_class;
-
-cls_method_handle_t h_md5;
-cls_method_handle_t h_sha1;
-
int md5_method(cls_method_context_t ctx, char *indata, int datalen,
char **outdata, int *outdatalen)
{
return 0;
}
-void __cls_init()
+CLS_INIT(crypto)
{
cls_log("Loaded crypto class!");
+ cls_handle_t h_class;
+ cls_method_handle_t h_md5;
+ cls_method_handle_t h_sha1;
+
cls_register("crypto", &h_class);
cls_register_method(h_class, "md5", CLS_METHOD_RD, md5_method, &h_md5);
cls_register_method(h_class, "sha1", CLS_METHOD_RD, sha1_method, &h_sha1);
/* Accelio conditional compilation */
#cmakedefine HAVE_XIO
+
/* AsyncMessenger RDMA conditional compilation */
#cmakedefine HAVE_RDMA
+/* define if embedded enabled */
+#cmakedefine WITH_EMBEDDED
+
+/* define if cephfs enabled */
+#cmakedefine WITH_CEPHFS
+
+/* define if rbd enabled */
+#cmakedefine WITH_RBD
+
+/* define if key-value-store is enabled */
+#cmakedefine WITH_KVS
+
/* define if radosgw enabled */
#cmakedefine WITH_RADOSGW
add_library(cls_kvs SHARED ${kvs_srcs})
set_target_properties(cls_kvs PROPERTIES VERSION "1.0.0" SOVERSION "1")
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()
#include <climits>
-cls_handle_t h_class;
-cls_method_handle_t h_get_idata_from_key;
-cls_method_handle_t h_get_next_idata;
-cls_method_handle_t h_get_prev_idata;
-cls_method_handle_t h_read_many;
-cls_method_handle_t h_check_writable;
-cls_method_handle_t h_assert_size_in_bound;
-cls_method_handle_t h_omap_insert;
-cls_method_handle_t h_create_with_omap;
-cls_method_handle_t h_omap_remove;
-cls_method_handle_t h_maybe_read_for_balance;
-
-
/**
* finds the index_data where a key belongs.
*
}
-void __cls_init()
+CLS_INIT(kvs)
{
CLS_LOG(20, "Loaded assert condition class!");
+ cls_handle_t h_class;
+ cls_method_handle_t h_get_idata_from_key;
+ cls_method_handle_t h_get_next_idata;
+ cls_method_handle_t h_get_prev_idata;
+ cls_method_handle_t h_read_many;
+ cls_method_handle_t h_check_writable;
+ cls_method_handle_t h_assert_size_in_bound;
+ cls_method_handle_t h_omap_insert;
+ cls_method_handle_t h_create_with_omap;
+ cls_method_handle_t h_omap_remove;
+ cls_method_handle_t h_maybe_read_for_balance;
+
cls_register("kvs", &h_class);
cls_register_cxx_method(h_class, "get_idata_from_key",
CLS_METHOD_RD,
cephd_base
cephd_compressor
cephd_ec
+ cephd_cls
+ cephd_cls_kvs
cephd_rados
cephd_rbd
- cls_journal_client
- cls_lock_client
- cls_rbd_client
common
common_utf8
erasure_code
#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(replica_log);
+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)
{
}
}
+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();
+ class_handler->add_embedded_class("replica_log");
+ replica_log_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);
struct obj_list_watch_response_t;
+#if __GNUC__ >= 4
+ #define CEPH_CLS_API __attribute__ ((visibility ("default")))
+#else
+ #define CEPH_CLS_API
+#endif
+
extern "C" {
#endif
+#ifndef BUILDING_FOR_EMBEDDED
#define CLS_VER(maj,min) \
int __cls_ver__## maj ## _ ##min = 0; \
int __cls_ver_maj = maj; \
#define CLS_NAME(name) \
int __cls_name__## name = 0; \
const char *__cls_name = #name;
+#define CLS_INIT(name) \
+void CEPH_CLS_API __cls_init()
+#else
+#define CLS_VER(maj,min)
+#define CLS_NAME(name)
+#define CLS_INIT(name) \
+void CEPH_CLS_API name##_cls_init()
+#endif
#define CLS_METHOD_RD 0x1 /// method executes read operations
#define CLS_METHOD_WR 0x2 /// method executes write operations
#define CLS_SUFFIX ".so"
+void ClassHandler::add_embedded_class(const string& cname)
+{
+ assert(mutex.is_locked());
+ ClassData *cls = _get_class(cname, false);
+ assert(cls->status == ClassData::CLASS_UNKNOWN);
+ cls->status = ClassData::CLASS_INITIALIZING;
+}
+
int ClassHandler::open_class(const string& cname, ClassData **pcls)
{
Mutex::Locker lock(mutex);
};
private:
- Mutex mutex;
map<string, ClassData> classes;
ClassData *_get_class(const string& cname, bool check_allowed);
const std::string& list);
public:
+ Mutex mutex;
+
explicit ClassHandler(CephContext *cct_) : cct(cct_), mutex("ClassHandler") {}
-
+
int open_all_classes();
+ void add_embedded_class(const string& cname);
int open_class(const string& cname, ClassData **pcls);
ClassData *register_class(const char *cname);