Commit 7a890bce authored by David Johnson's avatar David Johnson

Move mutexes into public headers; remove internal include in public.

Because installed versions of this library are used to build other
packages, we cannot include internal headers in public headers.
parent 08d889b3
Pipeline #403 passed with stage
......@@ -79,9 +79,6 @@ extern int cap_debug_level;
/* CPTRs -------------------------------------------------- */
#include "libcap_internal.h" /* temporary hack */
/**
* __cptr -- Construct a cptr from an unsigned long
* @cptr: the unsigned long to use
......
......@@ -12,38 +12,6 @@
#define strdup(str) kstrdup(str,GFP_KERNEL)
#define free(ptr) kfree(ptr)
/**
* 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.
*/
......
......@@ -22,35 +22,6 @@
#include "compat_internal/osx_user.h"
#endif
/**
* 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.
*/
......
......@@ -18,4 +18,36 @@ CAP_BUILD_CORE_TYPES_NOBUILTIN();
#define __cap_bug() BUG()
/**
* 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__ */
......@@ -19,5 +19,34 @@ CAP_BUILD_CORE_TYPES_NOBUILTIN();
#define __cap_bug() \
abort()
/**
* 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