Re: [Qemu-block] [PULL 21/31] block: Avoid bs->blk in bdrv_next()

2016-05-20 Thread Paolo Bonzini
On 20/05/2016 12:26, Kevin Wolf wrote: > Hm, we have a few instances where an iterator variable is used for > multiple loops, so we need to be able to use it in an assignment, i.e. > it should be a compound literal. On the other hand, I seem to remember > that compound literals can't be used as

Re: [Qemu-block] [PULL 21/31] block: Avoid bs->blk in bdrv_next()

2016-05-20 Thread Kevin Wolf
Am 20.05.2016 um 11:39 hat Paolo Bonzini geschrieben: > > > On 20/05/2016 10:10, Kevin Wolf wrote: > >> > Already posted a fix. I chose to keep the interface and free the > >> > BdrvNextIterator inside bdrv_next(), when we return NULL after the last > >> > element. > > Oops, should have actually

Re: [Qemu-block] [PULL 21/31] block: Avoid bs->blk in bdrv_next()

2016-05-20 Thread Paolo Bonzini
On 20/05/2016 10:10, Kevin Wolf wrote: >> > Already posted a fix. I chose to keep the interface and free the >> > BdrvNextIterator inside bdrv_next(), when we return NULL after the last >> > element. > Oops, should have actually read your email... You're right about callers > that prematurely

Re: [Qemu-block] [PULL 21/31] block: Avoid bs->blk in bdrv_next()

2016-05-20 Thread Kevin Wolf
Am 20.05.2016 um 10:05 hat Kevin Wolf geschrieben: > Am 20.05.2016 um 09:54 hat Paolo Bonzini geschrieben: > > > +/* Iterates over all top-level BlockDriverStates, i.e. BDSs that are > > > owned by > > > + * the monitor or attached to a BlockBackend */ > > > +BdrvNextIterator

Re: [Qemu-block] [PULL 21/31] block: Avoid bs->blk in bdrv_next()

2016-05-20 Thread Kevin Wolf
Am 20.05.2016 um 09:54 hat Paolo Bonzini geschrieben: > > > On 19/05/2016 17:21, Kevin Wolf wrote: > > We need to introduce a separate BdrvNextIterator struct that can keep > > more state than just the current BDS in order to avoid using the bs->blk > > pointer. > > > > Signed-off-by: Kevin

Re: [Qemu-block] [PULL 21/31] block: Avoid bs->blk in bdrv_next()

2016-05-20 Thread Paolo Bonzini
On 19/05/2016 17:21, Kevin Wolf wrote: > We need to introduce a separate BdrvNextIterator struct that can keep > more state than just the current BDS in order to avoid using the bs->blk > pointer. > > Signed-off-by: Kevin Wolf > Reviewed-by: Max Reitz >

[Qemu-block] [PULL 21/31] block: Avoid bs->blk in bdrv_next()

2016-05-19 Thread Kevin Wolf
We need to introduce a separate BdrvNextIterator struct that can keep more state than just the current BDS in order to avoid using the bs->blk pointer. Signed-off-by: Kevin Wolf Reviewed-by: Max Reitz --- block.c| 40