summaryrefslogtreecommitdiff
path: root/librazor
diff options
context:
space:
mode:
authorKristian Høgsberg <krh@redhat.com>2008-06-23 17:19:20 -0400
committerKristian Høgsberg <krh@redhat.com>2008-06-23 17:19:20 -0400
commitfa4aba092832c1de58db59bd918b114db99d6608 (patch)
tree95aa821f685b5c0fc66fb1d4a9ac7f8283aa6d49 /librazor
parent298fd6434e6d144147ebf738db6cb09f5ac41095 (diff)
Use GCC 4 -fvisibility to control exported symbols.
Diffstat (limited to 'librazor')
-rw-r--r--librazor/importer.c16
-rw-r--r--librazor/iterator.c26
-rw-r--r--librazor/razor-internal.h8
-rw-r--r--librazor/razor.c38
-rw-r--r--librazor/root.c14
-rw-r--r--librazor/rpm.c8
-rw-r--r--librazor/transaction.c24
7 files changed, 72 insertions, 62 deletions
diff --git a/librazor/importer.c b/librazor/importer.c
index ec96c2e..5c73bc4 100644
--- a/librazor/importer.c
+++ b/librazor/importer.c
@@ -23,7 +23,7 @@
#include "razor-internal.h"
#include "razor.h"
-void
+RAZOR_EXPORT void
razor_importer_begin_package(struct razor_importer *importer,
const char *name,
const char *version,
@@ -42,7 +42,7 @@ razor_importer_begin_package(struct razor_importer *importer,
}
-void
+RAZOR_EXPORT void
razor_importer_finish_package(struct razor_importer *importer)
{
list_set_array(&importer->package->properties,
@@ -53,7 +53,7 @@ razor_importer_finish_package(struct razor_importer *importer)
array_release(&importer->properties);
}
-void
+RAZOR_EXPORT void
razor_importer_add_details(struct razor_importer *importer,
const char *summary,
const char *description,
@@ -66,7 +66,7 @@ razor_importer_add_details(struct razor_importer *importer,
importer->package->license = hashtable_tokenize(&importer->details_table, license);
}
-void
+RAZOR_EXPORT void
razor_importer_add_property(struct razor_importer *importer,
const char *name,
uint32_t flags,
@@ -92,7 +92,7 @@ razor_importer_add_property(struct razor_importer *importer,
}
}
-void
+RAZOR_EXPORT void
razor_importer_add_file(struct razor_importer *importer, const char *name)
{
struct import_entry *e;
@@ -104,7 +104,7 @@ razor_importer_add_file(struct razor_importer *importer, const char *name)
e->name = strdup(name);
}
-struct razor_importer *
+RAZOR_EXPORT struct razor_importer *
razor_importer_create(void)
{
struct razor_importer *importer;
@@ -121,7 +121,7 @@ razor_importer_create(void)
}
/* Destroy an importer without creating the set. */
-void
+RAZOR_EXPORT void
razor_importer_destroy(struct razor_importer *importer)
{
/* FIXME: write this */
@@ -469,7 +469,7 @@ build_package_file_lists(struct razor_set *set, uint32_t *rmap)
free(pkgs);
}
-struct razor_set *
+RAZOR_EXPORT struct razor_set *
razor_importer_finish(struct razor_importer *importer)
{
struct razor_set *set;
diff --git a/librazor/iterator.c b/librazor/iterator.c
index 60adebe..e684d7b 100644
--- a/librazor/iterator.c
+++ b/librazor/iterator.c
@@ -36,7 +36,7 @@ razor_package_iterator_create_with_index(struct razor_set *set,
return pi;
}
-struct razor_package_iterator *
+RAZOR_EXPORT struct razor_package_iterator *
razor_package_iterator_create(struct razor_set *set)
{
struct razor_package_iterator *pi;
@@ -49,7 +49,7 @@ razor_package_iterator_create(struct razor_set *set)
return pi;
}
-void
+RAZOR_EXPORT void
razor_package_iterator_init_for_property(struct razor_package_iterator *pi,
struct razor_set *set,
struct razor_property *property)
@@ -59,7 +59,7 @@ razor_package_iterator_init_for_property(struct razor_package_iterator *pi,
pi->index = list_first(&property->packages, &set->package_pool);
}
-struct razor_package_iterator *
+RAZOR_EXPORT struct razor_package_iterator *
razor_package_iterator_create_for_property(struct razor_set *set,
struct razor_property *property)
{
@@ -69,7 +69,7 @@ razor_package_iterator_create_for_property(struct razor_set *set,
return razor_package_iterator_create_with_index(set, index);
}
-struct razor_package_iterator *
+RAZOR_EXPORT struct razor_package_iterator *
razor_package_iterator_create_for_file(struct razor_set *set,
const char *filename)
{
@@ -84,7 +84,7 @@ razor_package_iterator_create_for_file(struct razor_set *set,
return razor_package_iterator_create_with_index(set, index);
}
-int
+RAZOR_EXPORT int
razor_package_iterator_next(struct razor_package_iterator *pi,
struct razor_package **package,
const char **name,
@@ -119,7 +119,7 @@ razor_package_iterator_next(struct razor_package_iterator *pi,
return valid;
}
-void
+RAZOR_EXPORT void
razor_package_iterator_destroy(struct razor_package_iterator *pi)
{
if (pi->free_index)
@@ -128,7 +128,7 @@ razor_package_iterator_destroy(struct razor_package_iterator *pi)
free(pi);
}
-struct razor_property_iterator *
+RAZOR_EXPORT struct razor_property_iterator *
razor_property_iterator_create(struct razor_set *set,
struct razor_package *package)
{
@@ -148,7 +148,7 @@ razor_property_iterator_create(struct razor_set *set,
return pi;
}
-int
+RAZOR_EXPORT int
razor_property_iterator_next(struct razor_property_iterator *pi,
struct razor_property **property,
const char **name,
@@ -183,7 +183,7 @@ razor_property_iterator_next(struct razor_property_iterator *pi,
return valid;
}
-void
+RAZOR_EXPORT void
razor_property_iterator_destroy(struct razor_property_iterator *pi)
{
free(pi);
@@ -195,7 +195,7 @@ struct razor_package_query {
int count;
};
-struct razor_package_query *
+RAZOR_EXPORT struct razor_package_query *
razor_package_query_create(struct razor_set *set)
{
struct razor_package_query *pq;
@@ -209,7 +209,7 @@ razor_package_query_create(struct razor_set *set)
return pq;
}
-void
+RAZOR_EXPORT void
razor_package_query_add_package(struct razor_package_query *pq,
struct razor_package *p)
{
@@ -220,7 +220,7 @@ razor_package_query_add_package(struct razor_package_query *pq,
pq->vector[p - packages] = 1;
}
-void
+RAZOR_EXPORT void
razor_package_query_add_iterator(struct razor_package_query *pq,
struct razor_package_iterator *pi)
{
@@ -234,7 +234,7 @@ razor_package_query_add_iterator(struct razor_package_query *pq,
}
}
-struct razor_package_iterator *
+RAZOR_EXPORT struct razor_package_iterator *
razor_package_query_finish(struct razor_package_query *pq)
{
struct razor_package_iterator *pi;
diff --git a/librazor/razor-internal.h b/librazor/razor-internal.h
index 94eac41..f3e93ae 100644
--- a/librazor/razor-internal.h
+++ b/librazor/razor-internal.h
@@ -4,6 +4,14 @@
#include <stdlib.h>
#include <stdint.h>
+/* GCC visibility */
+#if defined(__GNUC__) && __GNUC__ >= 4
+#define RAZOR_EXPORT __attribute__ ((visibility("default")))
+#else
+#define RAZOR_EXPORT
+#endif
+
+
void *zalloc(size_t size);
struct array {
diff --git a/librazor/razor.c b/librazor/razor.c
index 7b5094d..76412f9 100644
--- a/librazor/razor.c
+++ b/librazor/razor.c
@@ -65,7 +65,7 @@ struct razor_set_section razor_details_sections[] = {
{ RAZOR_DETAILS_STRING_POOL, offsetof(struct razor_set, details_string_pool) },
};
-struct razor_set *
+RAZOR_EXPORT struct razor_set *
razor_set_create(void)
{
struct razor_set *set;
@@ -85,7 +85,7 @@ razor_set_create(void)
return set;
}
-struct razor_set *
+RAZOR_EXPORT struct razor_set *
razor_set_open(const char *filename)
{
struct razor_set *set;
@@ -119,7 +119,7 @@ razor_set_open(const char *filename)
return set;
}
-void
+RAZOR_EXPORT void
razor_set_open_details(struct razor_set *set, const char *filename)
{
struct razor_set_section *s;
@@ -147,7 +147,7 @@ razor_set_open_details(struct razor_set *set, const char *filename)
close(fd);
}
-void
+RAZOR_EXPORT void
razor_set_open_files(struct razor_set *set, const char *filename)
{
struct razor_set_section *s;
@@ -175,7 +175,7 @@ razor_set_open_files(struct razor_set *set, const char *filename)
close(fd);
}
-void
+RAZOR_EXPORT void
razor_set_destroy(struct razor_set *set)
{
unsigned int size;
@@ -264,7 +264,7 @@ razor_set_write_sections_to_fd(struct razor_set *set, int fd, int magic,
return 0;
}
-int
+RAZOR_EXPORT int
razor_set_write_to_fd(struct razor_set *set, int fd,
enum razor_repo_file_type type)
{
@@ -287,7 +287,7 @@ razor_set_write_to_fd(struct razor_set *set, int fd,
}
}
-int
+RAZOR_EXPORT int
razor_set_write(struct razor_set *set, const char *filename,
enum razor_repo_file_type type)
{
@@ -305,7 +305,8 @@ razor_set_write(struct razor_set *set, const char *filename,
return close(fd);
}
-void
+
+RAZOR_EXPORT void
razor_build_evr(char *evr_buf, int size, const char *epoch,
const char *version, const char *release)
{
@@ -328,7 +329,7 @@ razor_build_evr(char *evr_buf, int size, const char *epoch,
snprintf(evr_buf, size, "-%s", release);
}
-int
+RAZOR_EXPORT int
razor_versioncmp(const char *s1, const char *s2)
{
const char *p1, *p2;
@@ -365,7 +366,7 @@ razor_versioncmp(const char *s1, const char *s2)
return *p1 - *p2;
}
-struct razor_package *
+RAZOR_EXPORT struct razor_package *
razor_set_get_package(struct razor_set *set, const char *package)
{
struct razor_package_iterator *pi;
@@ -382,8 +383,9 @@ razor_set_get_package(struct razor_set *set, const char *package)
return p;
}
-void
-razor_package_get_details(struct razor_set *set, struct razor_package *package,
+RAZOR_EXPORT void
+razor_package_get_details(struct razor_set *set,
+ struct razor_package *package,
const char **summary, const char **description,
const char **url, const char **license)
{
@@ -395,7 +397,7 @@ razor_package_get_details(struct razor_set *set, struct razor_package *package,
*license = &pool[package->license];
}
-struct razor_entry *
+RAZOR_EXPORT struct razor_entry *
razor_set_find_entry(struct razor_set *set,
struct razor_entry *dir, const char *pattern)
{
@@ -441,7 +443,7 @@ list_dir(struct razor_set *set, struct razor_entry *dir,
} while (!((e++)->flags & RAZOR_ENTRY_LAST));
}
-void
+RAZOR_EXPORT void
razor_set_list_files(struct razor_set *set, const char *pattern)
{
struct razor_entry *e;
@@ -526,7 +528,7 @@ list_package_files(struct razor_set *set, struct list *r,
return r;
}
-void
+RAZOR_EXPORT void
razor_set_list_package_files(struct razor_set *set, const char *name)
{
struct razor_package *package;
@@ -547,7 +549,7 @@ razor_set_list_package_files(struct razor_set *set, const char *name)
* requires for a package have been installed before the package.
**/
-void
+RAZOR_EXPORT void
razor_set_diff(struct razor_set *set, struct razor_set *upstream,
razor_diff_callback_t callback, void *data)
{
@@ -602,7 +604,7 @@ add_new_package(enum razor_diff_action action,
razor_package_query_add_package(data, package);
}
-struct razor_package_iterator *
+RAZOR_EXPORT struct razor_package_iterator *
razor_set_create_remove_iterator(struct razor_set *set,
struct razor_set *next)
{
@@ -622,7 +624,7 @@ razor_set_create_remove_iterator(struct razor_set *set,
return pi;
}
-struct razor_package_iterator *
+RAZOR_EXPORT struct razor_package_iterator *
razor_set_create_install_iterator(struct razor_set *set,
struct razor_set *next)
{
diff --git a/librazor/root.c b/librazor/root.c
index 6cef276..c81f53f 100644
--- a/librazor/root.c
+++ b/librazor/root.c
@@ -20,7 +20,7 @@ struct razor_root {
char new_path[PATH_MAX];
};
-int
+RAZOR_EXPORT int
razor_root_create(const char *root)
{
struct stat buf;
@@ -67,7 +67,7 @@ razor_root_create(const char *root)
return 0;
}
-struct razor_root *
+RAZOR_EXPORT struct razor_root *
razor_root_open(const char *root)
{
struct razor_root *image;
@@ -107,7 +107,7 @@ razor_root_open(const char *root)
return image;
}
-struct razor_set *
+RAZOR_EXPORT struct razor_set *
razor_root_open_read_only(const char *root)
{
char path[PATH_MAX];
@@ -118,13 +118,13 @@ razor_root_open_read_only(const char *root)
return razor_set_open(path);
}
-struct razor_set *
+RAZOR_EXPORT struct razor_set *
razor_root_get_system_set(struct razor_root *root)
{
return root->system;
}
-int
+RAZOR_EXPORT int
razor_root_close(struct razor_root *root)
{
razor_set_destroy(root->system);
@@ -135,7 +135,7 @@ razor_root_close(struct razor_root *root)
return 0;
}
-void
+RAZOR_EXPORT void
razor_root_update(struct razor_root *root, struct razor_set *next)
{
razor_set_write_to_fd(next, root->fd, RAZOR_REPO_FILE_MAIN);
@@ -147,7 +147,7 @@ razor_root_update(struct razor_root *root, struct razor_set *next)
printf("wrote %s\n", root->new_path);
}
-int
+RAZOR_EXPORT int
razor_root_commit(struct razor_root *root)
{
/* Make it so. */
diff --git a/librazor/rpm.c b/librazor/rpm.c
index 8bd5289..b8cca09 100644
--- a/librazor/rpm.c
+++ b/librazor/rpm.c
@@ -347,7 +347,7 @@ import_files(struct razor_importer *importer, struct razor_rpm *rpm)
}
}
-struct razor_rpm *
+RAZOR_EXPORT struct razor_rpm *
razor_rpm_open(const char *filename)
{
struct razor_rpm *rpm;
@@ -703,7 +703,7 @@ fixed_hex_to_ulong(const char *hex, int length)
return l;
}
-int
+RAZOR_EXPORT int
razor_rpm_install(struct razor_rpm *rpm, const char *root)
{
struct installer installer;
@@ -766,7 +766,7 @@ razor_rpm_install(struct razor_rpm *rpm, const char *root)
return 0;
}
-int
+RAZOR_EXPORT int
razor_rpm_close(struct razor_rpm *rpm)
{
int err;
@@ -778,7 +778,7 @@ razor_rpm_close(struct razor_rpm *rpm)
return err;
}
-int
+RAZOR_EXPORT int
razor_importer_add_rpm(struct razor_importer *importer, struct razor_rpm *rpm)
{
const char *name, *version, *release, *arch, *summary;
diff --git a/librazor/transaction.c b/librazor/transaction.c
index 6633a7a..23515ad 100644
--- a/librazor/transaction.c
+++ b/librazor/transaction.c
@@ -165,7 +165,7 @@ transaction_set_remove_package(struct transaction_set *ts,
}
}
-struct razor_transaction *
+RAZOR_EXPORT struct razor_transaction *
razor_transaction_create(struct razor_set *system, struct razor_set *upstream)
{
struct razor_transaction *trans;
@@ -184,7 +184,7 @@ razor_transaction_create(struct razor_set *system, struct razor_set *upstream)
return trans;
}
-void
+RAZOR_EXPORT void
razor_transaction_install_package(struct razor_transaction *trans,
struct razor_package *package)
{
@@ -192,7 +192,7 @@ razor_transaction_install_package(struct razor_transaction *trans,
trans->changes++;
}
-void
+RAZOR_EXPORT void
razor_transaction_remove_package(struct razor_transaction *trans,
struct razor_package *package)
{
@@ -200,7 +200,7 @@ razor_transaction_remove_package(struct razor_transaction *trans,
trans->changes++;
}
-void
+RAZOR_EXPORT void
razor_transaction_update_package(struct razor_transaction *trans,
struct razor_package *package)
{
@@ -461,7 +461,7 @@ clear_requires_flags(struct transaction_set *ts)
}
}
-const char *
+RAZOR_EXPORT const char *
razor_property_relation_to_string(struct razor_property *p)
{
switch (p->flags & RAZOR_PROPERTY_RELATION_MASK) {
@@ -485,7 +485,7 @@ razor_property_relation_to_string(struct razor_property *p)
}
}
-const char *
+RAZOR_EXPORT const char *
razor_property_type_to_string(struct razor_property *p)
{
switch (p->flags & RAZOR_PROPERTY_TYPE_MASK) {
@@ -567,7 +567,7 @@ update_unsatisfied_packages(struct razor_transaction *trans)
}
}
-void
+RAZOR_EXPORT void
razor_transaction_update_all(struct razor_transaction *trans)
{
struct razor_package *p;
@@ -740,7 +740,7 @@ flush_scheduled_upstream_updates(struct razor_transaction *trans)
}
}
-int
+RAZOR_EXPORT int
razor_transaction_resolve(struct razor_transaction *trans)
{
int last = 0;
@@ -789,7 +789,7 @@ describe_unsatisfied(struct razor_set *set, struct razor_property *rp)
}
}
-int
+RAZOR_EXPORT int
razor_transaction_describe(struct razor_transaction *trans)
{
struct prop_iter rpi;
@@ -820,7 +820,7 @@ razor_transaction_describe(struct razor_transaction *trans)
return unsatisfied;
}
-int
+RAZOR_EXPORT int
razor_transaction_unsatisfied_property(struct razor_transaction *trans,
const char *name,
uint32_t flags,
@@ -852,7 +852,7 @@ razor_transaction_unsatisfied_property(struct razor_transaction *trans,
return 0;
}
-struct razor_set *
+RAZOR_EXPORT struct razor_set *
razor_transaction_finish(struct razor_transaction *trans)
{
struct razor_merger *merger;
@@ -905,7 +905,7 @@ razor_transaction_finish(struct razor_transaction *trans)
return razor_merger_finish(merger);
}
-void
+RAZOR_EXPORT void
razor_transaction_destroy(struct razor_transaction *trans)
{
transaction_set_release(&trans->system);