root / qemu-option.h @ 16415335
History | View | Annotate | Download (2.4 kB)
1 | d3f24367 | Kevin Wolf | /*
|
---|---|---|---|
2 | d3f24367 | Kevin Wolf | * Commandline option parsing functions
|
3 | d3f24367 | Kevin Wolf | *
|
4 | d3f24367 | Kevin Wolf | * Copyright (c) 2003-2008 Fabrice Bellard
|
5 | d3f24367 | Kevin Wolf | * Copyright (c) 2009 Kevin Wolf <kwolf@redhat.com>
|
6 | d3f24367 | Kevin Wolf | *
|
7 | d3f24367 | Kevin Wolf | * Permission is hereby granted, free of charge, to any person obtaining a copy
|
8 | d3f24367 | Kevin Wolf | * of this software and associated documentation files (the "Software"), to deal
|
9 | d3f24367 | Kevin Wolf | * in the Software without restriction, including without limitation the rights
|
10 | d3f24367 | Kevin Wolf | * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
11 | d3f24367 | Kevin Wolf | * copies of the Software, and to permit persons to whom the Software is
|
12 | d3f24367 | Kevin Wolf | * furnished to do so, subject to the following conditions:
|
13 | d3f24367 | Kevin Wolf | *
|
14 | d3f24367 | Kevin Wolf | * The above copyright notice and this permission notice shall be included in
|
15 | d3f24367 | Kevin Wolf | * all copies or substantial portions of the Software.
|
16 | d3f24367 | Kevin Wolf | *
|
17 | d3f24367 | Kevin Wolf | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
18 | d3f24367 | Kevin Wolf | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
19 | d3f24367 | Kevin Wolf | * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
|
20 | d3f24367 | Kevin Wolf | * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
21 | d3f24367 | Kevin Wolf | * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
22 | d3f24367 | Kevin Wolf | * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
23 | d3f24367 | Kevin Wolf | * THE SOFTWARE.
|
24 | d3f24367 | Kevin Wolf | */
|
25 | d3f24367 | Kevin Wolf | |
26 | d3f24367 | Kevin Wolf | #ifndef QEMU_OPTIONS_H
|
27 | d3f24367 | Kevin Wolf | #define QEMU_OPTIONS_H
|
28 | d3f24367 | Kevin Wolf | |
29 | d3f24367 | Kevin Wolf | enum QEMUOptionParType {
|
30 | d3f24367 | Kevin Wolf | OPT_FLAG, |
31 | d3f24367 | Kevin Wolf | OPT_NUMBER, |
32 | d3f24367 | Kevin Wolf | OPT_SIZE, |
33 | d3f24367 | Kevin Wolf | OPT_STRING, |
34 | d3f24367 | Kevin Wolf | }; |
35 | d3f24367 | Kevin Wolf | |
36 | d3f24367 | Kevin Wolf | typedef struct QEMUOptionParameter { |
37 | d3f24367 | Kevin Wolf | const char *name; |
38 | d3f24367 | Kevin Wolf | enum QEMUOptionParType type;
|
39 | d3f24367 | Kevin Wolf | union {
|
40 | d3f24367 | Kevin Wolf | uint64_t n; |
41 | d3f24367 | Kevin Wolf | char* s;
|
42 | d3f24367 | Kevin Wolf | } value; |
43 | db08adf5 | Kevin Wolf | const char *help; |
44 | d3f24367 | Kevin Wolf | } QEMUOptionParameter; |
45 | d3f24367 | Kevin Wolf | |
46 | d3f24367 | Kevin Wolf | |
47 | d3f24367 | Kevin Wolf | const char *get_opt_name(char *buf, int buf_size, const char *p, char delim); |
48 | d3f24367 | Kevin Wolf | const char *get_opt_value(char *buf, int buf_size, const char *p); |
49 | d3f24367 | Kevin Wolf | |
50 | d3f24367 | Kevin Wolf | |
51 | d3f24367 | Kevin Wolf | /*
|
52 | d3f24367 | Kevin Wolf | * The following functions take a parameter list as input. This is a pointer to
|
53 | d3f24367 | Kevin Wolf | * the first element of a QEMUOptionParameter array which is terminated by an
|
54 | d3f24367 | Kevin Wolf | * entry with entry->name == NULL.
|
55 | d3f24367 | Kevin Wolf | */
|
56 | d3f24367 | Kevin Wolf | |
57 | d3f24367 | Kevin Wolf | QEMUOptionParameter *get_option_parameter(QEMUOptionParameter *list, |
58 | d3f24367 | Kevin Wolf | const char *name); |
59 | d3f24367 | Kevin Wolf | int set_option_parameter(QEMUOptionParameter *list, const char *name, |
60 | d3f24367 | Kevin Wolf | const char *value); |
61 | d3f24367 | Kevin Wolf | int set_option_parameter_int(QEMUOptionParameter *list, const char *name, |
62 | d3f24367 | Kevin Wolf | uint64_t value); |
63 | d3f24367 | Kevin Wolf | QEMUOptionParameter *parse_option_parameters(const char *param, |
64 | d3f24367 | Kevin Wolf | QEMUOptionParameter *list, QEMUOptionParameter *dest); |
65 | d3f24367 | Kevin Wolf | void free_option_parameters(QEMUOptionParameter *list);
|
66 | d3f24367 | Kevin Wolf | void print_option_parameters(QEMUOptionParameter *list);
|
67 | db08adf5 | Kevin Wolf | void print_option_help(QEMUOptionParameter *list);
|
68 | d3f24367 | Kevin Wolf | |
69 | d3f24367 | Kevin Wolf | #endif |