173bbb75 | 30-Apr-2012 |
Michael Roth <mdroth@linux.vnet.ibm.com> |
qapi: String visitor, use %f representation for floats
Currently string-output-visitor formats floats as %g, which is nice in that trailing 0's are automatically truncated, but otherwise this causes
qapi: String visitor, use %f representation for floats
Currently string-output-visitor formats floats as %g, which is nice in that trailing 0's are automatically truncated, but otherwise this causes some issues:
- it uses 6 significant figures instead of 6 decimal places, which means something like 155777.5 (which even has an exact floating point representation) will be rounded to 155778 when converted to a string.
- output will be presented in scientific notation when the normalized form requires a 10^x multiplier. Not a huge deal, but arguably less readable for command-line arguments.
- due to using scientific notation for numbers requiring more than 6 significant figures, instead of hard-defined decimal places, it fails a lot of the test-visitor-serialization unit tests for floats.
Instead, let's just use %f, which is what the QJSON and the QMP visitors use.
Signed-off-by: Michael Roth <mdroth@linux.vnet.ibm.com> Signed-off-by: Andreas Färber <afaerber@suse.de>
show more ...
|
e38ac962 | 22-Mar-2012 |
Paolo Bonzini <pbonzini@redhat.com> |
qapi: add strict mode to input visitor
While QMP in general is designed so that it is possible to ignore unknown arguments, in the case of the QMP server it is better to reject them to detect bad cl
qapi: add strict mode to input visitor
While QMP in general is designed so that it is possible to ignore unknown arguments, in the case of the QMP server it is better to reject them to detect bad clients. In fact, we're already doing this at the top level in the argument checker. To extend this to complex structures, add a mode to the input visitor where it checks for unvisited keys and raises an error if it finds one.
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com> Signed-off-by: Luiz Capitulino <lcapitulino@redhat.com>
show more ...
|
4faaec6a | 22-Mar-2012 |
Paolo Bonzini <pbonzini@redhat.com> |
qapi: place outermost object on qiv stack
This is a slight change in the implementation of QMPInputVisitor that helps when adding strict mode.
Const QObjects cannot be inc/decref-ed, and that's why
qapi: place outermost object on qiv stack
This is a slight change in the implementation of QMPInputVisitor that helps when adding strict mode.
Const QObjects cannot be inc/decref-ed, and that's why QMPInputVisitor relies heavily on weak references to inner objects. I'm not removing the weak references now, but since refcount+const is a lost battle in C (C++ has "mutable") I think removing const is fine in this case.
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com> Reviewed-by: Anthony Liguori <aliguori@us.ibm.com> Signed-off-by: Luiz Capitulino <lcapitulino@redhat.com>
show more ...
|
3a86a0fa | 22-Mar-2012 |
Paolo Bonzini <pbonzini@redhat.com> |
qapi: untangle next_list
Right now, the semantics of next_list are complicated. The caller must:
* call start_list
* call next_list for each element *including the first*
* on the first call to
qapi: untangle next_list
Right now, the semantics of next_list are complicated. The caller must:
* call start_list
* call next_list for each element *including the first*
* on the first call to next_list, the second argument should point to NULL and the result is the head of the list. On subsequent calls, the second argument should point to the last node (last result of next_list) and next_list itself tacks the element at the tail of the list.
This works for both input and output visitor, but having the visitor write memory when it is only reading the list is ugly. Plus, relying on *list to detect the first call is tricky and undocumented.
We can initialize so->entry in next_list instead of start_list, leaving it NULL in start_list. This way next_list sees clearly whether it is on the first call---as a bonus, it discriminates the cases based on internal state of the visitor rather than external state. We can also pull the assignment of the list head from generated code up to next_list.
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com> Reviewed-by: Michael Roth <mdroth@linux.vnet.ibm.com> Signed-off-by: Luiz Capitulino <lcapitulino@redhat.com>
show more ...
|
8b714d37 | 22-Mar-2012 |
Paolo Bonzini <pbonzini@redhat.com> |
qapi: fix memory leak on error
QmpInputVisitor would leak the malloced struct if the stack was overflowed. This can be easily fixed using error_propagate.
Signed-off-by: Paolo Bonzini <pbonzini@re
qapi: fix memory leak on error
QmpInputVisitor would leak the malloced struct if the stack was overflowed. This can be easily fixed using error_propagate.
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com> Reviewed-by: Anthony Liguori <aliguori@us.ibm.com> Signed-off-by: Luiz Capitulino <lcapitulino@redhat.com>
show more ...
|
a020f980 | 09-Feb-2012 |
Paolo Bonzini <pbonzini@redhat.com> |
qapi: add string-based visitors
String based visitors provide a consistent interface for parsing strings to C values, as well as consuming C values as strings. They will be used to parse command-lin
qapi: add string-based visitors
String based visitors provide a consistent interface for parsing strings to C values, as well as consuming C values as strings. They will be used to parse command-line options.
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
show more ...
|
bf95c0d5 | 06-Dec-2011 |
Michael Roth <mdroth@linux.vnet.ibm.com> |
guest agent: add supported command list to guest-info RPC
Not that there is blacklisting functionality we can no longer infer the agent's capabilities via version. This patch extends the current gue
guest agent: add supported command list to guest-info RPC
Not that there is blacklisting functionality we can no longer infer the agent's capabilities via version. This patch extends the current guest-info RPC to also return a list of dictionaries containing the name of each supported RPC, along with a boolean indicating whether or not the command has been disabled by a guest administrator/distro.
Signed-off-by: Michael Roth <mdroth@linux.vnet.ibm.com> Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
show more ...
|
e1bc2f7b | 19-Sep-2011 |
Michael Roth <mdroth@linux.vnet.ibm.com> |
qapi: modify visitor code generation for list iteration
Modify logic such that we never assign values to the list head argument to progress through the list on subsequent iterations, instead rely on
qapi: modify visitor code generation for list iteration
Modify logic such that we never assign values to the list head argument to progress through the list on subsequent iterations, instead rely only on having our return value passed back in as an argument on the next call. Also update QMP I/O visitors and test cases accordingly, and add a missing test case for QmpOutputVisitor.
Reviewed-by: Anthony Liguori <aliguori@us.ibm.com> Signed-off-by: Michael Roth <mdroth@linux.vnet.ibm.com> Signed-off-by: Luiz Capitulino <lcapitulino@redhat.com>
show more ...
|