From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([208.118.235.92]:36767) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1TsEZ9-0003G4-2m for qemu-devel@nongnu.org; Mon, 07 Jan 2013 10:24:47 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1TsEZ6-0002tI-OP for qemu-devel@nongnu.org; Mon, 07 Jan 2013 10:24:43 -0500 Received: from mx1.redhat.com ([209.132.183.28]:46300) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1TsEZ6-0002rc-Fy for qemu-devel@nongnu.org; Mon, 07 Jan 2013 10:24:40 -0500 Date: Mon, 7 Jan 2013 13:24:44 -0200 From: Luiz Capitulino Message-ID: <20130107132444.09d6e89d@doriath.home> In-Reply-To: <50EAD9A1.7090407@suse.de> References: <1355760006-891-1-git-send-email-borntraeger@de.ibm.com> <50EAD9A1.7090407@suse.de> Mime-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable Subject: Re: [Qemu-devel] [PATCH] qdev: obey no_user List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Andreas =?ISO-8859-1?B?RuRyYmVy?= Cc: Christian Borntraeger , Anthony Liguori , "qemu-devel@nongnu.org" On Mon, 07 Jan 2013 15:20:17 +0100 Andreas F=E4rber wrote: > Am 17.12.2012 17:00, schrieb Christian Borntraeger: > > since > >=20 > > commit 18b6dade8c0799c48f5c5e124b8c407cd5e22e96 > > qdev: refactor device creation to allow bus_info to be set only in class > >=20 > > A user can specify a device that is no_user. > > For example on my i386 box, I can add a 2nd kvmvapic device. > >=20 > > This patch checks for no-user and rejects the device_add. > >=20 > > Signed-off-by: Christian Borntraeger > > --- > > hw/qdev-monitor.c | 5 +++++ > > 1 file changed, 5 insertions(+) > >=20 > > 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) > > } > > =20 > > k =3D DEVICE_CLASS(obj); > > + if (k->no_user) { >=20 > Ack for this check... >=20 > > + qerror_report(QERR_INVALID_PARAMETER_VALUE, "driver", "a drive= r name"); > > + error_printf_unless_qmp("Try with argument 'help' for a list.\= n"); >=20 > ...but I'm not sure if this error reporting with QERR_... is still in > the desired form, cc'ing Luiz. The device_add command hasn't been converted to the qapi yet, so it's fine to use qerror_report(). However, I'd drop the error_printf_unless_qmp() cal= l, as this has the potential of making the conversion harder. >=20 > Andreas >=20 > > + return NULL; > > + } > > =20 > > /* find bus */ > > path =3D qemu_opt_get(opts, "bus"); >=20