Merge pull request #27 from yshui/master

Fix building on musl
This commit is contained in:
koverstreet 2020-05-05 16:25:43 -04:00 committed by GitHub
commit 06c81e31b5
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
5 changed files with 14 additions and 2 deletions

View File

@ -22,7 +22,7 @@ static inline void *kmalloc(size_t size, gfp_t flags)
p = size
? aligned_alloc(min(rounddown_pow_of_two(size),
PAGE_SIZE), size)
(size_t)PAGE_SIZE), size)
: malloc(0);
if (p && (flags & __GFP_ZERO))
memset(p, 0, size);

View File

@ -179,6 +179,7 @@
#undef pr_fmt
#define pr_fmt(fmt) "bcachefs: %s() " fmt "\n", __func__
#include <linux/stddef.h>
#include <linux/bug.h>
#include <linux/bio.h>
#include <linux/closure.h>

View File

@ -72,6 +72,7 @@
* inode number, 64 bit offset, 96 bit version field, etc.) for negligible cost.
*/
#include <linux/stddef.h>
#include <asm/types.h>
#include <asm/byteorder.h>
#include <linux/kernel.h>

View File

@ -44,6 +44,7 @@
* https://131002.net/siphash/
*/
#include <linux/stddef.h>
#include <asm/byteorder.h>
#include <asm/unaligned.h>
#include <linux/bitops.h>

View File

@ -15,7 +15,16 @@
* correct to instead guarantee mutual exclusion for the critical sections.
*/
static pthread_mutex_t preempt_lock = PTHREAD_RECURSIVE_MUTEX_INITIALIZER_NP;
static pthread_mutex_t preempt_lock;
__attribute__((constructor))
static void preempt_init(void) {
pthread_mutexattr_t attr;
pthread_mutexattr_init(&attr);
pthread_mutexattr_settype(&attr, PTHREAD_MUTEX_RECURSIVE);
pthread_mutex_init(&preempt_lock, &attr);
pthread_mutexattr_destroy(&attr);
}
void preempt_disable(void)
{