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.
This commit is contained in:
@@ -21,14 +21,13 @@ void
|
|||||||
mtx_init(struct mtx *mutex, const char *name, const char *type,
|
mtx_init(struct mtx *mutex, const char *name, const char *type,
|
||||||
int options)
|
int options)
|
||||||
{
|
{
|
||||||
if (options & MTX_DEF) {
|
if (options & MTX_RECURSE) {
|
||||||
mutex_init_etc(&mutex->u.mutex.lock, name, MUTEX_FLAG_CLONE_NAME);
|
|
||||||
mutex->u.mutex.owner = -1;
|
|
||||||
} else if (options & MTX_RECURSE) {
|
|
||||||
recursive_lock_init_etc(&mutex->u.recursive, name,
|
recursive_lock_init_etc(&mutex->u.recursive, name,
|
||||||
MUTEX_FLAG_CLONE_NAME);
|
MUTEX_FLAG_CLONE_NAME);
|
||||||
} else
|
} else {
|
||||||
panic("fbsd: unsupported mutex type");
|
mutex_init_etc(&mutex->u.mutex.lock, name, MUTEX_FLAG_CLONE_NAME);
|
||||||
|
mutex->u.mutex.owner = -1;
|
||||||
|
}
|
||||||
|
|
||||||
mutex->type = options;
|
mutex->type = options;
|
||||||
}
|
}
|
||||||
@@ -37,10 +36,10 @@ mtx_init(struct mtx *mutex, const char *name, const char *type,
|
|||||||
void
|
void
|
||||||
mtx_destroy(struct mtx *mutex)
|
mtx_destroy(struct mtx *mutex)
|
||||||
{
|
{
|
||||||
if (mutex->type & MTX_DEF)
|
if (mutex->type & MTX_RECURSE)
|
||||||
mutex_destroy(&mutex->u.mutex.lock);
|
|
||||||
else if (mutex->type & MTX_RECURSE)
|
|
||||||
recursive_lock_destroy(&mutex->u.recursive);
|
recursive_lock_destroy(&mutex->u.recursive);
|
||||||
|
else
|
||||||
|
mutex_destroy(&mutex->u.mutex.lock);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user