librados: Only public API symbols from the shared library

The librados shared library was previously exporting all
symbols.  librados public API methods are now explicitly
exported and all other symbols are hidden.

Signed-off-by: Jason Dillaman <dillaman@redhat.com>
This commit is contained in:
Jason Dillaman 2014-11-15 06:00:30 -05:00
parent 42974e12f6
commit dbb5a48e4a
10 changed files with 473 additions and 356 deletions

View File

@ -79,7 +79,7 @@ bin_PROGRAMS += ceph-syn
libkrbd_la_SOURCES = krbd.cc
libkrbd_la_LIBADD = $(LIBSECRET) -lblkid -ludev
libkrbd_la_LIBADD = $(LIBSECRET) $(LIBCOMMON) -lblkid -ludev
if LINUX
noinst_LTLIBRARIES += libkrbd.la
endif LINUX

View File

@ -1,4 +1,4 @@
libcommon_la_SOURCES = \
libcommon_internal_la_SOURCES = \
ceph_ver.c \
common/DecayCounter.cc \
common/LogClient.cc \
@ -38,7 +38,6 @@ libcommon_la_SOURCES = \
common/pipe.c \
common/ceph_argparse.cc \
common/ceph_context.cc \
common/buffer.cc \
common/types.cc \
common/code_environment.cc \
common/dout.cc \
@ -75,8 +74,8 @@ libcommon_la_SOURCES = \
common/module.c \
common/Readahead.cc
# these should go out of libcommon
libcommon_la_SOURCES += \
# these should go out of libcommon_internal
libcommon_internal_la_SOURCES += \
mon/MonCap.cc \
mon/MonClient.cc \
mon/MonMap.cc \
@ -88,6 +87,15 @@ libcommon_la_SOURCES += \
mds/inode_backtrace.cc \
mds/mdstypes.cc \
mds/flock.cc
LIBCOMMON_DEPS += libcommon_internal.la
noinst_LTLIBRARIES += libcommon_internal.la
libcommon_api_la_SOURCES = \
common/buffer.cc
if LINUX
libcommon_api_la_CXXFLAGS = -fvisibility=hidden -fvisibility-inlines-hidden
endif # LINUX
noinst_LTLIBRARIES += libcommon_api.la
# inject crc in common
libcommon_crc_la_SOURCES = \
@ -120,7 +128,9 @@ if LINUX
LIBCOMMON_DEPS += -lrt
endif # LINUX
libcommon_la_LIBADD = $(LIBCOMMON_DEPS)
libcommon_la_SOURCES =
libcommon_la_LIBADD = $(LIBCOMMON_DEPS) libcommon_api.la
noinst_LTLIBRARIES += libcommon.la
noinst_HEADERS += \
common/BackTrace.h \
@ -209,9 +219,6 @@ noinst_HEADERS += \
common/Continuation.h \
common/Readahead.h
noinst_LTLIBRARIES += libcommon.la
libsecret_la_SOURCES = common/secret.c
libsecret_la_LIBADD = $(KEYUTILS_LIB)
if LINUX

View File

@ -56,9 +56,15 @@
# include <assert.h>
#endif
#if __GNUC__ >= 4
#define CEPH_BUFFER_API __attribute__ ((visibility ("default")))
#else
#define CEPH_BUFFER_API
#endif
namespace ceph {
class buffer {
class CEPH_BUFFER_API buffer {
/*
* exceptions
*/
@ -151,7 +157,7 @@ public:
/*
* a buffer pointer. references (a subsequence of) a raw buffer.
*/
class ptr {
class CEPH_BUFFER_API ptr {
raw *_raw;
unsigned _off, _len;
@ -168,7 +174,7 @@ public:
~ptr() {
release();
}
bool have_raw() const { return _raw ? true:false; }
raw *clone();
@ -237,7 +243,7 @@ public:
* list - the useful bit!
*/
class list {
class CEPH_BUFFER_API list {
// my private bits
std::list<ptr> _buffers;
unsigned _len;
@ -245,7 +251,7 @@ public:
ptr append_buffer; // where i put small appends.
public:
class iterator {
class CEPH_BUFFER_API iterator {
list *bl;
std::list<ptr> *ls; // meh.. just here to avoid an extra pointer dereference..
unsigned off; // in bl

File diff suppressed because it is too large Load Diff

View File

@ -65,7 +65,7 @@ namespace librados
typedef void *completion_t;
typedef void (*callback_t)(completion_t cb, void *arg);
class ListObject
class CEPH_RADOS_API ListObject
{
public:
const std::string& get_nspace() const;
@ -84,9 +84,9 @@ namespace librados
ListObjectImpl *impl;
};
std::ostream& operator<<(std::ostream& out, const librados::ListObject& lop);
CEPH_RADOS_API std::ostream& operator<<(std::ostream& out, const librados::ListObject& lop);
class NObjectIterator : public std::iterator <std::forward_iterator_tag, ListObject> {
class CEPH_RADOS_API NObjectIterator : public std::iterator <std::forward_iterator_tag, ListObject> {
public:
static const NObjectIterator __EndObjectIterator;
NObjectIterator(): impl(NULL) {}
@ -116,7 +116,7 @@ namespace librados
};
// DEPRECATED; Use NObjectIterator
class ObjectIterator : public std::iterator <std::forward_iterator_tag, std::pair<std::string, std::string> > {
class CEPH_RADOS_API ObjectIterator : public std::iterator <std::forward_iterator_tag, std::pair<std::string, std::string> > {
public:
static const ObjectIterator __EndObjectIterator;
ObjectIterator() {}
@ -145,13 +145,13 @@ namespace librados
std::pair<std::string, std::string> cur_obj;
};
class WatchCtx {
class CEPH_RADOS_API WatchCtx {
public:
virtual ~WatchCtx();
virtual void notify(uint8_t opcode, uint64_t ver, bufferlist& bl) = 0;
};
struct AioCompletion {
struct CEPH_RADOS_API AioCompletion {
AioCompletion(AioCompletionImpl *pc_) : pc(pc_) {}
int set_complete_callback(void *cb_arg, callback_t cb);
int set_safe_callback(void *cb_arg, callback_t cb);
@ -170,7 +170,7 @@ namespace librados
AioCompletionImpl *pc;
};
struct PoolAsyncCompletion {
struct CEPH_RADOS_API PoolAsyncCompletion {
PoolAsyncCompletion(PoolAsyncCompletionImpl *pc_) : pc(pc_) {}
int set_callback(void *cb_arg, callback_t cb);
int wait();
@ -189,7 +189,7 @@ namespace librados
OP_FAILOK = LIBRADOS_OP_FLAG_FAILOK,
};
class ObjectOperationCompletion {
class CEPH_RADOS_API ObjectOperationCompletion {
public:
virtual ~ObjectOperationCompletion() {}
virtual void handle_completion(int r, bufferlist& outbl) = 0;
@ -230,7 +230,7 @@ namespace librados
* Batch multiple object operations into a single request, to be applied
* atomically.
*/
class ObjectOperation
class CEPH_RADOS_API ObjectOperation
{
public:
ObjectOperation();
@ -295,7 +295,7 @@ namespace librados
* Batch multiple object operations into a single request, to be applied
* atomically.
*/
class ObjectWriteOperation : public ObjectOperation
class CEPH_RADOS_API ObjectWriteOperation : public ObjectOperation
{
protected:
time_t *pmtime;
@ -397,7 +397,7 @@ namespace librados
* Batch multiple object operations into a single request, to be applied
* atomically.
*/
class ObjectReadOperation : public ObjectOperation
class CEPH_RADOS_API ObjectReadOperation : public ObjectOperation
{
public:
ObjectReadOperation() {}
@ -552,7 +552,7 @@ namespace librados
* p->stat(&stats);
* ... etc ...
*/
class IoCtx
class CEPH_RADOS_API IoCtx
{
public:
IoCtx();
@ -939,7 +939,7 @@ namespace librados
IoCtxImpl *io_ctx_impl;
};
class Rados
class CEPH_RADOS_API Rados
{
public:
static void version(int *major, int *minor, int *extra);

View File

@ -1,14 +1,20 @@
librados_la_SOURCES = \
librados/librados.cc \
librados_internal_la_SOURCES = \
librados/RadosClient.cc \
librados/IoCtxImpl.cc \
librados/snap_set_diff.cc \
librados/RadosXattrIter.cc
librados/RadosXattrIter.cc \
librados/snap_set_diff.cc
noinst_LTLIBRARIES += librados_internal.la
librados_la_SOURCES = \
common/buffer.cc \
librados/librados.cc
# We need this to avoid basename conflicts with the librados build tests in test/Makefile.am
librados_la_CXXFLAGS = ${AM_CXXFLAGS}
LIBRADOS_DEPS += libcls_lock_client.la $(LIBOSDC) $(LIBCOMMON)
LIBRADOS_DEPS += \
librados_internal.la libcls_lock_client.la \
$(LIBOSDC) $(LIBCOMMON_DEPS)
if WITH_LTTNG
LIBRADOS_DEPS += $(LIBRADOS_TP)
endif
@ -16,7 +22,8 @@ endif
librados_la_LIBADD = $(LIBRADOS_DEPS) $(PTHREAD_LIBS) $(CRYPTO_LIBS) $(EXTRALIBS)
librados_la_LDFLAGS = ${AM_LDFLAGS} -version-info 2:0:0
if LINUX
librados_la_LDFLAGS += -export-symbols-regex '^rados_.*'
librados_la_CXXFLAGS += -fvisibility=hidden -fvisibility-inlines-hidden
librados_la_LDFLAGS += -Xcompiler -Xlinker -Xcompiler '--exclude-libs=ALL'
endif
lib_LTLIBRARIES += librados.la

0
src/librados/RadosClient.h Executable file → Normal file
View File

View File

@ -6,7 +6,7 @@ libradosstriper_la_SOURCES = \
# We need this to avoid basename conflicts with the libradosstriper build tests in test/Makefile.am
libradosstriper_la_CXXFLAGS = ${AM_CXXFLAGS}
LIBRADOSSTRIPER_DEPS = $(LIBRADOS)
LIBRADOSSTRIPER_DEPS = $(LIBRADOS_DEPS)
libradosstriper_la_LIBADD = $(LIBRADOSSTRIPER_DEPS)
libradosstriper_la_LDFLAGS = ${AM_LDFLAGS} -version-info 1:0:0
if LINUX

View File

@ -7,8 +7,10 @@ librbd_la_SOURCES = \
librbd/LibrbdWriteback.cc \
librbd/WatchCtx.cc
librbd_la_LIBADD = \
$(LIBRADOS) $(LIBOSDC) \
libcls_rbd_client.la libcls_lock_client.la \
$(LIBRADOS) $(LIBCOMMON) $(LIBOSDC) \
librados_internal.la \
libcls_rbd_client.la \
libcls_lock_client.la \
$(PTHREAD_LIBS) $(EXTRALIBS)
if WITH_LTTNG

View File

@ -705,13 +705,17 @@ bin_DEBUGPROGRAMS += ceph_test_librbd
if LINUX
# Force use of C++ linker with dummy.cc - LIBKRBD is a C++ library
ceph_test_librbd_fsx_SOURCES = test/librbd/fsx.c common/dummy.cc
ceph_test_librbd_fsx_LDADD = $(LIBKRBD) $(LIBRBD) $(LIBRADOS)
ceph_test_librbd_fsx_LDADD = \
$(LIBKRBD) $(LIBRBD) $(LIBRADOS) \
$(CRYPTO_LIBS) $(PTHREAD_LIBS) -luuid
ceph_test_librbd_fsx_CFLAGS = ${AM_CFLAGS}
bin_DEBUGPROGRAMS += ceph_test_librbd_fsx
endif
ceph_test_cls_rbd_SOURCES = test/cls_rbd/test_cls_rbd.cc
ceph_test_cls_rbd_LDADD = $(LIBRADOS) libcls_rbd_client.la libcls_lock_client.la $(UNITTEST_LDADD) $(RADOS_TEST_LDADD)
ceph_test_cls_rbd_LDADD = \
$(LIBRADOS) libcls_rbd_client.la libcls_lock_client.la \
$(LIBCOMMON) $(UNITTEST_LDADD) $(RADOS_TEST_LDADD)
ceph_test_cls_rbd_CXXFLAGS = $(UNITTEST_CXXFLAGS)
bin_DEBUGPROGRAMS += ceph_test_cls_rbd
@ -743,7 +747,9 @@ ceph_test_cls_replica_log_CXXFLAGS = $(UNITTEST_CXXFLAGS)
bin_DEBUGPROGRAMS += ceph_test_cls_replica_log
ceph_test_cls_lock_SOURCES = test/cls_lock/test_cls_lock.cc
ceph_test_cls_lock_LDADD = $(LIBRADOS) libcls_lock_client.la $(UNITTEST_LDADD) $(RADOS_TEST_LDADD)
ceph_test_cls_lock_LDADD = \
$(LIBRADOS) libcls_lock_client.la \
$(LIBCOMMON) $(UNITTEST_LDADD) $(RADOS_TEST_LDADD)
ceph_test_cls_lock_CXXFLAGS = $(UNITTEST_CXXFLAGS)
bin_DEBUGPROGRAMS += ceph_test_cls_lock
@ -756,7 +762,9 @@ bin_DEBUGPROGRAMS += ceph_test_cls_hello
if WITH_RADOSGW
ceph_test_cls_rgw_SOURCES = test/cls_rgw/test_cls_rgw.cc
ceph_test_cls_rgw_LDADD = $(LIBRADOS) libcls_rgw_client.la $(UNITTEST_LDADD) $(RADOS_TEST_LDADD)
ceph_test_cls_rgw_LDADD = \
$(LIBRADOS) libcls_rgw_client.la \
$(LIBCOMMON) $(UNITTEST_LDADD) $(RADOS_TEST_LDADD)
ceph_test_cls_rgw_CXXFLAGS = $(UNITTEST_CXXFLAGS)
bin_DEBUGPROGRAMS += ceph_test_cls_rgw
endif # WITH_RADOSGW
@ -771,7 +779,9 @@ ceph_test_mon_msg_CXXFLAGS = $(UNITTEST_CXXFLAGS)
bin_DEBUGPROGRAMS += ceph_test_mon_msg
ceph_test_rados_api_cmd_SOURCES = test/librados/cmd.cc
ceph_test_rados_api_cmd_LDADD = $(LIBRADOS) $(UNITTEST_LDADD) $(RADOS_TEST_LDADD)
ceph_test_rados_api_cmd_LDADD = \
$(LIBCOMMON) $(LIBRADOS) $(CRYPTO_LIBS) \
$(UNITTEST_LDADD) $(RADOS_TEST_LDADD) -luuid
ceph_test_rados_api_cmd_CXXFLAGS = $(UNITTEST_CXXFLAGS)
bin_DEBUGPROGRAMS += ceph_test_rados_api_cmd
@ -793,7 +803,8 @@ ceph_test_rados_api_c_read_operations_CXXFLAGS = $(UNITTEST_CXXFLAGS)
bin_DEBUGPROGRAMS += ceph_test_rados_api_c_read_operations
ceph_test_rados_api_aio_SOURCES = test/librados/aio.cc
ceph_test_rados_api_aio_LDADD = $(LIBRADOS) $(UNITTEST_LDADD) $(RADOS_TEST_LDADD)
ceph_test_rados_api_aio_LDADD = \
$(LIBRADOS) $(LIBCOMMON) $(UNITTEST_LDADD) $(RADOS_TEST_LDADD)
ceph_test_rados_api_aio_CXXFLAGS = $(UNITTEST_CXXFLAGS)
bin_DEBUGPROGRAMS += ceph_test_rados_api_aio
@ -850,7 +861,9 @@ ceph_test_rados_api_lock_CXXFLAGS = $(UNITTEST_CXXFLAGS)
bin_DEBUGPROGRAMS += ceph_test_rados_api_lock
ceph_test_rados_striper_api_io_SOURCES = test/libradosstriper/io.cc
ceph_test_rados_striper_api_io_LDADD = $(LIBRADOS) $(LIBRADOSSTRIPER) $(UNITTEST_LDADD) $(RADOS_STRIPER_TEST_LDADD)
ceph_test_rados_striper_api_io_LDADD = \
$(LIBRADOS) $(LIBRADOSSTRIPER) $(LIBCOMMON) \
$(UNITTEST_LDADD) $(RADOS_STRIPER_TEST_LDADD)
ceph_test_rados_striper_api_io_CXXFLAGS = $(UNITTEST_CXXFLAGS)
bin_DEBUGPROGRAMS += ceph_test_rados_striper_api_io
@ -917,7 +930,8 @@ ceph_test_filejournal_CXXFLAGS = $(UNITTEST_CXXFLAGS)
bin_DEBUGPROGRAMS += ceph_test_filejournal
ceph_test_stress_watch_SOURCES = test/test_stress_watch.cc
ceph_test_stress_watch_LDADD = $(LIBRADOS) $(UNITTEST_LDADD) $(RADOS_TEST_LDADD)
ceph_test_stress_watch_LDADD = \
$(LIBRADOS) $(LIBCOMMON) $(UNITTEST_LDADD) $(RADOS_TEST_LDADD)
ceph_test_stress_watch_CXXFLAGS = $(UNITTEST_CXXFLAGS)
bin_DEBUGPROGRAMS += ceph_test_stress_watch