From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:47208) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1XNfTT-0008OX-82 for qemu-devel@nongnu.org; Sat, 30 Aug 2014 06:01:40 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1XNfTO-0002ud-5a for qemu-devel@nongnu.org; Sat, 30 Aug 2014 06:01:35 -0400 Received: from szxga03-in.huawei.com ([119.145.14.66]:55278) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1XNfTN-0002u9-DB for qemu-devel@nongnu.org; Sat, 30 Aug 2014 06:01:30 -0400 From: Date: Sat, 30 Aug 2014 18:00:25 +0800 Message-ID: <1409392827-9372-26-git-send-email-arei.gonglei@huawei.com> In-Reply-To: <1409392827-9372-1-git-send-email-arei.gonglei@huawei.com> References: <1409392827-9372-1-git-send-email-arei.gonglei@huawei.com> MIME-Version: 1.0 Content-Type: text/plain Subject: [Qemu-devel] [PATCH v6 25/27] virtio-blk: add bootindex to qom property List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: 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, Gonglei , 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 From: Gonglei Add a qom property with the same name 'bootindex', when we remove it form qdev property, things will continue to work just fine, and we can use qom features which are not supported by qdev property. Signed-off-by: Gonglei --- hw/block/virtio-blk.c | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) diff --git a/hw/block/virtio-blk.c b/hw/block/virtio-blk.c index e74a4c5..ccc1e1f 100644 --- a/hw/block/virtio-blk.c +++ b/hw/block/virtio-blk.c @@ -797,6 +797,22 @@ static void virtio_blk_device_unrealize(DeviceState *dev, Error **errp) virtio_cleanup(vdev); } +static void virtio_blk_get_bootindex(Object *obj, Visitor *v, void *opaque, + const char *name, Error **errp) +{ + VirtIOBlock *s = VIRTIO_BLK(obj); + + get_bootindex(&s->conf->bootindex, v, name, errp); +} + +static void virtio_blk_set_bootindex(Object *obj, Visitor *v, void *opaque, + const char *name, Error **errp) +{ + VirtIOBlock *s = VIRTIO_BLK(obj); + + set_bootindex(&s->conf->bootindex, v, name, errp); +} + static void virtio_blk_instance_init(Object *obj) { VirtIOBlock *s = VIRTIO_BLK(obj); @@ -805,6 +821,9 @@ static void virtio_blk_instance_init(Object *obj) (Object **)&s->blk.iothread, qdev_prop_allow_set_link_before_realize, OBJ_PROP_LINK_UNREF_ON_RELEASE, NULL); + object_property_add(obj, "bootindex", "int", + virtio_blk_get_bootindex, + virtio_blk_set_bootindex, NULL, NULL, NULL); } static Property virtio_blk_properties[] = { -- 1.7.12.4