Commit f4297fdb authored by David Johnson's avatar David Johnson

Ugh, move mutex impls into internal headers.

(For now we don't need to abstract mutexes into public libcap.h .)
parent ab9ac0a0
......@@ -11,6 +11,38 @@
#define strdup(str) kstrdup(str,GFP_KERNEL)
/**
* Mutex support.
*/
typedef struct mutex cap_mutex_t;
static inline int __cap_mutex_init(cap_mutex_t *mutex)
{
mutex_init(mutex);
return 0;
}
static inline int __cap_mutex_lock(cap_mutex_t *mutex)
{
mutex_lock(mutex);
return 0;
}
static inline int __cap_mutex_trylock(cap_mutex_t *mutex)
{
return !mutex_trylock(mutex);
}
static inline int __cap_mutex_lock_interruptible(cap_mutex_t *mutex)
{
return mutex_lock_interruptible(mutex);
}
static inline int __cap_mutex_unlock(cap_mutex_t *mutex)
{
mutex_unlock(mutex);
return 0;
}
/**
* Cache support.
*/
......
......@@ -17,6 +17,35 @@
#include <string.h>
#include <errno.h>
/**
* Mutex support. Follow kernel return convention.
*/
typedef pthread_mutex_t cap_mutex_t;
static inline int __cap_mutex_init(cap_mutex_t * mutex)
{
return -pthread_mutex_init(mutex, NULL);
}
static inline int __cap_mutex_lock(cap_mutex_t * mutex)
{
return -pthread_mutex_lock(mutex);
}
static inline int __cap_mutex_trylock(cap_mutex_t * mutex)
{
return -pthread_mutex_trylock(mutex);
}
static inline int __cap_mutex_lock_interruptible(cap_mutex_t * mutex)
{
return -pthread_mutex_lock(mutex);
}
static inline int __cap_mutex_unlock(cap_mutex_t * mutex)
{
return -pthread_mutex_unlock(mutex);
}
/**
* Cache support.
*/
......
......@@ -15,36 +15,4 @@ CAP_BUILD_CORE_TYPES_NOBUILTIN();
#define __cap_debug(format,...) \
printk(KERN_DEBUG,"cap: %s:%d: "format,__FUNCTION__,__LINE__,##__VA_ARGS__)
/**
* Mutex support.
*/
typedef struct mutex cap_mutex_t;
static inline int __cap_mutex_init(cap_mutex_t *mutex)
{
mutex_init(mutex);
return 0;
}
static inline int __cap_mutex_lock(cap_mutex_t *mutex)
{
mutex_lock(mutex);
return 0;
}
static inline int __cap_mutex_trylock(cap_mutex_t *mutex)
{
return !mutex_trylock(mutex);
}
static inline int __cap_mutex_lock_interruptible(cap_mutex_t *mutex)
{
return mutex_lock_interruptible(mutex);
}
static inline int __cap_mutex_unlock(cap_mutex_t *mutex)
{
mutex_unlock(mutex);
return 0;
}
#endif /* __LIBCAP_KERNEL_H__ */
......@@ -15,33 +15,4 @@ CAP_BUILD_CORE_TYPES_NOBUILTIN();
#define __cap_debug(format,...) \
fprintf(stderr,"CDEBUG: %s:%d: "format,__FUNCTION__,__LINE__,## __VA_ARGS__)
/**
* Mutex support. Follow kernel return convention.
*/
typedef pthread_mutex_t cap_mutex_t;
static inline int __cap_mutex_init(cap_mutex_t * mutex)
{
return -pthread_mutex_init(mutex, NULL);
}
static inline int __cap_mutex_lock(cap_mutex_t * mutex)
{
return -pthread_mutex_lock(mutex);
}
static inline int __cap_mutex_trylock(cap_mutex_t * mutex)
{
return -pthread_mutex_trylock(mutex);
}
static inline int __cap_mutex_lock_interruptible(cap_mutex_t * mutex)
{
return -pthread_mutex_lock(mutex);
}
static inline int __cap_mutex_unlock(cap_mutex_t * mutex)
{
return -pthread_mutex_unlock(mutex);
}
#endif /* __LIBCAP_USER_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