aboutsummaryrefslogtreecommitdiffstats
path: root/qemu-option.h
diff options
context:
space:
mode:
authorDavid 'Digit' Turner <digit@android.com>2010-05-10 18:48:35 -0700
committerDavid 'Digit' Turner <digit@android.com>2010-05-11 17:10:19 -0700
commit2910f183ddd5286911bc1e3499ea93cb57de8b75 (patch)
tree43cfd4b9a6697496732722ff7f2fb66d5782597c /qemu-option.h
parent0119362f0d74ca74f3ea743f6e0e527a9edcc474 (diff)
downloadexternal_qemu-2910f183ddd5286911bc1e3499ea93cb57de8b75.zip
external_qemu-2910f183ddd5286911bc1e3499ea93cb57de8b75.tar.gz
external_qemu-2910f183ddd5286911bc1e3499ea93cb57de8b75.tar.bz2
Upstream: Misc integration - includes qobject.h and related sources
Change-Id: Idfa93ab5c67c95a3bc1869eeaf3a84a75fe24cd6
Diffstat (limited to 'qemu-option.h')
-rw-r--r--qemu-option.h58
1 files changed, 58 insertions, 0 deletions
diff --git a/qemu-option.h b/qemu-option.h
index 059c0a4..666b666 100644
--- a/qemu-option.h
+++ b/qemu-option.h
@@ -26,6 +26,9 @@
#ifndef QEMU_OPTIONS_H
#define QEMU_OPTIONS_H
+#include <stdint.h>
+#include "qemu-queue.h"
+
enum QEMUOptionParType {
OPT_FLAG,
OPT_NUMBER,
@@ -46,6 +49,12 @@ typedef struct QEMUOptionParameter {
const char *get_opt_name(char *buf, int buf_size, const char *p, char delim);
const char *get_opt_value(char *buf, int buf_size, const char *p);
+int get_next_param_value(char *buf, int buf_size,
+ const char *tag, const char **pstr);
+int get_param_value(char *buf, int buf_size,
+ const char *tag, const char *str);
+int check_params(char *buf, int buf_size,
+ const char * const *params, const char *str);
/*
@@ -66,4 +75,53 @@ void free_option_parameters(QEMUOptionParameter *list);
void print_option_parameters(QEMUOptionParameter *list);
void print_option_help(QEMUOptionParameter *list);
+/* ------------------------------------------------------------------ */
+
+typedef struct QemuOpt QemuOpt;
+typedef struct QemuOpts QemuOpts;
+typedef struct QemuOptsList QemuOptsList;
+
+enum QemuOptType {
+ QEMU_OPT_STRING = 0, /* no parsing (use string as-is) */
+ QEMU_OPT_BOOL, /* on/off */
+ QEMU_OPT_NUMBER, /* simple number */
+ QEMU_OPT_SIZE, /* size, accepts (K)ilo, (M)ega, (G)iga, (T)era postfix */
+};
+
+typedef struct QemuOptDesc {
+ const char *name;
+ enum QemuOptType type;
+ const char *help;
+} QemuOptDesc;
+
+struct QemuOptsList {
+ const char *name;
+ QTAILQ_HEAD(, QemuOpts) head;
+ QemuOptDesc desc[];
+};
+
+const char *qemu_opt_get(QemuOpts *opts, const char *name);
+int qemu_opt_get_bool(QemuOpts *opts, const char *name, int defval);
+uint64_t qemu_opt_get_number(QemuOpts *opts, const char *name, uint64_t defval);
+uint64_t qemu_opt_get_size(QemuOpts *opts, const char *name, uint64_t defval);
+int qemu_opt_set(QemuOpts *opts, const char *name, const char *value);
+typedef int (*qemu_opt_loopfunc)(const char *name, const char *value, void *opaque);
+int qemu_opt_foreach(QemuOpts *opts, qemu_opt_loopfunc func, void *opaque,
+ int abort_on_failure);
+
+QemuOpts *qemu_opts_find(QemuOptsList *list, const char *id);
+QemuOpts *qemu_opts_create(QemuOptsList *list, const char *id, int fail_if_exists);
+int qemu_opts_set(QemuOptsList *list, const char *id,
+ const char *name, const char *value);
+const char *qemu_opts_id(QemuOpts *opts);
+void qemu_opts_del(QemuOpts *opts);
+int qemu_opts_validate(QemuOpts *opts, QemuOptDesc *desc);
+int qemu_opts_do_parse(QemuOpts *opts, const char *params, const char *firstname);
+QemuOpts *qemu_opts_parse(QemuOptsList *list, const char *params, const char *firstname);
+
+typedef int (*qemu_opts_loopfunc)(QemuOpts *opts, void *opaque);
+int qemu_opts_print(QemuOpts *opts, void *dummy);
+int qemu_opts_foreach(QemuOptsList *list, qemu_opts_loopfunc func, void *opaque,
+ int abort_on_failure);
+
#endif