• M
    qapi-types: add C99 index names to arrays · 912ae9c8
    Michael S. Tsirkin 提交于
    It's not easy to figure out how monitor translates
    strings: most QEMU code deals with translated indexes,
    these are translated using _lookup arrays,
    so you need to find the array name, and find the
    appropriate offset.
    
    This patch adds C99 indexes to lookup arrays, which makes it possible to
    find the correct key using simple grep, and see that the matching is
    correct at a glance.
    
    Example:
    
    Before:
    
    const char *MigrationCapability_lookup[] = {
        "xbzrle",
        "rdma-pin-all",
        "auto-converge",
        "zero-blocks",
        NULL,
    };
    
    After:
    
    const char *MigrationCapability_lookup[] = {
        [MIGRATION_CAPABILITY_XBZRLE] = "xbzrle",
        [MIGRATION_CAPABILITY_RDMA_PIN_ALL] = "rdma-pin-all",
        [MIGRATION_CAPABILITY_AUTO_CONVERGE] = "auto-converge",
        [MIGRATION_CAPABILITY_ZERO_BLOCKS] = "zero-blocks",
        [MIGRATION_CAPABILITY_MAX] = NULL,
    };
    Signed-off-by: NMichael S. Tsirkin <mst@redhat.com>
    Reviewed-by: NEric Blake <eblake@redhat.com>
    Signed-off-by: NLuiz Capitulino <lcapitulino@redhat.com>
    912ae9c8
qapi-types.py 11.3 KB