fifo.h (8fe826f90aad4ea314d0acdf7425a9bf2324e17f) fifo.h (a10195764901e0a41e64d596de57a957e7f982f0)
1/* SPDX-License-Identifier: GPL-2.0 */
2#ifndef _BCACHEFS_FIFO_H
3#define _BCACHEFS_FIFO_H
4
5#include "util.h"
6
7#define FIFO(type) \
8struct { \

--- 51 unchanged lines hidden (view full) ---

60#define fifo_peek_back(fifo) ((fifo)->data[((fifo)->back - 1) & (fifo)->mask])
61
62#define fifo_entry_idx_abs(fifo, p) \
63 ((((p) >= &fifo_peek_front(fifo) \
64 ? (fifo)->front : (fifo)->back) & ~(fifo)->mask) + \
65 (((p) - (fifo)->data)))
66
67#define fifo_entry_idx(fifo, p) (((p) - &fifo_peek_front(fifo)) & (fifo)->mask)
1/* SPDX-License-Identifier: GPL-2.0 */
2#ifndef _BCACHEFS_FIFO_H
3#define _BCACHEFS_FIFO_H
4
5#include "util.h"
6
7#define FIFO(type) \
8struct { \

--- 51 unchanged lines hidden (view full) ---

60#define fifo_peek_back(fifo) ((fifo)->data[((fifo)->back - 1) & (fifo)->mask])
61
62#define fifo_entry_idx_abs(fifo, p) \
63 ((((p) >= &fifo_peek_front(fifo) \
64 ? (fifo)->front : (fifo)->back) & ~(fifo)->mask) + \
65 (((p) - (fifo)->data)))
66
67#define fifo_entry_idx(fifo, p) (((p) - &fifo_peek_front(fifo)) & (fifo)->mask)
68#define fifo_idx_entry(fifo, i) (fifo)->data[((fifo)->front + (i)) & (fifo)->mask]
68#define fifo_idx_entry(fifo, i) ((fifo)->data[((fifo)->front + (i)) & (fifo)->mask])
69
70#define fifo_push_back_ref(f) \
71 (fifo_full((f)) ? NULL : &(f)->data[(f)->back++ & (f)->mask])
72
73#define fifo_push_front_ref(f) \
74 (fifo_full((f)) ? NULL : &(f)->data[--(f)->front & (f)->mask])
75
76#define fifo_push_back(fifo, new) \

--- 51 unchanged lines hidden ---
69
70#define fifo_push_back_ref(f) \
71 (fifo_full((f)) ? NULL : &(f)->data[(f)->back++ & (f)->mask])
72
73#define fifo_push_front_ref(f) \
74 (fifo_full((f)) ? NULL : &(f)->data[--(f)->front & (f)->mask])
75
76#define fifo_push_back(fifo, new) \

--- 51 unchanged lines hidden ---