Laszlo Ersek | eb7ee2c | 2012-07-17 16:17:09 +0200 | [diff] [blame] | 1 | /* |
| 2 | * Options Visitor |
| 3 | * |
| 4 | * Copyright Red Hat, Inc. 2012 |
| 5 | * |
| 6 | * Author: Laszlo Ersek <lersek@redhat.com> |
| 7 | * |
| 8 | * This work is licensed under the terms of the GNU LGPL, version 2.1 or later. |
| 9 | * See the COPYING.LIB file in the top-level directory. |
| 10 | * |
| 11 | */ |
| 12 | |
| 13 | #ifndef OPTS_VISITOR_H |
| 14 | #define OPTS_VISITOR_H |
| 15 | |
Paolo Bonzini | 7b1b5d1 | 2012-12-17 18:19:43 +0100 | [diff] [blame] | 16 | #include "qapi/visitor.h" |
Laszlo Ersek | eb7ee2c | 2012-07-17 16:17:09 +0200 | [diff] [blame] | 17 | |
Laszlo Ersek | 15a849b | 2013-08-20 00:35:38 +0200 | [diff] [blame] | 18 | /* Inclusive upper bound on the size of any flattened range. This is a safety |
| 19 | * (= anti-annoyance) measure; wrong ranges should not cause long startup |
| 20 | * delays nor exhaust virtual memory. |
| 21 | */ |
| 22 | #define OPTS_VISITOR_RANGE_MAX 65536 |
| 23 | |
Laszlo Ersek | eb7ee2c | 2012-07-17 16:17:09 +0200 | [diff] [blame] | 24 | typedef struct OptsVisitor OptsVisitor; |
| 25 | |
| 26 | /* Contrarily to qemu-option.c::parse_option_number(), OptsVisitor's "int" |
| 27 | * parser relies on strtoll() instead of strtoull(). Consequences: |
| 28 | * - string representations of negative numbers yield negative values, |
| 29 | * - values below INT64_MIN or LLONG_MIN are rejected, |
| 30 | * - values above INT64_MAX or LLONG_MAX are rejected. |
Eric Blake | adfb264 | 2016-04-28 15:45:20 -0600 | [diff] [blame] | 31 | * |
| 32 | * The Opts input visitor does not implement support for visiting QAPI |
Eric Blake | 3bc97fd | 2016-04-28 15:45:22 -0600 | [diff] [blame] | 33 | * alternates, numbers (other than integers), null, or arbitrary |
Eric Blake | d9f62dd | 2016-04-28 15:45:31 -0600 | [diff] [blame] | 34 | * QTypes. It also requires a non-null list argument to |
| 35 | * visit_start_list(). |
Laszlo Ersek | eb7ee2c | 2012-07-17 16:17:09 +0200 | [diff] [blame] | 36 | */ |
Eric Blake | 09204ea | 2016-06-09 10:48:36 -0600 | [diff] [blame] | 37 | Visitor *opts_visitor_new(const QemuOpts *opts); |
Laszlo Ersek | eb7ee2c | 2012-07-17 16:17:09 +0200 | [diff] [blame] | 38 | |
| 39 | #endif |