On 2/7/19 12:40 PM, Peter Maydell wrote:
>
>> NBDExport *nbd_export_new(BlockDriverState *bs, off_t dev_offset, off_t
>> size,
>> const char *name, const char *description,
>> - uint16_t nbdflags, void (*close)(NBDExport *),
>> - bool writethrough, BlockBackend *on_eject_blk,
>> - Error **errp)
>> + const char *bitmap, uint16_t nbdflags,
>> + void (*close)(NBDExport *), bool writethrough,
>> + BlockBackend *on_eject_blk, Error **errp)
>> {
>> AioContext *ctx;
>> BlockBackend *blk;
>> @@ -1507,6 +1507,43 @@ NBDExport *nbd_export_new(BlockDriverState *bs, off_t
>> dev_offset, off_t size,
>> }
>> exp->size -= exp->size % BDRV_SECTOR_SIZE;
>>
>> + if (bitmap) {
>> + BdrvDirtyBitmap *bm = NULL;
>> + BlockDriverState *bs = blk_bs(blk);
>
> lgtm.com points out that this local variable 'bs' shadows
> the 'bs' argument to the function. Is this intentional?No, I will fix. > I think that the two can't ever be different, in which case > you could just delete the variable declaration here, but > I'm not an expert on the block layer APIs. Yes, that looks right to me as well, since we just barely called blk_insert_bs(blk, bs, errp) a few lines above. (Someday, it would be nice to turn -Wshadow on, to catch stuff like this sooner) -- Eric Blake, Principal Software Engineer Red Hat, Inc. +1-919-301-3226 Virtualization: qemu.org | libvirt.org
signature.asc
Description: OpenPGP digital signature
