Search Linux Wireless

[PATCH 1/2] compat: backport some more kfifo stuff

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Signed-off-by: Hauke Mehrtens <hauke@xxxxxxxxxx>
---
 include/linux/compat-2.6.33.h |   37 +++++++++++++++++++++++++++++++++++--
 1 files changed, 35 insertions(+), 2 deletions(-)

diff --git a/include/linux/compat-2.6.33.h b/include/linux/compat-2.6.33.h
index e7e20d9..6a7cd3e 100644
--- a/include/linux/compat-2.6.33.h
+++ b/include/linux/compat-2.6.33.h
@@ -94,11 +94,44 @@ int pccard_loop_tuple(struct pcmcia_socket *s, unsigned int function,
 /* Backport for kfifo
  * kfifo_alloc and kfifo_free must be backported manually 
  */
-#define kfifo_in(a, b, c) __kfifo_put(*a, b, c)
-#define kfifo_out(a, b, c) __kfifo_get(*a, b, c)
+#define kfifo_in(a, b, c) __kfifo_put(*a, (unsigned char *)b, c)
+#define kfifo_out(a, b, c) __kfifo_get(*a, (unsigned char *)b, c)
 #define kfifo_len(a) __kfifo_len(*a)
 
 /**
+ * kfifo_is_empty - returns true if the fifo is empty
+ * @fifo: the fifo to be used.
+ */
+static inline __must_check int kfifo_is_empty(struct kfifo **fifo)
+{
+	return (*fifo)->in == (*fifo)->out;
+}
+
+/**
+ * kfifo_size - returns the size of the fifo in bytes
+ * @fifo: the fifo to be used.
+ */
+static inline __must_check unsigned int kfifo_size(struct kfifo *fifo)
+{
+	return fifo->size;
+}
+
+/**
+ * kfifo_is_full - returns true if the fifo is full
+ * @fifo: the fifo to be used.
+ */
+static inline __must_check int kfifo_is_full(struct kfifo **fifo)
+{
+	return kfifo_len(fifo) == kfifo_size(*fifo);
+}
+
+static inline void compat_kfifo_free(struct kfifo **fifo) {
+	if (*fifo)
+		kfifo_free(*fifo);
+}
+#define kfifo_free compat_kfifo_free
+
+/**
  * list_for_each_entry_continue_rcu - continue iteration over list of given type
  * @pos:	the type * to use as a loop cursor.
  * @head:	the head for your list.
-- 
1.7.0.4

--
To unsubscribe from this list: send the line "unsubscribe linux-wireless" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[Index of Archives]     [Linux Host AP]     [ATH6KL]     [Linux Bluetooth]     [Linux Netdev]     [Kernel Newbies]     [Linux Kernel]     [IDE]     [Security]     [Git]     [Netfilter]     [Bugtraq]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux ATA RAID]     [Samba]     [Device Mapper]
  Powered by Linux