...
 
Commits (13)
  • Charles Jacobsen's avatar
    Switch to autoconf 2.68, remove std bool header check. · 33e3cc55
    Charles Jacobsen authored
    I don't want to use autoconf 2.69 on emulab, and std bool is
    only needed for user builds.
    
    I also don't want to merge in the truck load of changes on
    the upstream, so I'm diverging for now.
    33e3cc55
  • Charles Jacobsen's avatar
    5cee08d6
  • Charlie Jacobsen's avatar
    Add include hooks so we can build libcap for isolated env. · bfd4615a
    Charlie Jacobsen authored
    I don't like this, and I'll come up with a better solution
    perhaps in the future. But I need to put in my include hooks
    in the libcap source files.
    bfd4615a
  • Charles Jacobsen's avatar
    Fix kernel external build. · e2f207da
    Charles Jacobsen authored
    The kernel build is a bit fragile right now (at least the kernel
    module build is). In order for all kernel build targets to
    work properly (e.g. make clean), the Kbuild file needs to be
    at the "root" of the build tree. For example, the kernel's make
    clean uses a simple "find" piped into xargs rm -f, so it only trickles
    down child directories. (If you build files that are not a child
    of the root Kbuild directory, make clean / find won't touch
    them.) This means that a "make clean" won't actually do a full
    clean up.
    e2f207da
  • Charles Jacobsen's avatar
    Add CFLAGS to kernel build. · 54c7670a
    Charles Jacobsen authored
    With this, I can pass in include paths, etc. at build time (versus
    configure time).
    54c7670a
  • Charles Jacobsen's avatar
    Add padding to cptr_cache. · dccb7e43
    Charles Jacobsen authored
    I want non-isolated code to be able to initialize a cptr_cache
    for isolated code. The problem is, the size of a mutex for
    isolated code is only 8 bytes, versus 16 bytes for non-isolated.
    So, the isolated libcap is compiled so that there is 8 bytes of
    padding after the cptr cache lock. I know, this is really awesome ;)
    dccb7e43
  • Charles Jacobsen's avatar
    Bug in trylock definition for kernel platform. · a0398127
    Charles Jacobsen authored
    Unlike other kernel functions, mutex_trylock returns 1 on sucess
    and 0 on failure. We were negating that, and then negating it
    again in our check in cap.c. We got away with this in the microkernel
    because in the host kernel, the first call returned 1 (for success)
    and then 0 (for error); the double negations mixed things up and
    it still worked. But inside LCDs, since I hack trylock to always
    return 1, it caused the code to go into an infinite loop.
    
    Gonna make this same change and put it in the mainline.
    a0398127
  • Charlie Jacobsen's avatar
    lcd: Add macro for adjusting function attributes. · 27169116
    Charlie Jacobsen authored
    This is so we can mark functions as weak, for example, and redefine
    them elsewhere.
    27169116
  • Charlie Jacobsen's avatar
    lcd: Add support for clang builds. · b7777461
    Charlie Jacobsen authored
    This is kind of hack-ish for now. clang doesn't support some of the
    compiler flags that are used in a kernel build. I'm providing a
    general "hook" that a libcap builder can use to filter out bad
    kbuild cflags. (A perhaps better long term solution would check that
    the CC supports certain flags, and then do the filtering.)
    b7777461
  • Charles Jacobsen's avatar
    lcd: Fix some "bugs" spotted by clang. · 56deb161
    Charles Jacobsen authored
    Complained about use of enums and ints in a comparison.
    56deb161
  • Charles Jacobsen's avatar
    lcd: Fix grant cptr bug. · 8b465a57
    Charles Jacobsen authored
    (This was fixed in upstream, but I haven't sucked it in yet.)
    8b465a57
  • Vikram Narayanan's avatar
    Add struct name for cptr struct · 15973580
    Vikram Narayanan authored
    IDL generator does not have capability (not the libcap capability) to
    generate/resolve typedefs. The generator produces 'struct cptr'. Add struct
    name to make the compiler happy.
    Signed-off-by: Vikram Narayanan's avatarVikram Narayanan <vikram186@gmail.com>
    15973580
  • Vikram Narayanan's avatar
    Add more levels to the cptr tree · 0a5ee683
    Vikram Narayanan authored
    0a5ee683
# -*- Autoconf -*-
# Process this file with autoconf to produce a configure script.
AC_PREREQ([2.69])
AC_PREREQ([2.68])
AC_INIT([libcap], [0.1])
AC_CONFIG_SRCDIR([src/common/cptr_cache.c])
AC_CONFIG_AUX_DIR(autoconf)
......@@ -58,9 +58,9 @@ AC_SUBST(PLATFORM_DIR)
# CSpace depth. We use bits to enforce that the depth is a power of 2.
AC_ARG_VAR([CSPACE_DEPTH_BITS],
[Set CSPACE depth to 2^CSPACE_DEPTH_BITS (default=2, default depth=4)])
[Set CSPACE depth to 2^CSPACE_DEPTH_BITS (default=3, default depth=8)])
AS_IF([test "x$CSPACE_DEPTH_BITS" = "x"],
[CSPACE_DEPTH_BITS="2"]) # default
[CSPACE_DEPTH_BITS="3"]) # default
AS_CASE([$CSPACE_DEPTH_BITS],
[@<:@0-8@:>@],
......@@ -250,7 +250,7 @@ AC_CHECK_HEADERS([stdint.h stdlib.h string.h unistd.h])
# Checks for types
# --------------------------------------------------
AC_CHECK_HEADER_STDBOOL
#AC_CHECK_HEADER_STDBOOL
AC_TYPE_SIZE_T
AC_TYPE_UINT8_T
AC_CHECK_SIZEOF([unsigned long])
......@@ -336,10 +336,10 @@ AC_CONFIG_FILES(
src/platform/Makefile
src/platform/kernel/Makefile
src/Kbuild:src/platform/kernel/Kbuild.in
src/platform/kernel/src/Makefile
src/platform/kernel/module/Makefile
src/platform/kernel/module/Kbuild
src/platform/kernel/Kbuild
src/platform/kernel/include/Makefile
src/platform/kernel/test/Makefile
......
......@@ -24,7 +24,7 @@
* The depth must be at least 1 and a power of 2, since there is always at
* least one root level.
*/
#define CAP_CSPACE_DEPTH_BITS 2
#define CAP_CSPACE_DEPTH_BITS 3
#define CAP_CSPACE_DEPTH (1 << CAP_CSPACE_DEPTH_BITS)
#if (CAP_CSPACE_DEPTH < 1)
......@@ -78,6 +78,17 @@
#define CAP_EXP_1(a) ((a) * CAP_EXP_0(a))
#define CAP_EXP_2(a) ((a) * CAP_EXP_1(a))
#define CAP_EXP_3(a) ((a) * CAP_EXP_2(a))
#define CAP_CSPACE_SLOTS_IN_LEVEL(lvl) \
CAP_EXP_ ## lvl(CAP_CSPACE_CNODE_TABLE_SIZE/2)
#elif (CAP_CSPACE_DEPTH == 8)
#define CAP_EXP_0(a) (a)
#define CAP_EXP_1(a) ((a) * CAP_EXP_0(a))
#define CAP_EXP_2(a) ((a) * CAP_EXP_1(a))
#define CAP_EXP_3(a) ((a) * CAP_EXP_2(a))
#define CAP_EXP_4(a) ((a) * CAP_EXP_3(a))
#define CAP_EXP_5(a) ((a) * CAP_EXP_4(a))
#define CAP_EXP_6(a) ((a) * CAP_EXP_5(a))
#define CAP_EXP_7(a) ((a) * CAP_EXP_6(a))
#define CAP_CSPACE_SLOTS_IN_LEVEL(lvl) \
CAP_EXP_ ## lvl(CAP_CSPACE_CNODE_TABLE_SIZE/2)
#else
......
......@@ -3,9 +3,18 @@
*
* Copyright: University of Utah
*/
#ifdef LCD_DOMAINS
#include <lcd_config/pre_hook.h>
#endif
#include <libcap.h>
#include <libcap_internal.h>
#ifdef LCD_DOMAINS
#include <lcd_config/post_hook.h>
#endif
struct cdt_cache {
cap_mutex_t lock;
cap_cache_t *cdt_root_cache;
......@@ -27,7 +36,9 @@ static struct cap_type_system global_ts;
*/
static unsigned long long cspace_id = 0;
int cap_init(void)
int
LIBCAP_FUNC_ATTR
cap_init(void)
{
int ret;
/*
......@@ -75,7 +86,9 @@ fail1:
return ret;
}
void cap_fini(void)
void
LIBCAP_FUNC_ATTR
cap_fini(void)
{
/*
* Destroy cdt cache
......@@ -94,7 +107,9 @@ void cap_fini(void)
}
#ifdef CAP_ENABLE_GLOBAL_TYPES
cap_type_t cap_register_type(cap_type_t type, const struct cap_type_ops *ops)
cap_type_t
LIBCAP_FUNC_ATTR
cap_register_type(cap_type_t type, const struct cap_type_ops *ops)
{
return cap_register_private_type(&global_ts, type, ops);
}
......@@ -103,7 +118,9 @@ cap_type_t cap_register_type(cap_type_t type, const struct cap_type_ops *ops)
/**
* Allocates a new cdt root node using the cdt cache.
*/
struct cdt_root_node *get_cdt_root(void)
struct cdt_root_node *
LIBCAP_FUNC_ATTR
get_cdt_root(void)
{
int ret;
struct cdt_root_node *cdt_node = NULL;
......@@ -122,7 +139,9 @@ struct cdt_root_node *get_cdt_root(void)
return cdt_node;
}
void free_cdt_root(struct cdt_root_node *cdt_node)
void
LIBCAP_FUNC_ATTR
free_cdt_root(struct cdt_root_node *cdt_node)
{
int ret;
......@@ -192,7 +211,9 @@ inline void cap_free_cspace(struct cspace *cspace) { cap_free(cspace); }
/**
* Initializes the cspace's fields.
*/
int cap_init_cspace_with_type_system(struct cspace *cspace,
int
LIBCAP_FUNC_ATTR
cap_init_cspace_with_type_system(struct cspace *cspace,
struct cap_type_system *ts)
{
int ret;
......@@ -252,7 +273,9 @@ int cap_init_cspace_with_type_system(struct cspace *cspace,
}
#ifdef CAP_ENABLE_GLOBAL_TYPES
int cap_init_cspace(struct cspace *cspace)
int
LIBCAP_FUNC_ATTR
cap_init_cspace(struct cspace *cspace)
{
return cap_init_cspace_with_type_system(cspace, &global_ts);
}
......@@ -478,31 +501,49 @@ static int __cap_cnode_get(struct cspace *cspace, cptr_t c,
return ret;
}
int cap_cnode_get(struct cspace *cspace, cptr_t c, struct cnode **cnode)
int
LIBCAP_FUNC_ATTR
cap_cnode_get(struct cspace *cspace, cptr_t c, struct cnode **cnode)
{
return __cap_cnode_get(cspace, c, false, cnode);
}
void cap_cnode_put(struct cnode *cnode)
void
LIBCAP_FUNC_ATTR
cap_cnode_put(struct cnode *cnode)
{
cap_mutex_unlock(&cnode->lock);
}
void* cap_cnode_object(struct cnode *cnode) { return cnode->object; }
cap_type_t cap_cnode_type(struct cnode *cnode) { return cnode->type; }
struct cspace * cap_cnode_cspace(struct cnode *cnode) { return cnode->cspace; }
void*
LIBCAP_FUNC_ATTR
cap_cnode_object(struct cnode *cnode) { return cnode->object; }
void* cap_cnode_metadata(struct cnode *cnode)
cap_type_t
LIBCAP_FUNC_ATTR
cap_cnode_type(struct cnode *cnode) { return cnode->type; }
struct cspace *
LIBCAP_FUNC_ATTR
cap_cnode_cspace(struct cnode *cnode) { return cnode->cspace; }
void*
LIBCAP_FUNC_ATTR
cap_cnode_metadata(struct cnode *cnode)
{
return cnode->metadata;
}
void cap_cnode_set_metadata(struct cnode *cnode, void *metadata)
void
LIBCAP_FUNC_ATTR
cap_cnode_set_metadata(struct cnode *cnode, void *metadata)
{
cnode->metadata = metadata;
}
int cap_cnode_verify(struct cspace *cspace, cptr_t c)
int
LIBCAP_FUNC_ATTR
cap_cnode_verify(struct cspace *cspace, cptr_t c)
{
struct cnode *cnode;
int ret;
......@@ -514,14 +555,18 @@ int cap_cnode_verify(struct cspace *cspace, cptr_t c)
return ret;
}
cptr_t cap_cnode_cptr(struct cnode *cnode) { return cnode->cptr; }
cptr_t
LIBCAP_FUNC_ATTR
cap_cnode_cptr(struct cnode *cnode) { return cnode->cptr; }
int cap_insert(struct cspace *cspace, cptr_t c, void *object, cap_type_t type)
int
LIBCAP_FUNC_ATTR
cap_insert(struct cspace *cspace, cptr_t c, void *object, cap_type_t type)
{
struct cnode *cnode;
int ret;
if (type < CAP_TYPE_FIRST_NONBUILTIN || type >= CAP_TYPE_MAX) {
if (type < CAP_TYPE_FIRST_NONBUILTIN || ((int)type) >= CAP_TYPE_MAX) {
CAP_ERR("unregistered type %d -- BUG!", type);
return -EADDRNOTAVAIL;
}
......@@ -558,7 +603,7 @@ static void cap_notify_delete(struct cspace *cspace, struct cnode *cnode)
{
cap_type_t type = cnode->type;
if (type >= CAP_TYPE_FIRST_NONBUILTIN && type < CAP_TYPE_MAX
if (type >= CAP_TYPE_FIRST_NONBUILTIN && ((int)type) < CAP_TYPE_MAX
&& cspace->ts->types[type].name) {
if (cspace->ts->types[type].delete)
cspace->ts->types[type].delete(cspace, cnode,
......@@ -572,7 +617,7 @@ static void cap_notify_revocation(struct cspace *cspace, struct cnode *cnode)
{
cap_type_t type = cnode->type;
if (type >= CAP_TYPE_FIRST_NONBUILTIN && type < CAP_TYPE_MAX
if (type >= CAP_TYPE_FIRST_NONBUILTIN && ((int)type) < CAP_TYPE_MAX
&& cspace->ts->types[type].name) {
if (cspace->ts->types[type].revoke)
cspace->ts->types[type].revoke(cspace, cnode,
......@@ -634,7 +679,6 @@ static int try_delete_cnode(struct cspace *cspace, struct cnode *cnode)
{
int last_node;
struct cdt_root_node *cdt_node;
/*
* Try to lock the cdt
*/
......@@ -703,7 +747,9 @@ static int try_delete_cnode(struct cspace *cspace, struct cnode *cnode)
return 1;
}
void cap_delete(struct cspace *cspace, cptr_t c)
void
LIBCAP_FUNC_ATTR
cap_delete(struct cspace *cspace, cptr_t c)
{
struct cnode *cnode;
int done;
......@@ -782,7 +828,7 @@ void cap_delete(struct cspace *cspace, cptr_t c)
}
static int try_grant(struct cspace *cspacedst, struct cnode *cnodesrc,
struct cnode *cnodedst)
struct cnode *cnodedst, cptr_t dest_cptr)
{
/*
* Try to lock the cdt containing source cnode (dest cnode should
......@@ -812,12 +858,15 @@ static int try_grant(struct cspace *cspacedst, struct cnode *cnodesrc,
cnodedst->object = cnodesrc->object;
cnodedst->cspace = cspacedst;
cnodedst->cdt_root = cnodesrc->cdt_root;
cnodedst->cptr = dest_cptr;
return 1;
}
int cap_grant(struct cspace *cspacesrc, cptr_t c_src,
struct cspace *cspacedst, cptr_t c_dst)
int
LIBCAP_FUNC_ATTR
cap_grant(struct cspace *cspacesrc, cptr_t c_src,
struct cspace *cspacedst, cptr_t c_dst)
{
struct cnode *cnodesrc, *cnodedst;
int done;
......@@ -893,8 +942,7 @@ int cap_grant(struct cspace *cspacesrc, cptr_t c_src,
/*
* Try to grant
*/
done = try_grant(cspacedst, cnodesrc, cnodedst);
done = try_grant(cspacedst, cnodesrc, cnodedst, c_dst);
/*
* Release both cnodes
*/
......@@ -1013,7 +1061,9 @@ static int try_revoke(struct cspace *cspace, struct cnode *cnode)
return ret;
}
int cap_revoke(struct cspace *cspace, cptr_t c)
int
LIBCAP_FUNC_ATTR
cap_revoke(struct cspace *cspace, cptr_t c)
{
struct cnode *cnode;
int ret;
......@@ -1181,7 +1231,9 @@ static void cspace_tear_down(struct cspace *cspace)
return;
}
void cap_destroy_cspace(struct cspace *cspace)
void
LIBCAP_FUNC_ATTR
cap_destroy_cspace(struct cspace *cspace)
{
int ret;
/*
......@@ -1231,7 +1283,6 @@ void cap_destroy_cspace(struct cspace *cspace)
EXPORT_SYMBOL(cap_init);
EXPORT_SYMBOL(cap_fini);
EXPORT_SYMBOL(cap_init_cspace_with_type_system);
EXPORT_SYMBOL(cap_register_private_type);
EXPORT_SYMBOL(cap_alloc_cspace);
EXPORT_SYMBOL(cap_free_cspace);
EXPORT_SYMBOL(cap_destroy_cspace);
......
......@@ -6,10 +6,20 @@
* Pankaj Kumar <pankajk@cs.utah.edu>
*/
#ifdef LCD_DOMAINS
#include <lcd_config/pre_hook.h>
#endif
#include <libcap.h>
#include <libcap_internal.h>
int cptr_cache_alloc(struct cptr_cache **out)
#ifdef LCD_DOMAINS
#include <lcd_config/post_hook.h>
#endif
int
LIBCAP_FUNC_ATTR
cptr_cache_alloc(struct cptr_cache **out)
{
struct cptr_cache *cache;
/*
......@@ -22,7 +32,9 @@ int cptr_cache_alloc(struct cptr_cache **out)
return 0;
}
void cptr_cache_free(struct cptr_cache *cache)
void
LIBCAP_FUNC_ATTR
cptr_cache_free(struct cptr_cache *cache)
{
/*
* Free container
......@@ -30,7 +42,9 @@ void cptr_cache_free(struct cptr_cache *cache)
cap_free(cache);
}
int cptr_cache_init(struct cptr_cache *cache)
int
LIBCAP_FUNC_ATTR
cptr_cache_init(struct cptr_cache *cache)
{
int i;
unsigned long *bmap;
......@@ -56,7 +70,9 @@ int cptr_cache_init(struct cptr_cache *cache)
return 0;
}
void cptr_cache_destroy(struct cptr_cache *cache)
void
LIBCAP_FUNC_ATTR
cptr_cache_destroy(struct cptr_cache *cache)
{
/* No-op for now */
}
......@@ -81,7 +97,9 @@ static int __cap_alloc_cptr_from_bmap(unsigned long *bmap, int size,
return 1; /* signal we are done */
}
int cptr_alloc(struct cptr_cache *cptr_cache, cptr_t *free_cptr)
int
LIBCAP_FUNC_ATTR
cptr_alloc(struct cptr_cache *cptr_cache, cptr_t *free_cptr)
{
int ret;
int depth;
......@@ -133,7 +151,9 @@ unlock:
return ret;
}
void cptr_free(struct cptr_cache *cptr_cache, cptr_t c)
void
LIBCAP_FUNC_ATTR
cptr_free(struct cptr_cache *cptr_cache, cptr_t c)
{
unsigned long *bmap;
unsigned long bmap_idx;
......
......@@ -3,9 +3,18 @@
*
* Copyright: University of Utah
*/
#ifdef LCD_DOMAINS
#include <lcd_config/pre_hook.h>
#endif
#include <libcap.h>
#include <libcap_internal.h>
#ifdef LCD_DOMAINS
#include <lcd_config/post_hook.h>
#endif
#define CAP_TYPE_NUM_BUILTIN CAP_TYPE_FIRST_NONBUILTIN
static struct cap_type_ops builtin_cap_types[CAP_TYPE_NUM_BUILTIN] = {
......@@ -15,7 +24,9 @@ static struct cap_type_ops builtin_cap_types[CAP_TYPE_NUM_BUILTIN] = {
{"cnode", NULL, NULL},
};
int cap_type_system_alloc(struct cap_type_system **ts)
int
LIBCAP_FUNC_ATTR
cap_type_system_alloc(struct cap_type_system **ts)
{
*ts = cap_zalloc(1, sizeof(**ts));
if (!*ts)
......@@ -23,7 +34,9 @@ int cap_type_system_alloc(struct cap_type_system **ts)
return 0;
}
int cap_type_system_init(struct cap_type_system *ts)
int
LIBCAP_FUNC_ATTR
cap_type_system_init(struct cap_type_system *ts)
{
int i;
/*
......@@ -48,7 +61,9 @@ int cap_type_system_init(struct cap_type_system *ts)
return 0;
}
void cap_type_system_destroy(struct cap_type_system *ts)
void
LIBCAP_FUNC_ATTR
cap_type_system_destroy(struct cap_type_system *ts)
{
int i;
/*
......@@ -59,12 +74,16 @@ void cap_type_system_destroy(struct cap_type_system *ts)
free(ts->types[i].name);
}
void cap_type_system_free(struct cap_type_system *ts)
void
LIBCAP_FUNC_ATTR
cap_type_system_free(struct cap_type_system *ts)
{
cap_free(ts);
}
cap_type_t cap_register_private_type(struct cap_type_system *ts,
cap_type_t
LIBCAP_FUNC_ATTR
cap_register_private_type(struct cap_type_system *ts,
cap_type_t type, const struct cap_type_ops *ops)
{
int i, ret;
......
......@@ -17,6 +17,10 @@
#include <libcap_types.h>
#include <libcap_platform_types.h>
#ifndef LIBCAP_FUNC_ATTR
#define LIBCAP_FUNC_ATTR
#endif
/* DEBUGGING ---------------------------------------- */
/* For now, put debug macros in the user-accessible part; convenient. */
......
......@@ -25,7 +25,7 @@
* We wrap it inside a struct def so that the compiler will do strong
* type checking.
*/
typedef struct {
typedef struct cptr {
unsigned long cptr;
} cptr_t;
......@@ -39,6 +39,10 @@ typedef struct {
/* CPTR CACHEs -------------------------------------------------- */
#ifndef CPTR_CACHE_LOCK_PADDING_SIZE
#define CPTR_CACHE_LOCK_PADDING_SIZE 0
#endif
/*
* NOTE: This is part of the public interface so that it can be
* allocated statically (e.g., as a global). This is needed for
......@@ -50,6 +54,10 @@ struct cptr_cache {
* lock
*/
cap_mutex_t lock;
/*
* Padding
*/
char lock_padding[CPTR_CACHE_LOCK_PADDING_SIZE];
/*
* bmaps
*
......
......@@ -11,11 +11,19 @@
# This single line of magic makes it so we can do an out of src tree
# build. It has to do with how and where this Kbuild file is included
# in the kernel build system.
src = @abs_top_srcdir@/src/platform/kernel
src = @abs_top_srcdir@/src
# This needs to be inside here because the kernel build system forces gcc
# otherwise.
export CC=@CC@
# Sources that make up library
lib-y += \
$(COMMON_SRCS:.c=.o)
# Pass along include directories from the Automake file
ccflags-y += $(AM_CPPFLAGS)
ccflags-y += $(CFLAGS) $(AM_CPPFLAGS)
# Provide option to filter out some kbuild cflags (this is needed for
# clang builds).
KBUILD_CFLAGS := $(filter-out $(LIBCAP_BAD_CFLAGS), $(KBUILD_CFLAGS))
\ No newline at end of file
......@@ -18,14 +18,15 @@ AM_CPPFLAGS = \
$(KERNEL_INCLUDES) \
$(GLIB_INCLUDES)
COMMON_SRCS = \
../../common/cap.c \
../../common/cptr_cache.c \
../../common/type_system.c
common/cap.c \
common/cptr_cache.c \
common/type_system.c
export AM_CPPFLAGS COMMON_SRCS
LIBCAP_KBUILD=$(PWD)
LIBCAP_KBUILD=@abs_top_builddir@/src
LIBCAP_KERNEL_MODULE_KBUILD=$(PWD)/module
# Automake if's aren't as powerful as GNU Make's (partly since Automake
......@@ -51,7 +52,7 @@ all-module: all-lib-cp
$(MAKE) -C $(KDIR) M=$(LIBCAP_KERNEL_MODULE_KBUILD) modules
all-lib-cp: all-lib
cp lib.a libcap.a
cp $(LIBCAP_KBUILD)/lib.a $(LIBCAP_KBUILD)/libcap.a
all-lib:
$(MAKE) -C $(KDIR) M=$(LIBCAP_KBUILD)
......@@ -64,7 +65,7 @@ install-libcap-module: install-setup-dir
cp module/libcap.ko $(DESTDIR)$(libdir)
install-libcap: install-setup-dir
cp libcap.a $(DESTDIR)$(libdir)
cp $(LIBCAP_KBUILD)/libcap.a $(DESTDIR)$(libdir)
install-setup-dir:
$(MKDIR_P) $(DESTDIR)$(libdir)
......@@ -82,7 +83,7 @@ clean-module:
clean-lib:
$(MAKE) -C $(KDIR) M=$(LIBCAP_KBUILD) clean
rm -f libcap.a
rm -f $(LIBCAP_KBUILD)/libcap.a
.PHONY: all-module all-lib all-lib-cp do-modules-install modules_install \
clean-module clean-lib install-headers uninstall-headers \
......
......@@ -39,7 +39,7 @@ static inline int __cap_mutex_lock(cap_mutex_t *mutex)
static inline int __cap_mutex_trylock(cap_mutex_t *mutex)
{
return !mutex_trylock(mutex);
return mutex_trylock(mutex);
}
static inline int __cap_mutex_lock_interruptible(cap_mutex_t *mutex)
......
......@@ -15,10 +15,10 @@ src = @abs_top_srcdir@/src/platform/kernel/module
obj-m = libcap.o
# Sources that make up module
libcap-objs += main.o
libcap-objs += main.o
# Link with libcap.a
libcap-objs += ../libcap.a
libcap-objs += ../../../libcap.a
# Pass along include directories from the Automake file
ccflags-y += $(AM_CPPFLAGS)
......@@ -23,4 +23,4 @@ static void __exit cap_fini_module(void)
module_init(cap_init_module);
module_exit(cap_fini_module);
MODULE_LICENSE("GPLv2");
MODULE_LICENSE("GPL");