|
From: | Anthony Liguori |
Subject: | [Qemu-devel] Re: [PATCH v7 2/6] char: Add a QemuChrHandlers struct to initialise chardev handlers |
Date: | Wed, 05 May 2010 08:59:22 -0500 |
User-agent: | Mozilla/5.0 (X11; U; Linux x86_64; en-US; rv:1.9.1.5) Gecko/20091209 Fedora/3.0-4.fc12 Lightning/1.0pre Thunderbird/3.0 |
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<address@hidden>- 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
[Prev in Thread] | Current Thread | [Next in Thread] |