On 08/01/2011 10:39 AM, Stefan Hajnoczi wrote:
On Mon, Aug 1, 2011 at 3:23 PM, Anthony Liguori<aligu...@us.ibm.com> wrote:
Signed-off-by: Anthony Liguori<aligu...@us.ibm.com>
---
qemu-char.c | 91 +++++++++++++++++++++++++++++++++++++++++++++++++----------
qemu-char.h | 9 ++++++
2 files changed, 85 insertions(+), 15 deletions(-)
diff --git a/qemu-char.c b/qemu-char.c
index 0e4a30c..9e40e04 100644
--- a/qemu-char.c
+++ b/qemu-char.c
@@ -139,13 +139,23 @@ void qemu_chr_generic_open(CharDriverState *s)
}
}
+static uint32_t char_queue_get_avail(CharQueue *q)
+{
+ return sizeof(q->ring) - (q->prod - q->cons);
+}
+
+static bool char_queue_get_empty(CharQueue *q)
+{
+ return (q->cons == q->prod);
+}
bool function naming nitpick: char_queue_is_empty() is clearer than
char_queue_get_empty(). "is" and "has" are always bool, "get" could
return anything.
Ack.
I thought the same thing to myself, meant to rename it, and then
promptly forgot to :-)
Regards,
Anthony Liguori
Stefan