@@ -678,6 +678,14 @@ int qemu_opt_set_bool(QemuOpts *opts, const char *name, bool val)
return qemu_opt_set(opts, name, val ? "on" : "off");
}
+int qemu_opt_set_number(QemuOpts *opts, const char *name, int64_t val)
+{
+ char buffer[1024];
+ snprintf(buffer, sizeof(buffer), "%" PRId64, val);
+ return qemu_opt_set(opts, name, buffer);
+}
+
+
int qemu_opt_foreach(QemuOpts *opts, qemu_opt_loopfunc func, void *opaque,
int abort_on_failure)
{
@@ -126,6 +126,7 @@ int qemu_opt_set(QemuOpts *opts, const char *name, const char *value);
void qemu_opt_set_err(QemuOpts *opts, const char *name, const char *value,
Error **errp);
int qemu_opt_set_bool(QemuOpts *opts, const char *name, bool val);
+int qemu_opt_set_number(QemuOpts *opts, const char *name, int64_t val);
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);
Signed-off-by: Dong Xu Wang <wdongxu@linux.vnet.ibm.com> --- qemu-option.c | 8 ++++++++ qemu-option.h | 1 + 2 files changed, 9 insertions(+), 0 deletions(-)