From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1NkLTC-0007xj-1N for qemu-devel@nongnu.org; Wed, 24 Feb 2010 12:56:22 -0500 Received: from [199.232.76.173] (port=59145 helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1NkLT9-0007wa-Qo for qemu-devel@nongnu.org; Wed, 24 Feb 2010 12:56:19 -0500 Received: from Debian-exim by monty-python.gnu.org with spam-scanned (Exim 4.60) (envelope-from ) id 1NkLT0-0006RR-SX for qemu-devel@nongnu.org; Wed, 24 Feb 2010 12:56:18 -0500 Received: from oxygen.pond.sub.org ([213.239.205.148]:37610) by monty-python.gnu.org with esmtps (TLS-1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.60) (envelope-from ) id 1NkLSz-0006QA-AX for qemu-devel@nongnu.org; Wed, 24 Feb 2010 12:56:09 -0500 Received: from blackfin.pond.sub.org (pD9E38C12.dip.t-dialin.net [217.227.140.18]) by oxygen.pond.sub.org (Postfix) with ESMTPA id E20B6276D9C for ; Wed, 24 Feb 2010 18:56:04 +0100 (CET) From: Markus Armbruster Date: Wed, 24 Feb 2010 18:55:36 +0100 Message-Id: <1267034160-3517-25-git-send-email-armbru@redhat.com> In-Reply-To: <1267034160-3517-1-git-send-email-armbru@redhat.com> References: <1267034160-3517-1-git-send-email-armbru@redhat.com> Subject: [Qemu-devel] [PATCH RFC 24/48] qdev: Hide "no_user" devices from users List-Id: qemu-devel.nongnu.org List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: qemu-devel@nongnu.org Users can't create them, so qdev_device_help() shouldn't list them. Fix that. Also make qdev_device_add() pretend they don't exist. Before, it rejected them with a "can't be added via command line" message, which wasn't quite right for monitor command device_add. Signed-off-by: Markus Armbruster --- hw/qdev.c | 10 ++++------ 1 files changed, 4 insertions(+), 6 deletions(-) diff --git a/hw/qdev.c b/hw/qdev.c index e5f6820..274b052 100644 --- a/hw/qdev.c +++ b/hw/qdev.c @@ -162,6 +162,9 @@ int qdev_device_help(QemuOpts *opts) driver = qemu_opt_get(opts, "driver"); if (driver && !strcmp(driver, "?")) { for (info = device_info_list; info != NULL; info = info->next) { + if (info->no_user) { + continue; /* not available, don't show */ + } qdev_print_devinfo(info); } return 1; @@ -197,15 +200,10 @@ DeviceState *qdev_device_add(QemuOpts *opts) /* find driver */ info = qdev_find_info(NULL, driver); - if (!info) { + if (!info || info->no_user) { qemu_error_new(QERR_DEVICE_NOT_FOUND, driver); return NULL; } - if (info->no_user) { - qemu_error("device \"%s\" can't be added via command line", - info->name); - return NULL; - } /* find bus */ path = qemu_opt_get(opts, "bus"); -- 1.6.6