Skip to content

Commit

Permalink
QemuOpts: Add qemu_opt_unset()
Browse files Browse the repository at this point in the history
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
Reviewed-by: Eric Blake <eblake@redhat.com>
  • Loading branch information
kevmw committed Jul 26, 2013
1 parent 74fe54f commit 0dd6c52
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 0 deletions.
1 change: 1 addition & 0 deletions include/qemu/option.h
Expand Up @@ -120,6 +120,7 @@ bool qemu_opt_has_help_opt(QemuOpts *opts);
bool qemu_opt_get_bool(QemuOpts *opts, const char *name, bool 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_unset(QemuOpts *opts, const char *name);
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);
Expand Down
14 changes: 14 additions & 0 deletions util/qemu-option.c
Expand Up @@ -593,6 +593,20 @@ static const QemuOptDesc *find_desc_by_name(const QemuOptDesc *desc,
return NULL;
}

int qemu_opt_unset(QemuOpts *opts, const char *name)
{
QemuOpt *opt = qemu_opt_find(opts, name);

assert(opts_accepts_any(opts));

if (opt == NULL) {
return -1;
} else {
qemu_opt_del(opt);
return 0;
}
}

static void opt_set(QemuOpts *opts, const char *name, const char *value,
bool prepend, Error **errp)
{
Expand Down

0 comments on commit 0dd6c52

Please sign in to comment.