From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:39738) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1VTSnH-0000Wa-KN for qemu-devel@nongnu.org; Tue, 08 Oct 2013 04:37:34 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1VTSnA-0000Vu-DN for qemu-devel@nongnu.org; Tue, 08 Oct 2013 04:37:27 -0400 Received: from mx1.redhat.com ([209.132.183.28]:47780) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1VTSnA-0000Vj-3Y for qemu-devel@nongnu.org; Tue, 08 Oct 2013 04:37:20 -0400 Received: from int-mx09.intmail.prod.int.phx2.redhat.com (int-mx09.intmail.prod.int.phx2.redhat.com [10.5.11.22]) by mx1.redhat.com (8.14.4/8.14.4) with ESMTP id r988bJT2018808 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=OK) for ; Tue, 8 Oct 2013 04:37:19 -0400 Date: Tue, 8 Oct 2013 16:37:15 +0800 From: Fam Zheng Message-ID: <20131008083715.GB30465@T430s.nay.redhat.com> References: <1380542578-2387-1-git-send-email-famz@redhat.com> <1380542578-2387-5-git-send-email-famz@redhat.com> <524B02D7.1040304@redhat.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <524B02D7.1040304@redhat.com> Subject: Re: [Qemu-devel] [PATCH v4 4/7] mirror: Add commit_job_type to perform commit with mirror code Reply-To: famz@redhat.com List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Eric Blake Cc: kwolf@redhat.com, pbonzini@redhat.com, jcody@redhat.com, qemu-devel@nongnu.org, stefanha@redhat.com On Tue, 10/01 11:13, Eric Blake wrote: > On 09/30/2013 06:02 AM, Fam Zheng wrote: > > Commit active layer will be implemented in block/mirror.c, prepare a new > > job type to let it have a right type name for the user. > > > > Signed-off-by: Fam Zheng > > --- > > block/mirror.c | 12 +++++++++++- > > blockdev.c | 2 +- > > include/block/block_int.h | 2 ++ > > 3 files changed, 14 insertions(+), 2 deletions(-) > > > > diff --git a/block/mirror.c b/block/mirror.c > > index af6851f..20dcfb6 100644 > > --- a/block/mirror.c > > +++ b/block/mirror.c > > @@ -532,10 +532,19 @@ static const BlockJobType mirror_job_type = { > > .complete = mirror_complete, > > }; > > > > +static const BlockJobType commit_job_type = { > > + .instance_size = sizeof(MirrorBlockJob), > > + .job_type = "commit", > > I still wonder if we should complete the conversion over to a QAPI enum > type for all valid job types prior to hard-coding open strings through > yet more of the code base. As long as we don't have introspection done > yet, we can still make the switch, and in the long run, having an enum > of valid job types seems like it will be better for maintenance, all > with no change to what is sent over the wire in QMP. > > > @@ -390,6 +391,7 @@ void mirror_start(BlockDriverState *bs, BlockDriverState *target, > > int64_t speed, int64_t granularity, int64_t buf_size, > > MirrorSyncMode mode, BlockdevOnError on_source_error, > > BlockdevOnError on_target_error, > > + bool commit_job, > > If we DO create a QAPI enum for job type, then this parameter would be > the enum type, rather than a bool. > Good point, I'll work on a QAPI enum and base this on it. Fam