lkml.org 
[lkml]   [2009]   [Dec]   [27]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
Patch in this message
/
From
Subject[PATCH] [5/6] kfifo: Add kfifo_initialized
Date

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: Andi Kleen <ak@linux.intel.com>

---
include/linux/kfifo.h | 10 ++++++++++
1 file changed, 10 insertions(+)

Index: linux/include/linux/kfifo.h
===================================================================
--- linux.orig/include/linux/kfifo.h
+++ linux/include/linux/kfifo.h
@@ -117,6 +117,16 @@ extern __must_check unsigned int kfifo_o
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

\
 
 \ /
  Last update: 2009-12-27 22:07    [W:0.986 / U:0.096 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site