qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
* [Qemu-devel] [PATCH] qdev: obey no_user
@ 2012-12-17 16:00 Christian Borntraeger
  2013-01-07 14:05 ` Christian Borntraeger
                   ` (2 more replies)
  0 siblings, 3 replies; 15+ messages in thread
From: Christian Borntraeger @ 2012-12-17 16:00 UTC (permalink / raw)
  To: Anthony Liguori; +Cc: Christian Borntraeger, qemu-devel@nongnu.org

since

commit 18b6dade8c0799c48f5c5e124b8c407cd5e22e96
qdev: refactor device creation to allow bus_info to be set only in class

A user can specify a device that is no_user.
For example on my i386 box, I can add a 2nd kvmvapic device.

This patch checks for no-user and rejects the device_add.

Signed-off-by: Christian Borntraeger <borntraeger@de.ibm.com>
---
 hw/qdev-monitor.c | 5 +++++
 1 file changed, 5 insertions(+)

diff --git a/hw/qdev-monitor.c b/hw/qdev-monitor.c
index a1b4d6a..b2c34e7 100644
--- a/hw/qdev-monitor.c
+++ b/hw/qdev-monitor.c
@@ -426,6 +426,11 @@ DeviceState *qdev_device_add(QemuOpts *opts)
     }
 
     k = DEVICE_CLASS(obj);
+    if (k->no_user) {
+        qerror_report(QERR_INVALID_PARAMETER_VALUE, "driver", "a driver name");
+        error_printf_unless_qmp("Try with argument 'help' for a list.\n");
+        return NULL;
+    }
 
     /* find bus */
     path = qemu_opt_get(opts, "bus");
-- 
1.7.11.4

^ permalink raw reply related	[flat|nested] 15+ messages in thread

end of thread, other threads:[~2013-01-07 22:48 UTC | newest]

Thread overview: 15+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2012-12-17 16:00 [Qemu-devel] [PATCH] qdev: obey no_user Christian Borntraeger
2013-01-07 14:05 ` Christian Borntraeger
2013-01-07 14:20 ` Andreas Färber
2013-01-07 15:24   ` Luiz Capitulino
2013-01-07 19:32 ` Anthony Liguori
2013-01-07 19:40   ` Peter Maydell
2013-01-07 20:12     ` Anthony Liguori
2013-01-07 20:16       ` Peter Maydell
2013-01-07 20:48         ` Anthony Liguori
2013-01-07 22:10         ` Andreas Färber
2013-01-07 22:20           ` Peter Maydell
2013-01-07 22:36             ` Andreas Färber
2013-01-07 22:48               ` Anthony Liguori
2013-01-07 20:40   ` Christian Borntraeger
2013-01-07 21:43     ` Anthony Liguori

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).