From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:48189) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1bFfFy-0004lN-Pc for qemu-devel@nongnu.org; Wed, 22 Jun 2016 06:19:39 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1bFfFt-0005E6-Lz for qemu-devel@nongnu.org; Wed, 22 Jun 2016 06:19:37 -0400 Received: from mx1.redhat.com ([209.132.183.28]:33559) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1bFfFt-0005Dw-G4 for qemu-devel@nongnu.org; Wed, 22 Jun 2016 06:19:33 -0400 References: <1466587008-3933-1-git-send-email-xiecl.fnst@cn.fujitsu.com> <1466587008-3933-2-git-send-email-xiecl.fnst@cn.fujitsu.com> <2b17fa8d-d2bb-d20e-2445-e010aa7066b1@redhat.com> <576A6486.4070409@cn.fujitsu.com> From: Paolo Bonzini Message-ID: <233d4f8a-8d64-ffa8-9470-8c51463ef69b@redhat.com> Date: Wed, 22 Jun 2016 12:19:28 +0200 MIME-Version: 1.0 In-Reply-To: <576A6486.4070409@cn.fujitsu.com> Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 7bit Subject: Re: [Qemu-devel] [PATCH 1/2] blockjob: assert(cb) in the entry functions of blockjob List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Changlong Xie , qemu devel , Jeff Cody Cc: Kevin Wolf , Fam Zheng , Max Reitz , Stefan Hajnoczi On 22/06/2016 12:12, Changlong Xie wrote: > > commit/mirror/stream/backup use block_job_create(..., cb,..) to create > relevant blockjob. When they finished, these jobs will invoke > block_job_completed, then invoke job->cb() unconditionally. So i think > we need this to avoid segment fault. Actually backup has implemented this. So this suggests that the right place to put the assertion would be block_job_create. But it's even better to add a #define QEMU_NONNULL __attribute__((__nonnull__)) to include/qemu/compiler.h and declare the arguments as non-null. Paolo