提交 d994ffc2 编写于 作者: A Andi Kleen 提交者: Linus Torvalds

kfifo: add kfifo_initialized

Simple inline that checks if kfifo_init() has been executed on a fifo.

This is useful for walking all per CPU fifos, when some of them might not
have been brought up yet.
Signed-off-by: NAndi Kleen <ak@linux.intel.com>
Acked-by: NStefani Seibold <stefani@seibold.net>
Cc: Roland Dreier <rdreier@cisco.com>
Cc: Dmitry Torokhov <dmitry.torokhov@gmail.com>
Cc: Andy Walls <awalls@radix.net>
Cc: Vikram Dhillon <dhillonv10@gmail.com>
Signed-off-by: NAndrew Morton <akpm@linux-foundation.org>
Signed-off-by: NLinus Torvalds <torvalds@linux-foundation.org>
上级 a5b9e2c1
......@@ -116,6 +116,16 @@ extern __must_check unsigned int kfifo_out(struct kfifo *fifo,
extern __must_check unsigned int kfifo_out_peek(struct kfifo *fifo,
void *to, unsigned int len, unsigned offset);
/**
* kfifo_initialized - Check if kfifo is initialized.
* @fifo: fifo to check
* Return %true if FIFO is initialized, otherwise %false.
* Assumes the fifo was 0 before.
*/
static inline bool kfifo_initialized(struct kfifo *fifo)
{
return fifo->buffer != 0;
}
/**
* kfifo_reset - removes the entire FIFO contents
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册