aboutsummaryrefslogtreecommitdiff
path: root/include
diff options
context:
space:
mode:
authorMarc-André Lureau <marcandre.lureau@redhat.com>2016-10-21 16:07:45 +0300
committerPaolo Bonzini <pbonzini@redhat.com>2017-01-27 18:07:58 +0100
commit0b812f31925f2ed50eb54d2be6ac9291bf67b890 (patch)
tree8a51007dff4c1b2d7a6d004a06ac53a6059c0358 /include
parentbd1caa3f8e8e63b9ac4cbcbee5a2dee3587fd852 (diff)
char: use a const CharDriver
No need to allocate & copy fields, let's use static const struct instead. Add an alias field to the CharDriver structure to cover the cases where we previously registered a driver twice under two names. Signed-off-by: Marc-André Lureau <marcandre.lureau@redhat.com> Reviewed-by: Eric Blake <eblake@redhat.com> Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
Diffstat (limited to 'include')
-rw-r--r--include/sysemu/char.h20
1 files changed, 11 insertions, 9 deletions
diff --git a/include/sysemu/char.h b/include/sysemu/char.h
index b6e361860a..fee2c3493c 100644
--- a/include/sysemu/char.h
+++ b/include/sysemu/char.h
@@ -475,15 +475,17 @@ void qemu_chr_set_feature(CharDriverState *chr,
CharDriverFeature feature);
QemuOpts *qemu_chr_parse_compat(const char *label, const char *filename);
-typedef void CharDriverParse(QemuOpts *opts, ChardevBackend *backend,
- Error **errp);
-typedef CharDriverState *CharDriverCreate(const char *id,
- ChardevBackend *backend,
- ChardevReturn *ret, bool *be_opened,
- Error **errp);
-
-void register_char_driver(const char *name, ChardevBackendKind kind,
- CharDriverParse *parse, CharDriverCreate *create);
+typedef struct CharDriver {
+ ChardevBackendKind kind;
+ const char *alias;
+ void (*parse)(QemuOpts *opts, ChardevBackend *backend, Error **errp);
+ CharDriverState *(*create)(const char *id,
+ ChardevBackend *backend,
+ ChardevReturn *ret, bool *be_opened,
+ Error **errp);
+} CharDriver;
+
+void register_char_driver(const CharDriver *driver);
extern int term_escape_char;