mirror of
https://gitlab.com/qemu-project/qemu
synced 2024-11-05 20:35:44 +00:00
char: remove qemu_chardev_add
qemu_chardev_new() now uses object_new_with_props() with /chardevs parent container. It will fail to insert the object if the same "id" already exists. "chardevs" list usage has been removed in previous commits. Signed-off-by: Marc-André Lureau <marcandre.lureau@redhat.com>
This commit is contained in:
parent
6061162e52
commit
c5749f7c0b
1 changed files with 4 additions and 23 deletions
|
@ -805,26 +805,6 @@ static const ChardevClass *char_get_class(const char *driver, Error **errp)
|
|||
return cc;
|
||||
}
|
||||
|
||||
static Chardev *qemu_chardev_add(const char *id, const char *typename,
|
||||
ChardevBackend *backend, Error **errp)
|
||||
{
|
||||
Chardev *chr;
|
||||
|
||||
chr = qemu_chr_find(id);
|
||||
if (chr) {
|
||||
error_setg(errp, "Chardev '%s' already exists", id);
|
||||
return NULL;
|
||||
}
|
||||
|
||||
chr = qemu_chardev_new(id, typename, backend, errp);
|
||||
if (!chr) {
|
||||
return NULL;
|
||||
}
|
||||
|
||||
QTAILQ_INSERT_TAIL(&chardevs, chr, next);
|
||||
return chr;
|
||||
}
|
||||
|
||||
static const struct ChardevAlias {
|
||||
const char *typename;
|
||||
const char *alias;
|
||||
|
@ -941,9 +921,10 @@ Chardev *qemu_chr_new_from_opts(QemuOpts *opts,
|
|||
backend->u.null.data = ccom; /* Any ChardevCommon member would work */
|
||||
}
|
||||
|
||||
chr = qemu_chardev_add(bid ? bid : id,
|
||||
chr = qemu_chardev_new(bid ? bid : id,
|
||||
object_class_get_name(OBJECT_CLASS(cc)),
|
||||
backend, errp);
|
||||
|
||||
if (chr == NULL) {
|
||||
goto out;
|
||||
}
|
||||
|
@ -955,7 +936,7 @@ Chardev *qemu_chr_new_from_opts(QemuOpts *opts,
|
|||
backend->type = CHARDEV_BACKEND_KIND_MUX;
|
||||
backend->u.mux.data = g_new0(ChardevMux, 1);
|
||||
backend->u.mux.data->chardev = g_strdup(bid);
|
||||
mux = qemu_chardev_add(id, TYPE_CHARDEV_MUX, backend, errp);
|
||||
mux = qemu_chardev_new(id, TYPE_CHARDEV_MUX, backend, errp);
|
||||
if (mux == NULL) {
|
||||
object_unparent(OBJECT(chr));
|
||||
chr = NULL;
|
||||
|
@ -1289,7 +1270,7 @@ ChardevReturn *qmp_chardev_add(const char *id, ChardevBackend *backend,
|
|||
return NULL;
|
||||
}
|
||||
|
||||
chr = qemu_chardev_add(id, object_class_get_name(OBJECT_CLASS(cc)),
|
||||
chr = qemu_chardev_new(id, object_class_get_name(OBJECT_CLASS(cc)),
|
||||
backend, errp);
|
||||
if (!chr) {
|
||||
return NULL;
|
||||
|
|
Loading…
Reference in a new issue