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" 177b1b5d19SPaolo Bonzini 1815a849beSLaszlo Ersek /* Inclusive upper bound on the size of any flattened range. This is a safety 1915a849beSLaszlo Ersek * (= anti-annoyance) measure; wrong ranges should not cause long startup 2015a849beSLaszlo Ersek * delays nor exhaust virtual memory. 2115a849beSLaszlo Ersek */ 2215a849beSLaszlo Ersek #define OPTS_VISITOR_RANGE_MAX 65536 2315a849beSLaszlo Ersek 247b1b5d19SPaolo Bonzini typedef struct OptsVisitor OptsVisitor; 257b1b5d19SPaolo Bonzini 267b1b5d19SPaolo Bonzini /* Contrarily to qemu-option.c::parse_option_number(), OptsVisitor's "int" 277b1b5d19SPaolo Bonzini * parser relies on strtoll() instead of strtoull(). Consequences: 287b1b5d19SPaolo Bonzini * - string representations of negative numbers yield negative values, 297b1b5d19SPaolo Bonzini * - values below INT64_MIN or LLONG_MIN are rejected, 307b1b5d19SPaolo Bonzini * - values above INT64_MAX or LLONG_MAX are rejected. 31adfb264cSEric Blake * 32adfb264cSEric Blake * The Opts input visitor does not implement support for visiting QAPI 333bc97fd5SEric Blake * alternates, numbers (other than integers), null, or arbitrary 34d9f62ddeSEric Blake * QTypes. It also requires a non-null list argument to 35d9f62ddeSEric Blake * visit_start_list(). 367b1b5d19SPaolo Bonzini */ 37*09204eacSEric Blake Visitor *opts_visitor_new(const QemuOpts *opts); 387b1b5d19SPaolo Bonzini 397b1b5d19SPaolo Bonzini #endif 40