From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:35292) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1XO0vG-0008Dy-9V for qemu-devel@nongnu.org; Sun, 31 Aug 2014 04:55:47 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1XO0vB-0005r0-6B for qemu-devel@nongnu.org; Sun, 31 Aug 2014 04:55:42 -0400 Received: from mx1.redhat.com ([209.132.183.28]:34698) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1XO0vA-0005qq-Ri for qemu-devel@nongnu.org; Sun, 31 Aug 2014 04:55:37 -0400 Date: Sun, 31 Aug 2014 11:58:29 +0200 From: "Michael S. Tsirkin" Message-ID: <20140831095829.GA1548@redhat.com> References: <1409392827-9372-1-git-send-email-arei.gonglei@huawei.com> <1409392827-9372-8-git-send-email-arei.gonglei@huawei.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <1409392827-9372-8-git-send-email-arei.gonglei@huawei.com> Subject: Re: [Qemu-devel] [PATCH v6 07/27] vl.c: add setter/getter functions for bootindex property List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: arei.gonglei@huawei.com Cc: chenliang88@huawei.com, weidong.huang@huawei.com, aik@ozlabs.ru, hutao@cn.fujitsu.com, qemu-devel@nongnu.org, armbru@redhat.com, kraxel@redhat.com, akong@redhat.com, agraf@suse.de, aliguori@amazon.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 On Sat, Aug 30, 2014 at 06:00:07PM +0800, arei.gonglei@huawei.com wrote: > From: Gonglei > > when we remove bootindex form qdev.property to qom.property, > we can use those functions set/get bootindex property for all > correlative devices. > > Signed-off-by: Gonglei > --- > include/sysemu/sysemu.h | 4 ++++ > vl.c | 27 +++++++++++++++++++++++++++ > 2 files changed, 31 insertions(+) > > diff --git a/include/sysemu/sysemu.h b/include/sysemu/sysemu.h > index 672984c..ca231e4 100644 > --- a/include/sysemu/sysemu.h > +++ b/include/sysemu/sysemu.h > @@ -208,6 +208,10 @@ void do_usb_del(Monitor *mon, const QDict *qdict); > void usb_info(Monitor *mon, const QDict *qdict); > > void check_boot_index(int32_t bootindex, Error **errp); > +void get_bootindex(int32_t *bootindex, Visitor *v, > + const char *name, Error **errp); > +void set_bootindex(int32_t *bootindex, Visitor *v, > + const char *name, Error **errp); > void del_boot_device_path(DeviceState *dev); > void add_boot_device_path(int32_t bootindex, DeviceState *dev, > const char *suffix); > diff --git a/vl.c b/vl.c > index f2c3b2d..4363185 100644 > --- a/vl.c > +++ b/vl.c > @@ -1252,6 +1252,33 @@ void check_boot_index(int32_t bootindex, Error **errp) > } > } > > +void get_bootindex(int32_t *bootindex, Visitor *v, > + const char *name, Error **errp) > +{ > + visit_type_int32(v, bootindex, name, errp); > +} > + > +void set_bootindex(int32_t *bootindex, Visitor *v, > + const char *name, Error **errp) > +{ > + int32_t boot_index; > + Error *local_err = NULL; > + > + visit_type_int32(v, &boot_index, name, &local_err); > + > + if (local_err == NULL) { > + /* check the bootindex existes or not in fw_boot_order list */ should be: check whether bootindex is present in fw_boot_order list > + check_boot_index(boot_index, &local_err); > + } > + > + if (local_err) { > + error_propagate(errp, local_err); > + return; > + } > + /* change bootindex to a new one */ > + *bootindex = boot_index; > +} > + > static bool is_same_fw_dev_path(DeviceState *src, DeviceState *dst) > { > bool ret = false; > -- > 1.7.12.4 >