]> git.ipfire.org Git - thirdparty/knot-resolver.git/commitdiff
lib: started symbol visibility annotation, modules for now
authorMarek Vavruša <marek.vavrusa@nic.cz>
Wed, 25 Nov 2015 18:03:17 +0000 (19:03 +0100)
committerMarek Vavruša <marek.vavrusa@nic.cz>
Wed, 25 Nov 2015 18:03:17 +0000 (19:03 +0100)
13 files changed:
lib/defines.h
lib/lib.mk
lib/module.h
modules/cachectl/cachectl.c
modules/cachectl/cachectl.mk
modules/hints/hints.c
modules/hints/hints.mk
modules/kmemcached/kmemcached.c
modules/kmemcached/kmemcached.mk
modules/redis/redis.c
modules/redis/redis.mk
modules/stats/stats.c
modules/stats/stats.mk

index d2e3e78d775799f785985755d3fbb28dafefc3c3..853a229bf33bf8cb39499d4cde1c7e6d8fbb25cc 100644 (file)
 #include <libknot/dname.h>
 #include <libknot/rrset.h>
 
+/* Function attributes */
+#if __GNUC__ >= 4
+#define KR_EXPORT __attribute__ ((visibility ("default")))
+#define KR_CONST __attribute__((__const__))
+#define KR_PURE __attribute__((__pure__))
+#else
+#define KR_EXPORT
+#define KR_CONST
+#define KR_PURE
+#endif
+
 /*
  * Error codes.
  */
index f48946d2d4813730a58dc5648ebddc3f7054f1cc..ef4d3cdff9b906ab464fa8bd6268beea667e4a43 100644 (file)
@@ -48,6 +48,7 @@ libkres_HEADERS := \
 
 # Dependencies
 libkres_DEPEND := 
+libkres_CFLAGS := -fvisibility=hidden
 libkres_LIBS := $(libknot_LIBS) $(libdnssec_LIBS)
 libkres_TARGET := -L$(abspath lib) -lkres
 
index eb5a6ebfe557f145ff398552105e8740cbe5177d..d3d2c7b307421b5d38a70085b68f4909462ca45e 100644 (file)
@@ -87,4 +87,4 @@ void kr_module_unload(struct kr_module *module);
  * @param module module name (f.e. hints)
  */
 #define KR_MODULE_EXPORT(module) \
-    uint32_t module ## _api() { return KR_MODULE_API; }
+    KR_EXPORT uint32_t module ## _api() { return KR_MODULE_API; }
index 7a76de42b4acc3adf6633099a973a1f4801dc7d7..ce7c407d4696ec01f8da89d679e08ec04f0f87b6 100644 (file)
@@ -305,6 +305,7 @@ static char* get(void *env, struct kr_module *module, const char *args)
  * Module implementation.
  */
 
+KR_EXPORT
 struct kr_prop *cachectl_props(void)
 {
        static struct kr_prop prop_list[] = {
index 7a67b567cd629bb520ec6581a75b68933a8c2ced..6707dbdca13ee5258270c1956ac8d7cdd63f6b88 100644 (file)
@@ -1,3 +1,4 @@
+cachectl_CFLAGS := -fvisibility=hidden
 cachectl_SOURCES := modules/cachectl/cachectl.c
 cachectl_DEPEND := $(libkres)
 cachectl_LIBS := $(libkres_TARGET) $(libkres_LIBS)
index b7ece70d16c5d5d6354ecae8dc8fe68ebb2237b4..99667e9bfd2dbd91498c25fc9fcfb99624082ff3 100644 (file)
@@ -430,6 +430,7 @@ static char* hint_root(void *env, struct kr_module *module, const char *args)
  * Module implementation.
  */
 
+KR_EXPORT
 const knot_layer_api_t *hints_layer(struct kr_module *module)
 {
        static knot_layer_api_t _layer = {
@@ -441,12 +442,14 @@ const knot_layer_api_t *hints_layer(struct kr_module *module)
        return &_layer;
 }
 
+KR_EXPORT
 int hints_init(struct kr_module *module)
 {
        module->data = NULL;
        return 0;
 }
 
+KR_EXPORT
 int hints_config(struct kr_module *module, const char *conf)
 {
        unload(module);
@@ -456,12 +459,14 @@ int hints_config(struct kr_module *module, const char *conf)
        return load(module, conf);
 }
 
+KR_EXPORT
 int hints_deinit(struct kr_module *module)
 {
        unload(module);
        return kr_ok();
 }
 
+KR_EXPORT
 struct kr_prop *hints_props(void)
 {
        static struct kr_prop prop_list[] = {
index 04a217e62667e6428a2fbd3c4ca8fe444b0d6520..c726391189068189237c857bc720e533971f73af 100644 (file)
@@ -1,3 +1,4 @@
+hints_CFLAGS := -fvisibility=hidden
 hints_SOURCES := modules/hints/hints.c
 hints_DEPEND := $(libkres)
 hints_LIBS := $(libkres_TARGET) $(libkres_LIBS)
index 094da5684bbd5f182e24665dbc09a368550f32ec..fdb6d70f72a4c41ecbb3951a17f96b0cb9c1a392 100644 (file)
@@ -29,6 +29,7 @@ void *namedb_memcached_mkopts(const char *conf, size_t maxsize)
        return strdup(conf);
 }
 
+KR_EXPORT
 int kmemcached_init(struct kr_module *module)
 {
        struct engine *engine = module->data;
@@ -40,6 +41,7 @@ int kmemcached_init(struct kr_module *module)
        return kr_ok();
 }
 
+KR_EXPORT
 int kmemcached_deinit(struct kr_module *module)
 {
        struct engine *engine = module->data;
index f5e1a96b39dfee73bcf1e789726bea603750015d..87462a707135922d59cb6220a16f276ee09ba85e 100644 (file)
@@ -1,3 +1,4 @@
+kmemcached_CFLAGS := -fvisibility=hidden
 kmemcached_SOURCES := modules/kmemcached/kmemcached.c modules/kmemcached/namedb_memcached.c
 kmemcached_LIBS := $(libkres_TARGET) $(libkres_LIBS) $(libmemcached_LIBS)
 $(call make_c_module,kmemcached)
index 8c9e2911fbd61ed09c9b460de34469365ff9832a..e77e393274ce5f70b5bb7945dfbdf346110bc8b8 100644 (file)
@@ -73,6 +73,7 @@ void *namedb_redis_mkopts(const char *conf_, size_t maxsize)
        return cli;
 }
 
+KR_EXPORT
 int redis_init(struct kr_module *module)
 {
        struct engine *engine = module->data;
@@ -84,6 +85,7 @@ int redis_init(struct kr_module *module)
        return kr_ok();
 }
 
+KR_EXPORT
 int redis_deinit(struct kr_module *module)
 {
        struct engine *engine = module->data;
index a249034ca5a21960c8e656abbac1e3724883a72f..765f231aeef5060980edbad8ac45d3c47ca54b8a 100644 (file)
@@ -1,3 +1,4 @@
+redis_CFLAGS := -fvisibility=hidden
 redis_SOURCES := modules/redis/redis.c modules/redis/namedb_redis.c
 redis_LIBS := $(libkres_TARGET) $(libkres_LIBS) $(hiredis_LIBS) $(libuv_LIBS)
 $(call make_c_module,redis)
index 7941bb5f0a6107602c2d078a82dc3f316e295bf4..ca411f74044986b412bf0aec770c5ca70902ad9e 100644 (file)
@@ -324,6 +324,7 @@ static char* clear_expiring(void *env, struct kr_module *module, const char *arg
  * Module implementation.
  */
 
+KR_EXPORT
 const knot_layer_api_t *stats_layer(struct kr_module *module)
 {
        static knot_layer_api_t _layer = {
@@ -334,6 +335,7 @@ const knot_layer_api_t *stats_layer(struct kr_module *module)
        return &_layer;
 }
 
+KR_EXPORT
 int stats_init(struct kr_module *module)
 {
        struct stat_data *data = malloc(sizeof(*data));
@@ -353,6 +355,7 @@ int stats_init(struct kr_module *module)
        return kr_ok();
 }
 
+KR_EXPORT
 int stats_deinit(struct kr_module *module)
 {
        struct stat_data *data = module->data;
@@ -367,6 +370,7 @@ int stats_deinit(struct kr_module *module)
        return kr_ok();
 }
 
+KR_EXPORT
 struct kr_prop *stats_props(void)
 {
        static struct kr_prop prop_list[] = {
index 83e10d0bf39fc01bc456b2954b6d0c0f19f8a59d..ef8a55e8304701625f5fed1a9205c9959f04eaf3 100644 (file)
@@ -1,3 +1,4 @@
+stats_CFLAGS := -fvisibility=hidden
 stats_SOURCES := modules/stats/stats.c
 stats_DEPEND := $(libkres)
 stats_LIBS := $(libkres_TARGET) $(libkres_LIBS)