From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:36715) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1YQyyy-0005Ox-Uh for qemu-devel@nongnu.org; Thu, 26 Feb 2015 09:00:05 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1YQyyu-00031S-OP for qemu-devel@nongnu.org; Thu, 26 Feb 2015 09:00:04 -0500 Message-ID: <54EF26DD.6040008@redhat.com> Date: Thu, 26 Feb 2015 08:59:57 -0500 From: Max Reitz MIME-Version: 1.0 References: <1424792164-2130-1-git-send-email-mreitz@redhat.com> <1424792164-2130-6-git-send-email-mreitz@redhat.com> <20150225075232.GH5293@ad.nay.redhat.com> <54EDD846.5030509@redhat.com> <20150226021910.GD10137@ad.nay.redhat.com> In-Reply-To: <20150226021910.GD10137@ad.nay.redhat.com> Content-Type: text/plain; charset=windows-1252; format=flowed Content-Transfer-Encoding: 7bit Subject: Re: [Qemu-devel] [PATCH v3 05/11] block: Move BDS close notifiers into BB List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Fam Zheng Cc: Kevin Wolf , qemu-block@nongnu.org, qemu-devel@nongnu.org, Markus Armbruster , Stefan Hajnoczi , Paolo Bonzini On 2015-02-25 at 21:19, Fam Zheng wrote: > On Wed, 02/25 09:12, Max Reitz wrote: >> Because I need a Notifier pointer to give to >> blk_add_{insert,remove}_bs_notifier(), and most importantly because the only >> "opaque" object the callbacks will receive is that Notifier pointer (which >> in this case is actually a DataPlaneBlkChangeNotifier pointer). I cannot >> influence the @data parameter, and I cannot (easily) identify the >> VirtIOBlockDataPlane object from the BlockBackend (which is @data) alone. > Probably like this: > > struct VirtIOBlockDataPlane { > ... > Notifier insert_notifier, remove_notifier; > ... > }; > > static void data_plane_blk_insert_notifier(Notifier *n, void *data) > { > VirtIOBlockDataPlane *s = container_of(n, VirtIOBlockDataPlane, insert_notifier); > assert(s->conf->conf.blk == data); > data_plane_set_up_op_blockers(s); > } > > void virtio_blk_data_plane_create(VirtIODevice *vdev, VirtIOBlkConf *conf, > VirtIOBlockDataPlane **dataplane, > { > ... > s->insert_notifier.notify = data_plane_blk_insert_notifier; > blk_add_insert_bs_notifier(conf->conf.blk, &s->insert_notifier); > ... > } > > ? Oh, right, thanks! >> Won't virtio_scsi_hotunplug() (which frees s->{insert,remove}_notifier) be >> called before a second device is plugged? >> > No, multiple SCSIDevice objects (scsi-disk, scsi-generic, etc...) can be > attached to the same virtio-scsi bus. You're right, I'll see to it. Thanks, Max