On 05/05/2010 08:25 AM, Amit Shah wrote:
On (Wed) May 05 2010 [08:13:58], Anthony Liguori wrote:
On 05/04/2010 04:39 PM, Amit Shah wrote:
Instead of passing each handler in the qemu_add_handlers() function,
create a struct of handlers that can be passed to the function instead.

Signed-off-by: Amit Shah<amit.s...@redhat.com>

-        qemu_chr_add_handlers(chr, gdb_chr_can_receive, gdb_chr_receive,
-                              gdb_chr_event, NULL);
+        qemu_chr_add_handlers(chr,&gdb_handlers, NULL);
       }

This sort of change isn't a bad one but if we're making this change, we
should change the signature of these functions to also take a
QemuChrHandlers *.
What do you mean?

-typedef void IOReadHandler(void *opaque, const uint8_t *buf, int size);
+typedef void IOReadHandler(QemuChrHandlers *handler, const uint8_t *buf, int size);

Then you can embed the structure in the state structure and use container_of to get the state. It's more type safe and it avoids adding a global variable.

Also, let's drop the qemu_ and Qemu prefixes while we're at it.
In a later series, please. -ETOOMANYRESENDS already..

It's part of CODING_STYLE... I think it's important to change the signatures so a new series will be required.

Regards,

Anthony Liguori

                Amit



Reply via email to