X-Git-Url: https://git.kernel.dk/?p=fio.git;a=blobdiff_plain;f=fifo.h;h=749136530a2c5410867f10caf672c155949daa2f;hp=cfacea996f0309b323b93b67a79f1b89d555dd2b;hb=169d40efb669f8d70a4f8df0c4fdcc2c30b76613;hpb=38470f85fa4acddab4339db9c8805a19bc87578e diff --git a/fifo.h b/fifo.h index cfacea99..74913653 100644 --- a/fifo.h +++ b/fifo.h @@ -35,15 +35,24 @@ static inline unsigned int fifo_len(struct fifo *fifo) return fifo->in - fifo->out; } +static inline unsigned int fifo_room(struct fifo *fifo) +{ + return fifo->size - fifo->in + fifo->out; +} + +#ifndef min #define min(x,y) ({ \ typeof(x) _x = (x); \ typeof(y) _y = (y); \ (void) (&_x == &_y); \ _x < _y ? _x : _y; }) +#endif +#ifndef max #define max(x,y) ({ \ typeof(x) _x = (x); \ typeof(y) _y = (y); \ (void) (&_x == &_y); \ _x > _y ? _x : _y; }) +#endif