diff options
| author | Jean-Sébastien Pédron <dumbbell@FreeBSD.org> | 2025-08-12 21:55:04 +0000 |
|---|---|---|
| committer | Jean-Sébastien Pédron <dumbbell@FreeBSD.org> | 2026-01-07 21:38:36 +0000 |
| commit | ac341353a0434408eec6388f3451be8517252c5f (patch) | |
| tree | 32acb8342fdb657d6cfcdf4fe581bc15b91ce26d | |
| parent | 14d93f612f26f4e8454e393b75b0e4be0fc9d890 (diff) | |
| -rw-r--r-- | sys/compat/linuxkpi/common/include/linux/spinlock.h | 20 |
1 files changed, 20 insertions, 0 deletions
diff --git a/sys/compat/linuxkpi/common/include/linux/spinlock.h b/sys/compat/linuxkpi/common/include/linux/spinlock.h index dc10b0457153..341e89b6feed 100644 --- a/sys/compat/linuxkpi/common/include/linux/spinlock.h +++ b/sys/compat/linuxkpi/common/include/linux/spinlock.h @@ -178,4 +178,24 @@ _atomic_dec_and_lock_irqsave(atomic_t *cnt, spinlock_t *lock, return (0); } +/* + * struct raw_spinlock + */ + +typedef struct raw_spinlock { + struct mtx lock; +} raw_spinlock_t; + +#define raw_spin_lock_init(rlock) \ + mtx_init(&(rlock)->lock, spin_lock_name("lnxspin_raw"), \ + NULL, MTX_DEF | MTX_NOWITNESS | MTX_NEW) + +#define raw_spin_lock(rl) spin_lock(&(rl)->lock) +#define raw_spin_trylock(rl) spin_trylock(&(rl)->lock) +#define raw_spin_unlock(rl) spin_unlock(&(rl)->lock) + +#define raw_spin_lock_irqsave(rl, f) spin_lock_irqsave(&(rl)->lock, (f)) +#define raw_spin_trylock_irqsave(rl, f) spin_trylock_irqsave(&(rl)->lock, (f)) +#define raw_spin_unlock_irqrestore(rl, f) spin_unlock_irqrestore(&(rl)->lock, (f)) + #endif /* _LINUXKPI_LINUX_SPINLOCK_H_ */ |
