Changeset View
Changeset View
Standalone View
Standalone View
head/sys/compat/linuxkpi/common/include/linux/ww_mutex.h
Show First 20 Lines • Show All 70 Lines • ▼ Show 20 Lines | #define ww_mutex_lock_slow_interruptible(_m, _x) \ | ||||
ww_mutex_lock_interruptible(_m, _x) | ww_mutex_lock_interruptible(_m, _x) | ||||
static inline int __must_check | static inline int __must_check | ||||
ww_mutex_trylock(struct ww_mutex *lock) | ww_mutex_trylock(struct ww_mutex *lock) | ||||
{ | { | ||||
return (mutex_trylock(&lock->base)); | return (mutex_trylock(&lock->base)); | ||||
} | } | ||||
extern int linux_ww_mutex_lock_sub(struct ww_mutex *, int catch_signal); | extern int linux_ww_mutex_lock_sub(struct ww_mutex *, | ||||
struct ww_acquire_ctx *, int catch_signal); | |||||
static inline int | static inline int | ||||
ww_mutex_lock(struct ww_mutex *lock, struct ww_acquire_ctx *ctx) | ww_mutex_lock(struct ww_mutex *lock, struct ww_acquire_ctx *ctx) | ||||
{ | { | ||||
if (MUTEX_SKIP()) | if (MUTEX_SKIP()) | ||||
return (0); | return (0); | ||||
else if ((struct thread *)SX_OWNER(lock->base.sx.sx_lock) == curthread) | else if ((struct thread *)SX_OWNER(lock->base.sx.sx_lock) == curthread) | ||||
return (-EALREADY); | return (-EALREADY); | ||||
else | else | ||||
return (linux_ww_mutex_lock_sub(lock, 0)); | return (linux_ww_mutex_lock_sub(lock, ctx, 0)); | ||||
} | } | ||||
static inline int | static inline int | ||||
ww_mutex_lock_interruptible(struct ww_mutex *lock, struct ww_acquire_ctx *ctx) | ww_mutex_lock_interruptible(struct ww_mutex *lock, struct ww_acquire_ctx *ctx) | ||||
{ | { | ||||
if (MUTEX_SKIP()) | if (MUTEX_SKIP()) | ||||
return (0); | return (0); | ||||
else if ((struct thread *)SX_OWNER(lock->base.sx.sx_lock) == curthread) | else if ((struct thread *)SX_OWNER(lock->base.sx.sx_lock) == curthread) | ||||
return (-EALREADY); | return (-EALREADY); | ||||
else | else | ||||
return (linux_ww_mutex_lock_sub(lock, 1)); | return (linux_ww_mutex_lock_sub(lock, ctx, 1)); | ||||
} | } | ||||
extern void linux_ww_mutex_unlock_sub(struct ww_mutex *); | extern void linux_ww_mutex_unlock_sub(struct ww_mutex *); | ||||
static inline void | static inline void | ||||
ww_mutex_unlock(struct ww_mutex *lock) | ww_mutex_unlock(struct ww_mutex *lock) | ||||
{ | { | ||||
if (MUTEX_SKIP()) | if (MUTEX_SKIP()) | ||||
Show All 35 Lines |