Commit 8e2fb16b authored by Charlie Jacobsen's avatar Charlie Jacobsen

Adds symbol exports for kernel land.

When we install libcap as a kernel module, in order for other
kernel code (modules) to link with it, we need to mark public
functions with EXPORT_SYMBOL.
parent 6f8ce609
Pipeline #410 passed with stage
...@@ -1217,3 +1217,30 @@ void cap_destroy_cspace(struct cspace *cspace) ...@@ -1217,3 +1217,30 @@ void cap_destroy_cspace(struct cspace *cspace)
fail1: fail1:
return; return;
} }
/* EXPORTS -------------------------------------------------- */
/* These are required for kernel land, so that if we install libcap
* as a kernel module, other kernel code can link with it. */
EXPORT_SYMBOL(cap_init);
EXPORT_SYMBOL(cap_fini);
EXPORT_SYMBOL(cap_register_type);
EXPORT_SYMBOL(cap_alloc_cspace);
EXPORT_SYMBOL(cap_free_cspace);
EXPORT_SYMBOL(cap_init_cspace);
EXPORT_SYMBOL(cap_destroy_cspace);
EXPORT_SYMBOL(cap_cspace_setowner);
EXPORT_SYMBOL(cap_cspace_getowner);
EXPORT_SYMBOL(cap_cnode_get);
EXPORT_SYMBOL(cap_cnode_put);
EXPORT_SYMBOL(cap_cnode_object);
EXPORT_SYMBOL(cap_cnode_type);
EXPORT_SYMBOL(cap_cnode_cspace);
EXPORT_SYMBOL(cap_cnode_metadata);
EXPORT_SYMBOL(cap_cnode_set_metadata);
EXPORT_SYMBOL(cap_cnode_verify);
EXPORT_SYMBOL(cap_cnode_cptr);
EXPORT_SYMBOL(cap_insert);
EXPORT_SYMBOL(cap_delete);
EXPORT_SYMBOL(cap_grant);
EXPORT_SYMBOL(cap_revoke);
...@@ -31,16 +31,6 @@ cap_cptr_cache_bmap_for_level(struct cptr_cache *c, int lvl) ...@@ -31,16 +31,6 @@ cap_cptr_cache_bmap_for_level(struct cptr_cache *c, int lvl)
#error "You need to adjust this function def." #error "You need to adjust this function def."
#endif #endif
int cptr_init(void)
{
return __cptr_init();
}
void cptr_fini(void)
{
__cptr_fini();
}
int cptr_cache_alloc(struct cptr_cache **out) int cptr_cache_alloc(struct cptr_cache **out)
{ {
struct cptr_cache *cache; struct cptr_cache *cache;
...@@ -93,8 +83,8 @@ void cptr_cache_destroy(struct cptr_cache *cache) ...@@ -93,8 +83,8 @@ void cptr_cache_destroy(struct cptr_cache *cache)
/* No-op for now */ /* No-op for now */
} }
int __cap_alloc_cptr_from_bmap(unsigned long *bmap, int size, static int __cap_alloc_cptr_from_bmap(unsigned long *bmap, int size,
unsigned long *out) unsigned long *out)
{ {
unsigned long idx; unsigned long idx;
/* /*
...@@ -200,3 +190,15 @@ void cptr_free(struct cptr_cache *cptr_cache, cptr_t c) ...@@ -200,3 +190,15 @@ void cptr_free(struct cptr_cache *cptr_cache, cptr_t c)
return; return;
} }
/* EXPORTS -------------------------------------------------- */
/* These are required for kernel land, so that if we install libcap
* as a kernel module, other kernel code can link with it. */
EXPORT_SYMBOL(cap_cptr_cache_bmap_for_level);
EXPORT_SYMBOL(cptr_cache_alloc);
EXPORT_SYMBOL(cptr_cache_free);
EXPORT_SYMBOL(cptr_cache_init);
EXPORT_SYMBOL(cptr_cache_destroy);
EXPORT_SYMBOL(cptr_alloc);
EXPORT_SYMBOL(cptr_free);
...@@ -71,7 +71,10 @@ uninstall-headers: ...@@ -71,7 +71,10 @@ uninstall-headers:
rm -f $(KERNEL_HEADERS_INSTALL)/libcap_list.h rm -f $(KERNEL_HEADERS_INSTALL)/libcap_list.h
# Don't do regular install; user probably doesn't want kernel stuff in # Don't do regular install; user probably doesn't want kernel stuff in
# user-level directories. # user-level directories. (In retrospect, maybe a regular install isn't
# a bad idea. User can always uninstall if they mess up and choose the
# wrong prefix. Of course, we have to manually spell out the install
# rule using $DESTDIR.)
install: install-headers install: install-headers
@echo ""; \ @echo ""; \
echo "----------------------------------------"; \ echo "----------------------------------------"; \
......
...@@ -208,4 +208,7 @@ static unsigned long find_first_zero_bit(const unsigned long *addr, ...@@ -208,4 +208,7 @@ static unsigned long find_first_zero_bit(const unsigned long *addr,
#define msleep(ms) usleep(10 * (ms)) #define msleep(ms) usleep(10 * (ms))
/* No need to export symbols for user lib. */
#define EXPORT_SYMBOL(s)
#endif /* __LIBCAP_PLATFORM_INTERNAL_H__ */ #endif /* __LIBCAP_PLATFORM_INTERNAL_H__ */
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