From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:38793) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ZEmpm-0002ra-Sw for qemu-devel@nongnu.org; Mon, 13 Jul 2015 19:08:30 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1ZEmpj-0006h7-Bj for qemu-devel@nongnu.org; Mon, 13 Jul 2015 19:08:26 -0400 Received: from mx1.redhat.com ([209.132.183.28]:49338) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ZEmpj-0006h1-5v for qemu-devel@nongnu.org; Mon, 13 Jul 2015 19:08:23 -0400 Message-ID: <55A444E5.5090801@redhat.com> Date: Mon, 13 Jul 2015 19:08:21 -0400 From: John Snow MIME-Version: 1.0 References: <1436500012-32593-1-git-send-email-famz@redhat.com> <1436500012-32593-8-git-send-email-famz@redhat.com> In-Reply-To: <1436500012-32593-8-git-send-email-famz@redhat.com> Content-Type: text/plain; charset=windows-1252 Content-Transfer-Encoding: 7bit Subject: Re: [Qemu-devel] [PATCH v3 07/15] blockjob: Add "completed" and "ret" in BlockJob List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Fam Zheng , qemu-devel@nongnu.org Cc: Kevin Wolf , Jeff Cody , vsementsov@parallels.com, stefanha@redhat.com, Max Reitz On 07/09/2015 11:46 PM, Fam Zheng wrote: > They are set when block_job_completed is called. > > Signed-off-by: Fam Zheng > --- > blockjob.c | 3 +++ > include/block/blockjob.h | 9 +++++++++ > 2 files changed, 12 insertions(+) > > diff --git a/blockjob.c b/blockjob.c > index 62bb906..fb1d9e7 100644 > --- a/blockjob.c > +++ b/blockjob.c > @@ -89,6 +89,9 @@ void block_job_completed(BlockJob *job, int ret) > BlockDriverState *bs = job->bs; > > assert(bs->job == job); > + assert(!job->completed); > + job->completed = true; > + job->ret = ret; > job->cb(job->opaque, ret); > block_job_release(bs); > } > diff --git a/include/block/blockjob.h b/include/block/blockjob.h > index a7b7f66..40d0776 100644 > --- a/include/block/blockjob.h > +++ b/include/block/blockjob.h > @@ -134,6 +134,15 @@ struct BlockJob { > > /** The opaque value that is passed to the completion function. */ > void *opaque; > + > + /* True if this job has reported completion by calling block_job_completed. > + */ The end comment marker looks a little doofy on a newline, no? > + bool completed; > + > + /* ret code passed to block_job_completed. > + */ > + int ret; > + > }; > > /** > Reviewed-by: John Snow