Skip to content
  • Paolo Bonzini's avatar
    bc2f4fcb
    qom: move user_creatable_add_opts logic to vl.c and QAPIfy it · bc2f4fcb
    Paolo Bonzini authored
    
    
    Emulators are currently using OptsVisitor (via user_creatable_add_opts)
    to parse the -object command line option.  This has one extra feature,
    compared to keyval, which is automatic conversion of integers to lists
    as well as support for lists as repeated options:
    
      -object memory-backend-ram,id=pc.ram,size=1048576000,host-nodes=0,policy=bind
    
    So we cannot replace OptsVisitor with keyval right now.  Still, this
    patch moves the user_creatable_add_opts logic to vl.c since it is
    not needed anywhere else, and makes it go through user_creatable_add_qapi.
    
    In order to minimize code changes, the predicate still takes a string.
    This can be changed later to use the ObjectType QAPI enum directly.
    
    Reviewed-by: default avatarEric Blake <eblake@redhat.com>
    Signed-off-by: default avatarPaolo Bonzini <pbonzini@redhat.com>
    Message-Id: <20210312173547.1283477-3-pbonzini@redhat.com>
    Reviewed-by: default avatarMarkus Armbruster <armbru@redhat.com>
    Signed-off-by: default avatarKevin Wolf <kwolf@redhat.com>
    bc2f4fcb
    qom: move user_creatable_add_opts logic to vl.c and QAPIfy it
    Paolo Bonzini authored
    
    
    Emulators are currently using OptsVisitor (via user_creatable_add_opts)
    to parse the -object command line option.  This has one extra feature,
    compared to keyval, which is automatic conversion of integers to lists
    as well as support for lists as repeated options:
    
      -object memory-backend-ram,id=pc.ram,size=1048576000,host-nodes=0,policy=bind
    
    So we cannot replace OptsVisitor with keyval right now.  Still, this
    patch moves the user_creatable_add_opts logic to vl.c since it is
    not needed anywhere else, and makes it go through user_creatable_add_qapi.
    
    In order to minimize code changes, the predicate still takes a string.
    This can be changed later to use the ObjectType QAPI enum directly.
    
    Reviewed-by: default avatarEric Blake <eblake@redhat.com>
    Signed-off-by: default avatarPaolo Bonzini <pbonzini@redhat.com>
    Message-Id: <20210312173547.1283477-3-pbonzini@redhat.com>
    Reviewed-by: default avatarMarkus Armbruster <armbru@redhat.com>
    Signed-off-by: default avatarKevin Wolf <kwolf@redhat.com>
Loading