Received: from eggs.gnu.org ([2001:4830:134:3::10]:42130) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1XAtsV-0001Er-Jn for qemu-devel@nongnu.org; Sat, 26 Jul 2014 00:46:44 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1XAtsO-0003jB-SP for qemu-devel@nongnu.org; Sat, 26 Jul 2014 00:46:39 -0400 Received: from szxga02-in.huawei.com ([119.145.14.65]:46355) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1XAtsO-0003hR-7I for qemu-devel@nongnu.org; Sat, 26 Jul 2014 00:46:32 -0400 From: Date: Sat, 26 Jul 2014 12:45:32 +0800 Message-ID: <1406349933-17536-7-git-send-email-arei.gonglei@huawei.com> In-Reply-To: <1406349933-17536-1-git-send-email-arei.gonglei@huawei.com> References: <1406349933-17536-1-git-send-email-arei.gonglei@huawei.com> MIME-Version: 1.0 Content-Type: text/plain Subject: [Qemu-devel] [PATCH v3 6/7] qemu-monitor: HMP set-bootindex wrapper 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, 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 From: Gonglei Add HMP set-bootindex wrapper to allow setting devcie's bootindex via monitor. Signed-off-by: Gonglei Signed-off-by: Chenliang --- hmp-commands.hx | 15 +++++++++++++++ hmp.c | 13 +++++++++++++ hmp.h | 1 + 3 files changed, 29 insertions(+) diff --git a/hmp-commands.hx b/hmp-commands.hx index d0943b1..31ef24e 100644 --- a/hmp-commands.hx +++ b/hmp-commands.hx @@ -688,6 +688,21 @@ Remove device @var{id}. ETEXI { + .name = "set-bootindex", + .args_type = "id:s,bootindex:l,suffix:s?", + .params = "device bootindex [suffix]", + .help = "set bootindex of a device(e.g. set-bootindex disk0 1 '/disk@0')", + .mhandler.cmd = hmp_set_bootindex, + }, + +STEXI +@item set-bootindex @var{id} @var{bootindex} +@findex set-bootindex + +Set bootindex of a device. +ETEXI + + { .name = "cpu", .args_type = "index:i", .params = "index", diff --git a/hmp.c b/hmp.c index 4d1838e..95f7eeb 100644 --- a/hmp.c +++ b/hmp.c @@ -1714,3 +1714,16 @@ void hmp_info_memdev(Monitor *mon, const QDict *qdict) monitor_printf(mon, "\n"); } + +void hmp_set_bootindex(Monitor *mon, const QDict *qdict) +{ + Error *err = NULL; + + const char *id = qdict_get_str(qdict, "id"); + int64_t bootindex = qdict_get_int(qdict, "bootindex"); + bool has_suffix = qdict_haskey(qdict, "suffix"); + const char *suffix = qdict_get_try_str(qdict, "suffix"); + + qmp_set_bootindex(id, bootindex, has_suffix, suffix, &err); + hmp_handle_error(mon, &err); +} diff --git a/hmp.h b/hmp.h index 4fd3c4a..eb2641a 100644 --- a/hmp.h +++ b/hmp.h @@ -94,6 +94,7 @@ void hmp_cpu_add(Monitor *mon, const QDict *qdict); void hmp_object_add(Monitor *mon, const QDict *qdict); void hmp_object_del(Monitor *mon, const QDict *qdict); void hmp_info_memdev(Monitor *mon, const QDict *qdict); +void hmp_set_bootindex(Monitor *mon, const QDict *qdict); void object_add_completion(ReadLineState *rs, int nb_args, const char *str); void object_del_completion(ReadLineState *rs, int nb_args, const char *str); void device_add_completion(ReadLineState *rs, int nb_args, const char *str); -- 1.7.12.4