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