From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:33749) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1XCcUy-0006VQ-PN for qemu-devel@nongnu.org; Wed, 30 Jul 2014 18:37:33 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1XCcUu-0006Lv-3p for qemu-devel@nongnu.org; Wed, 30 Jul 2014 18:37:28 -0400 Received: from mx1.redhat.com ([209.132.183.28]:36146) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1XCcUt-0006Lr-O3 for qemu-devel@nongnu.org; Wed, 30 Jul 2014 18:37:23 -0400 Message-ID: <53D9738B.2040701@redhat.com> Date: Wed, 30 Jul 2014 16:36:59 -0600 From: Eric Blake MIME-Version: 1.0 References: <1406349933-17536-1-git-send-email-arei.gonglei@huawei.com> <1406349933-17536-6-git-send-email-arei.gonglei@huawei.com> In-Reply-To: <1406349933-17536-6-git-send-email-arei.gonglei@huawei.com> Content-Type: multipart/signed; micalg=pgp-sha256; protocol="application/pgp-signature"; boundary="1Ox6lv6uBVbD1jg0IIrXa0hwkJS2MN2nF" Subject: Re: [Qemu-devel] [PATCH v3 5/7] qmp: add set-bootindex command List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: arei.gonglei@huawei.com, qemu-devel@nongnu.org Cc: chenliang88@huawei.com, weidong.huang@huawei.com, mst@redhat.com, aik@ozlabs.ru, hutao@cn.fujitsu.com, armbru@redhat.com, kraxel@redhat.com, akong@redhat.com, agraf@suse.de, aliguori@amazon.com, gaowanlong@cn.fujitsu.com, ehabkost@redhat.com, luonengjun@huawei.com, peter.huangpeng@huawei.com, hani@linux.com, stefanha@redhat.com, pbonzini@redhat.com, lcapitulino@redhat.com, kwolf@redhat.com, peter.crosthwaite@xilinx.com, imammedo@redhat.com, afaerber@suse.de This is an OpenPGP/MIME signed message (RFC 4880 and 3156) --1Ox6lv6uBVbD1jg0IIrXa0hwkJS2MN2nF Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: quoted-printable On 07/25/2014 10:45 PM, arei.gonglei@huawei.com wrote: > From: Gonglei >=20 > Adds "set-bootindex id=3Dxx,bootindex=3Dxx,suffix=3Dxx" QMP command. >=20 > Example QMP command: > -> { "execute": "set-bootindex", "arguments": { "id": "ide0-0-1", "boot= index": 1, "suffix": "/disk@0"}} > <- { "return": {} } >=20 > Signed-off-by: Gonglei > Signed-off-by: Chenliang > --- > qapi-schema.json | 16 ++++++++++++++++ > qmp-commands.hx | 24 ++++++++++++++++++++++++ > qmp.c | 17 +++++++++++++++++ > 3 files changed, 57 insertions(+) >=20 > diff --git a/qapi-schema.json b/qapi-schema.json > index b11aad2..a9ef0be 100644 > --- a/qapi-schema.json > +++ b/qapi-schema.json > @@ -1704,6 +1704,22 @@ > { 'command': 'device_del', 'data': {'id': 'str'} } > =20 > ## > +# @set-bootindex: > +# > +# set bootindex of a devcie s/devcie/device/ Just to make sure this command is not write-only, it would be nice to mention which query-* command can be used to learn a device's current bootindex. > +# > +# @id: the name of the device > +# @bootindex: the bootindex of the device > +# @suffix: #optional a suffix of the device > +# > +# Returns: Nothing on success > +# If @id is not a valid device, DeviceNotFound > +# > +# Since: 2.2 > +## > +{ 'command': 'set-bootindex', 'data': {'id': 'str', 'bootindex': 'int'= , '*suffix': 'str'} } Long line; wrap it to stay in 80 columns. > + > +SQMP > +set-bootindex > +-------------------- Match the ---- length to the command name. > +++ b/qmp.c > @@ -684,6 +684,23 @@ void qmp_object_del(const char *id, Error **errp) > object_unparent(obj); > } > =20 > +void qmp_set_bootindex(const char *id, int64_t bootindex, > + bool has_suffix, const char *suffix, Error **errp= ) Indentation is off. > +{ > + DeviceState *dev; > + > + dev =3D qdev_find_recursive(sysbus_get_default(), id); > + if (NULL =3D=3D dev) { Code like Yoda we do not. This is more idiomatically written 'if (!dev)' or 'if (dev =3D=3D NULL)'. --=20 Eric Blake eblake redhat com +1-919-301-3266 Libvirt virtualization library http://libvirt.org --1Ox6lv6uBVbD1jg0IIrXa0hwkJS2MN2nF Content-Type: application/pgp-signature; name="signature.asc" Content-Description: OpenPGP digital signature Content-Disposition: attachment; filename="signature.asc" -----BEGIN PGP SIGNATURE----- Version: GnuPG v1 Comment: Public key at http://people.redhat.com/eblake/eblake.gpg iQEcBAEBCAAGBQJT2XOLAAoJEKeha0olJ0NqPO4IAI+NgOB6MTnaP2pwh0E8UTyW k9jd76VL0BvQRrwHj6Etsjl0SHUpOSjgNYXxqVLbCdRecEFp9VKdKqp1POI/vc4d pwmywshvF7cDqRsdVB/DshzbRd4pgZun0VfDZzfa9n/2iINJLg3dbChf4TPsIFcc ePHvMseKlI9xSJ+zcRUv01U+jk/EoDyoZvhP1tz45WMTLY4I9kRRe0WUkMNKSQ6w wlIMptLjS1G3QqGuyW+tx5HY7z7lrUZKT2WYYMuQF5hoeK1iFYa1frbaJZo4NxD9 x5mgCNBrPX2eQeKzQ2vRDhSQtZtwhak40MliVQrmNHVIbXU56QgkX4U0ISANqs0= =rSRX -----END PGP SIGNATURE----- --1Ox6lv6uBVbD1jg0IIrXa0hwkJS2MN2nF--