From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([140.186.70.92]:42431) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1RMGgw-0007gx-VC for qemu-devel@nongnu.org; Fri, 04 Nov 2011 06:08:07 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1RMGgv-00038c-LI for qemu-devel@nongnu.org; Fri, 04 Nov 2011 06:08:06 -0400 Received: from mx1.redhat.com ([209.132.183.28]:13307) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1RMGgv-00034q-91 for qemu-devel@nongnu.org; Fri, 04 Nov 2011 06:08:05 -0400 Message-ID: <4EB3B8CF.4060105@redhat.com> Date: Fri, 04 Nov 2011 11:05:03 +0100 From: Kevin Wolf MIME-Version: 1.0 References: <20111030103327.31685.17045.sendpatchset@skannery.in.ibm.com> <20111030103509.31685.87434.sendpatchset@skannery.in.ibm.com> In-Reply-To: <20111030103509.31685.87434.sendpatchset@skannery.in.ibm.com> Content-Type: text/plain; charset=ISO-8859-15 Content-Transfer-Encoding: 7bit Subject: Re: [Qemu-devel] [v8 Patch 5/6]Qemu: Framework for reopening images safely List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Supriya Kannery Cc: Stefan Hajnoczi , qemu-devel@nongnu.org, Christoph Hellwig Am 30.10.2011 11:35, schrieb Supriya Kannery: > Struct BDRVReopenState along with three reopen related functions > introduced for handling reopen state of images safely. This can be > extended by each of the block drivers to reopen respective > image files. > > Signed-off-by: Supriya Kannery > Index: qemu/block_int.h > =================================================================== > --- qemu.orig/block_int.h > +++ qemu/block_int.h > @@ -55,6 +55,14 @@ struct BlockDriver { > int (*bdrv_probe)(const uint8_t *buf, int buf_size, const char *filename); > int (*bdrv_probe_device)(const char *filename); > int (*bdrv_open)(BlockDriverState *bs, int flags); > + > + /* For handling image reopen for split or non-split files */ > + int (*bdrv_reopen_prepare)(BlockDriverState *bs, BDRVReopenState **rs, > + int flags); > + void (*bdrv_reopen_commit)(BlockDriverState *bs, BDRVReopenState *rs, > + int flags); > + void (*bdrv_reopen_abort)(BlockDriverState *bs, BDRVReopenState *rs); > + > int (*bdrv_file_open)(BlockDriverState *bs, const char *filename, int flags); > int (*bdrv_read)(BlockDriverState *bs, int64_t sector_num, > uint8_t *buf, int nb_sectors); > @@ -211,6 +219,14 @@ struct BlockDriverState { > void *private; > }; > > +struct BDRVReopenState { > + BlockDriverState *bs; > + int reopen_flags; > + > + /* For raw-posix */ > + int reopen_fd; > +}; I think I commented the same on the previous version: BDRVReopenState shouldn't contain any format specific fields. raw-posix must extend the struct like this and use container_of() to get it from a BDRVReopenState pointer: struct BDRVRawReopenState { BDRVReopenState common; int reopen_fd; }; Kevin