Commit b3482cd1 authored by Marek Vavruša's avatar Marek Vavruša

lib: started symbol visibility annotation, modules for now

parent af4254d1
......@@ -21,6 +21,17 @@
#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.
*/
......
......@@ -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
......
......@@ -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; }
......@@ -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[] = {
......
cachectl_CFLAGS := -fvisibility=hidden
cachectl_SOURCES := modules/cachectl/cachectl.c
cachectl_DEPEND := $(libkres)
cachectl_LIBS := $(libkres_TARGET) $(libkres_LIBS)
......
......@@ -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[] = {
......
hints_CFLAGS := -fvisibility=hidden
hints_SOURCES := modules/hints/hints.c
hints_DEPEND := $(libkres)
hints_LIBS := $(libkres_TARGET) $(libkres_LIBS)
......
......@@ -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;
......
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)
......@@ -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;
......
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)
......@@ -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[] = {
......
stats_CFLAGS := -fvisibility=hidden
stats_SOURCES := modules/stats/stats.c
stats_DEPEND := $(libkres)
stats_LIBS := $(libkres_TARGET) $(libkres_LIBS)
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment