tools/virtio/linux/spinlock.h
Source file repositories/reference/linux-study-clean/tools/virtio/linux/spinlock.h
File Facts
- System
- Linux kernel
- Corpus path
tools/virtio/linux/spinlock.h- Extension
.h- Size
- 935 bytes
- Lines
- 57
- Domain
- Support Tooling And Documentation
- Bucket
- tools
- Inferred role
- Support Tooling And Documentation: implementation source
- Status
- source implementation candidate
Why This File Exists
Repository support layer: documentation, build tooling, samples, user-space helper tools, generated initramfs support, licenses, and validation utilities.
- Repository support layer: documentation, build tooling, samples, user-space helper tools, generated initramfs support, licenses, and validation utilities.
- Uses kernel synchronization; read lock ordering, sleepability, and interrupt context assumptions before translating.
Dependency Surface
pthread.h
Detected Declarations
function spin_lock_initfunction spin_lockfunction spin_unlockfunction spin_lock_bhfunction spin_unlock_bhfunction spin_lock_irqfunction spin_unlock_irqfunction spin_lock_irqsavefunction spin_unlock_irqrestore
Annotated Snippet
#ifndef SPINLOCK_H_STUB
#define SPINLOCK_H_STUB
#include <pthread.h>
typedef pthread_spinlock_t spinlock_t;
static inline void spin_lock_init(spinlock_t *lock)
{
int r = pthread_spin_init(lock, 0);
assert(!r);
}
static inline void spin_lock(spinlock_t *lock)
{
int ret = pthread_spin_lock(lock);
assert(!ret);
}
static inline void spin_unlock(spinlock_t *lock)
{
int ret = pthread_spin_unlock(lock);
assert(!ret);
}
static inline void spin_lock_bh(spinlock_t *lock)
{
spin_lock(lock);
}
static inline void spin_unlock_bh(spinlock_t *lock)
{
spin_unlock(lock);
}
static inline void spin_lock_irq(spinlock_t *lock)
{
spin_lock(lock);
}
static inline void spin_unlock_irq(spinlock_t *lock)
{
spin_unlock(lock);
}
static inline void spin_lock_irqsave(spinlock_t *lock, unsigned long f)
{
spin_lock(lock);
}
static inline void spin_unlock_irqrestore(spinlock_t *lock, unsigned long f)
{
spin_unlock(lock);
}
#endif
Annotation
- Immediate include surface: `pthread.h`.
- Detected declarations: `function spin_lock_init`, `function spin_lock`, `function spin_unlock`, `function spin_lock_bh`, `function spin_unlock_bh`, `function spin_lock_irq`, `function spin_unlock_irq`, `function spin_lock_irqsave`, `function spin_unlock_irqrestore`.
- Atlas domain: Support Tooling And Documentation / tools.
- Implementation status: source implementation candidate.
- Synchronization appears in or near this file; preserve lock ordering, sleepability, and interrupt-context constraints.
Implementation Notes
- This generated page is the file-by-file coverage layer; curated subsystem chapters should link here when they synthesize a multi-file control flow.
- Core OS pages should be promoted from atlas-only to deep-reviewed when they explain data structures, invariants, locking, lifecycle, and C implementation snippets.
- Driver-family pages are intentionally pattern-oriented unless they are part of the selected PCIe/NVMe representative device path.