return NULL;
}
+ if (!cc->supports_size_opts) {
+ const char * const invalid_opts[] = {
+ "width", "height", "cols", "rows", NULL
+ };
+
+ if (qemu_opt_has_any(opts, invalid_opts)) {
+ error_setg(errp, "chardev '%s' does not support size options",
+ qemu_opts_id(opts));
+ return NULL;
+ }
+ }
+
backend = g_new0(ChardevBackend, 1);
backend->type = CHARDEV_BACKEND_KIND_NULL;
bool internal; /* TODO: eventually use TYPE_USER_CREATABLE */
bool supports_yank;
+ bool supports_size_opts;
/* parse command line options and populate QAPI @backend */
void (*chr_parse)(QemuOpts *opts, ChardevBackend *backend, Error **errp);
const char *qemu_opt_get(QemuOpts *opts, const char *name);
char *qemu_opt_get_del(QemuOpts *opts, const char *name);
+bool qemu_opt_has_any(QemuOpts *opts, const char * const *names);
/**
* qemu_opt_has_help_opt:
* @opts: options to search for a help request
cc->chr_write = vc_chr_write;
cc->chr_accept_input = vc_chr_accept_input;
cc->chr_set_echo = vc_chr_set_echo;
+ cc->supports_size_opts = true;
}
static const TypeInfo char_vc_type_info = {
return opt->str;
}
+bool qemu_opt_has_any(QemuOpts *opts, const char * const *names)
+{
+ int it;
+
+ for (it = 0; names[it]; it++) {
+ if (qemu_opt_get(opts, names[it])) {
+ return true;
+ }
+ }
+ return false;
+}
+
+
void qemu_opt_iter_init(QemuOptsIter *iter, QemuOpts *opts, const char *name)
{
iter->opts = opts;