]> git.proxmox.com Git - qemu.git/commit
Type-safe ioport callbacks
authorAvi Kivity <avi@redhat.com>
Wed, 17 Nov 2010 09:50:09 +0000 (11:50 +0200)
committerAnthony Liguori <aliguori@us.ibm.com>
Sun, 21 Nov 2010 15:16:57 +0000 (09:16 -0600)
commitacd1c812b5548c8426e093075362b6d4119db6ac
tree0cc07f3a9b3d7dbeb29c95d4e56754a8d4a77afa
parent94b0b5ff5f5c3ab946fa926d464738edb3713ed4
Type-safe ioport callbacks

The current ioport callbacks are not type-safe, in that they accept an "opaque"
pointer as an argument whose type must match the argument to the registration
function; this is not checked by the compiler.

This patch adds an alternative that is type-safe.  Instead of an opaque
argument, both registation and the callback use a new IOPort type.  The
callback then uses container_of() to access its main structures.

Currently the old and new methods exist side by side; once the old way is gone,
we can also save a bunch of memory since the new method requires one pointer
per ioport instead of 6.

Acked-by: Anthony Liguori <aliguori@us.ibm.com>
Signed-off-by: Avi Kivity <avi@redhat.com>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
ioport.c
ioport.h
iorange.h [new file with mode: 0644]