From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([208.118.235.92]:37631) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1UVvxS-0006ll-Op for qemu-devel@nongnu.org; Fri, 26 Apr 2013 23:37:55 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1UVvxR-0005yR-Mj for qemu-devel@nongnu.org; Fri, 26 Apr 2013 23:37:54 -0400 Received: from e23smtp08.au.ibm.com ([202.81.31.141]:35876) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1UVvxR-0005y6-6C for qemu-devel@nongnu.org; Fri, 26 Apr 2013 23:37:53 -0400 Received: from /spool/local by e23smtp08.au.ibm.com with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted for from ; Sat, 27 Apr 2013 13:35:31 +1000 Received: from d23relay04.au.ibm.com (d23relay04.au.ibm.com [9.190.234.120]) by d23dlp03.au.ibm.com (Postfix) with ESMTP id B8068357804E for ; Sat, 27 Apr 2013 13:37:46 +1000 (EST) Received: from d23av01.au.ibm.com (d23av01.au.ibm.com [9.190.234.96]) by d23relay04.au.ibm.com (8.13.8/8.13.8/NCO v10.0) with ESMTP id r3R3O8lx18219082 for ; Sat, 27 Apr 2013 13:24:08 +1000 Received: from d23av01.au.ibm.com (loopback [127.0.0.1]) by d23av01.au.ibm.com (8.14.4/8.13.1/NCO v10.0 AVout) with ESMTP id r3R3bkFv015641 for ; Sat, 27 Apr 2013 13:37:46 +1000 Message-ID: <517B47F6.40405@linux.vnet.ibm.com> Date: Sat, 27 Apr 2013 11:37:26 +0800 From: Wenchao Xia MIME-Version: 1.0 References: <1366968675-1451-1-git-send-email-xiawenc@linux.vnet.ibm.com> <1366968675-1451-8-git-send-email-xiawenc@linux.vnet.ibm.com> <20130426144657.GB7648@stefanha-thinkpad.redhat.com> In-Reply-To: <20130426144657.GB7648@stefanha-thinkpad.redhat.com> Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 8bit Subject: Re: [Qemu-devel] [PATCH 7/7] block: dump to monitor for bdrv_snapshot_dump() and bdrv_image_info_dump() List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Stefan Hajnoczi Cc: kwolf@redhat.com, phrdina@redhat.com, armbru@redhat.com, qemu-devel@nongnu.org, lcapitulino@redhat.com, pbonzini@redhat.com 于 2013-4-26 22:46, Stefan Hajnoczi 写道: > On Fri, Apr 26, 2013 at 05:31:15PM +0800, Wenchao Xia wrote: >> @@ -2586,10 +2585,12 @@ void do_info_snapshots(Monitor *mon, const QDict *qdict) >> } >> >> if (total > 0) { >> - monitor_printf(mon, "%s\n", bdrv_snapshot_dump(buf, sizeof(buf), NULL)); >> + bdrv_snapshot_dump(NULL); >> + monitor_printf(mon, "\n"); > > Luiz: any issue with mixing monitor_printf(mon) and > monitor_vprintf(cur_mon) calls? I guess there was a reason for > explicitly passing mon instead of relying on cur_mon. > >> for (i = 0; i < total; i++) { >> sn = &sn_tab[available_snapshots[i]]; >> - monitor_printf(mon, "%s\n", bdrv_snapshot_dump(buf, sizeof(buf), sn)); >> + bdrv_snapshot_dump(sn); >> + monitor_printf(mon, "\n"); >> } >> } else { >> monitor_printf(mon, "There is no suitable snapshot available\n"); >> diff --git a/util/qemu-error.c b/util/qemu-error.c >> index 08a36f4..a47bf32 100644 >> --- a/util/qemu-error.c >> +++ b/util/qemu-error.c >> @@ -213,3 +213,21 @@ void error_report(const char *fmt, ...) >> va_end(ap); >> error_printf("\n"); >> } >> + >> +/* >> + * Print to current monitor if we have one, else to stdout. It is similar with >> + * error_printf(). >> + * TODO just like error_vprintf() > > TODO? > Same with error_vprintf's comments: /* * Print to current monitor if we have one, else to stderr. * TODO should return int, so callers can calculate width, but that * requires surgery to monitor_vprintf(). Left for another day. */ -- Best Regards Wenchao Xia