From bf4355a48e5a91c42f0bd7cdaa3d242d1d9f27c3 Mon Sep 17 00:00:00 2001 From: Jerome Duval Date: Thu, 10 Jan 2013 23:54:19 +0100 Subject: [PATCH] freebsd network compat layer: fix for hrev45146 * MTX_DEF is the default type: it shouldn't be tested against but used as the default type. --- src/libs/compat/freebsd_network/mutex.c | 17 ++++++++--------- 1 file changed, 8 insertions(+), 9 deletions(-) diff --git a/src/libs/compat/freebsd_network/mutex.c b/src/libs/compat/freebsd_network/mutex.c index 058be108a8..f626b359d9 100644 --- a/src/libs/compat/freebsd_network/mutex.c +++ b/src/libs/compat/freebsd_network/mutex.c @@ -21,14 +21,13 @@ void mtx_init(struct mtx *mutex, const char *name, const char *type, int options) { - if (options & MTX_DEF) { - mutex_init_etc(&mutex->u.mutex.lock, name, MUTEX_FLAG_CLONE_NAME); - mutex->u.mutex.owner = -1; - } else if (options & MTX_RECURSE) { + if (options & MTX_RECURSE) { recursive_lock_init_etc(&mutex->u.recursive, name, MUTEX_FLAG_CLONE_NAME); - } else - panic("fbsd: unsupported mutex type"); + } else { + mutex_init_etc(&mutex->u.mutex.lock, name, MUTEX_FLAG_CLONE_NAME); + mutex->u.mutex.owner = -1; + } mutex->type = options; } @@ -37,10 +36,10 @@ mtx_init(struct mtx *mutex, const char *name, const char *type, void mtx_destroy(struct mtx *mutex) { - if (mutex->type & MTX_DEF) - mutex_destroy(&mutex->u.mutex.lock); - else if (mutex->type & MTX_RECURSE) + if (mutex->type & MTX_RECURSE) recursive_lock_destroy(&mutex->u.recursive); + else + mutex_destroy(&mutex->u.mutex.lock); }