• A
    Type-safe ioport callbacks · acd1c812
    Avi Kivity 提交于
    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: NAnthony Liguori <aliguori@us.ibm.com>
    Signed-off-by: NAvi Kivity <avi@redhat.com>
    Signed-off-by: NAnthony Liguori <aliguori@us.ibm.com>
    acd1c812
ioport.c 8.8 KB