aboutsummaryrefslogtreecommitdiff
path: root/chardev
diff options
context:
space:
mode:
authorKevin Wolf <kwolf@redhat.com>2021-03-11 17:42:52 +0100
committerKevin Wolf <kwolf@redhat.com>2021-03-19 10:18:06 +0100
commit5965243641d797b2270082c5a4eab49cb81fc8f0 (patch)
treef7bb814ffbd1b4de1e709d13efa3197585bb5662 /chardev
parent1254bd3977b30b3af74bb1f6641fe02d0bf5caf8 (diff)
char: Deprecate backend aliases 'tty' and 'parport'
QAPI doesn't know the aliases 'tty' and 'parport' and there is no reason to prefer them to the real names of the backends 'serial' and 'parallel'. Since warnings are not allowed in 'make check' output, we can't test the deprecated alias any more. Remove it from test-char. Signed-off-by: Kevin Wolf <kwolf@redhat.com> Acked-by: Paolo Bonzini <pbonzini@redhat.com> Message-Id: <20210311164253.338723-3-kwolf@redhat.com> Reviewed-by: Markus Armbruster <armbru@redhat.com> Signed-off-by: Kevin Wolf <kwolf@redhat.com>
Diffstat (limited to 'chardev')
-rw-r--r--chardev/char.c12
1 files changed, 11 insertions, 1 deletions
diff --git a/chardev/char.c b/chardev/char.c
index dd925cf9a4..7be9579dd8 100644
--- a/chardev/char.c
+++ b/chardev/char.c
@@ -534,9 +534,10 @@ static const ChardevClass *char_get_class(const char *driver, Error **errp)
return cc;
}
-static const struct ChardevAlias {
+static struct ChardevAlias {
const char *typename;
const char *alias;
+ bool deprecation_warning_printed;
} chardev_alias_table[] = {
#ifdef HAVE_CHARDEV_PARPORT
{ "parallel", "parport" },
@@ -584,6 +585,10 @@ help_string_append(const char *name, bool is_cli_alias, void *opaque)
{
GString *str = opaque;
+ if (is_cli_alias) {
+ return;
+ }
+
g_string_append_printf(str, "\n %s", name);
}
@@ -592,6 +597,11 @@ static const char *chardev_alias_translate(const char *name)
int i;
for (i = 0; i < (int)ARRAY_SIZE(chardev_alias_table); i++) {
if (g_strcmp0(chardev_alias_table[i].alias, name) == 0) {
+ if (!chardev_alias_table[i].deprecation_warning_printed) {
+ warn_report("The alias '%s' is deprecated, use '%s' instead",
+ name, chardev_alias_table[i].typename);
+ chardev_alias_table[i].deprecation_warning_printed = true;
+ }
return chardev_alias_table[i].typename;
}
}