xref: /openbmc/qemu/include/qapi/opts-visitor.h (revision 09204eac)
17b1b5d19SPaolo Bonzini /*
27b1b5d19SPaolo Bonzini  * Options Visitor
37b1b5d19SPaolo Bonzini  *
47b1b5d19SPaolo Bonzini  * Copyright Red Hat, Inc. 2012
57b1b5d19SPaolo Bonzini  *
67b1b5d19SPaolo Bonzini  * Author: Laszlo Ersek <lersek@redhat.com>
77b1b5d19SPaolo Bonzini  *
87b1b5d19SPaolo Bonzini  * This work is licensed under the terms of the GNU LGPL, version 2.1 or later.
97b1b5d19SPaolo Bonzini  * See the COPYING.LIB file in the top-level directory.
107b1b5d19SPaolo Bonzini  *
117b1b5d19SPaolo Bonzini  */
127b1b5d19SPaolo Bonzini 
137b1b5d19SPaolo Bonzini #ifndef OPTS_VISITOR_H
147b1b5d19SPaolo Bonzini #define OPTS_VISITOR_H
157b1b5d19SPaolo Bonzini 
167b1b5d19SPaolo Bonzini #include "qapi/visitor.h"
171de7afc9SPaolo Bonzini #include "qemu/option.h"
187b1b5d19SPaolo Bonzini 
1915a849beSLaszlo Ersek /* Inclusive upper bound on the size of any flattened range. This is a safety
2015a849beSLaszlo Ersek  * (= anti-annoyance) measure; wrong ranges should not cause long startup
2115a849beSLaszlo Ersek  * delays nor exhaust virtual memory.
2215a849beSLaszlo Ersek  */
2315a849beSLaszlo Ersek #define OPTS_VISITOR_RANGE_MAX 65536
2415a849beSLaszlo Ersek 
257b1b5d19SPaolo Bonzini typedef struct OptsVisitor OptsVisitor;
267b1b5d19SPaolo Bonzini 
277b1b5d19SPaolo Bonzini /* Contrarily to qemu-option.c::parse_option_number(), OptsVisitor's "int"
287b1b5d19SPaolo Bonzini  * parser relies on strtoll() instead of strtoull(). Consequences:
297b1b5d19SPaolo Bonzini  * - string representations of negative numbers yield negative values,
307b1b5d19SPaolo Bonzini  * - values below INT64_MIN or LLONG_MIN are rejected,
317b1b5d19SPaolo Bonzini  * - values above INT64_MAX or LLONG_MAX are rejected.
32adfb264cSEric Blake  *
33adfb264cSEric Blake  * The Opts input visitor does not implement support for visiting QAPI
343bc97fd5SEric Blake  * alternates, numbers (other than integers), null, or arbitrary
35d9f62ddeSEric Blake  * QTypes.  It also requires a non-null list argument to
36d9f62ddeSEric Blake  * visit_start_list().
377b1b5d19SPaolo Bonzini  */
38*09204eacSEric Blake Visitor *opts_visitor_new(const QemuOpts *opts);
397b1b5d19SPaolo Bonzini 
407b1b5d19SPaolo Bonzini #endif
41