Lines Matching defs:seqlock
1 /* $NetBSD: seqlock.h,v 1.5 2021/12/19 01:50:10 riastradh Exp $ */
131 struct seqlock {
136 typedef struct seqlock seqlock_t;
139 seqlock_init(struct seqlock *seqlock)
142 mutex_init(&seqlock->sql_lock, MUTEX_DEFAULT, IPL_VM);
143 seqcount_init(&seqlock->sql_count);
147 seqlock_destroy(struct seqlock *seqlock)
150 seqcount_destroy(&seqlock->sql_count);
151 mutex_destroy(&seqlock->sql_lock);
155 write_seqlock(struct seqlock *seqlock)
158 mutex_spin_enter(&seqlock->sql_lock);
159 write_seqcount_begin(&seqlock->sql_count);
163 write_sequnlock(struct seqlock *seqlock)
166 write_seqcount_end(&seqlock->sql_count);
167 mutex_spin_exit(&seqlock->sql_lock);
170 #define write_seqlock_irqsave(SEQLOCK, FLAGS) do { \
172 write_seqlock(SEQLOCK); \
175 #define write_sequnlock_irqrestore(SEQLOCK, FLAGS) do { \
176 write_sequnlock(SEQLOCK); \
181 read_seqbegin(const struct seqlock *seqlock)
184 return read_seqcount_begin(&seqlock->sql_count);
188 read_seqretry(const struct seqlock *seqlock, unsigned gen)
191 return read_seqcount_retry(&seqlock->sql_count, gen);