Skip to content
  • Vladimir Sementsov-Ogievskiy's avatar
    fae2681a
    block: drop bdrv_prwv · fae2681a
    Vladimir Sementsov-Ogievskiy authored
    
    
    Now that we are not maintaining boilerplate code for coroutine
    wrappers, there is no more sense in keeping the extra indirection layer
    of bdrv_prwv().  Let's drop it and instead generate pure bdrv_preadv()
    and bdrv_pwritev().
    
    Currently, bdrv_pwritev() and bdrv_preadv() are returning bytes on
    success, auto generated functions will instead return zero, as their
    _co_ prototype. Still, it's simple to make the conversion safe: the
    only external user of bdrv_pwritev() is test-bdrv-drain, and it is
    comfortable enough with bdrv_co_pwritev() instead. So prototypes are
    moved to local block/coroutines.h. Next, the only internal use is
    bdrv_pread() and bdrv_pwrite(), which are modified to return bytes on
    success.
    
    Of course, it would be great to convert bdrv_pread() and bdrv_pwrite()
    to return 0 on success. But this requires audit (and probably
    conversion) of all their users, let's leave it for another day
    refactoring.
    
    Signed-off-by: default avatarVladimir Sementsov-Ogievskiy <vsementsov@virtuozzo.com>
    Signed-off-by: default avatarStefan Hajnoczi <stefanha@redhat.com>
    Reviewed-by: default avatarEric Blake <eblake@redhat.com>
    Reviewed-by: default avatarPhilippe Mathieu-Daudé <philmd@redhat.com>
    Reviewed-by: default avatarStefan Hajnoczi <stefanha@redhat.com>
    Message-Id: <20200924185414.28642-7-vsementsov@virtuozzo.com>
    fae2681a
    block: drop bdrv_prwv
    Vladimir Sementsov-Ogievskiy authored
    
    
    Now that we are not maintaining boilerplate code for coroutine
    wrappers, there is no more sense in keeping the extra indirection layer
    of bdrv_prwv().  Let's drop it and instead generate pure bdrv_preadv()
    and bdrv_pwritev().
    
    Currently, bdrv_pwritev() and bdrv_preadv() are returning bytes on
    success, auto generated functions will instead return zero, as their
    _co_ prototype. Still, it's simple to make the conversion safe: the
    only external user of bdrv_pwritev() is test-bdrv-drain, and it is
    comfortable enough with bdrv_co_pwritev() instead. So prototypes are
    moved to local block/coroutines.h. Next, the only internal use is
    bdrv_pread() and bdrv_pwrite(), which are modified to return bytes on
    success.
    
    Of course, it would be great to convert bdrv_pread() and bdrv_pwrite()
    to return 0 on success. But this requires audit (and probably
    conversion) of all their users, let's leave it for another day
    refactoring.
    
    Signed-off-by: default avatarVladimir Sementsov-Ogievskiy <vsementsov@virtuozzo.com>
    Signed-off-by: default avatarStefan Hajnoczi <stefanha@redhat.com>
    Reviewed-by: default avatarEric Blake <eblake@redhat.com>
    Reviewed-by: default avatarPhilippe Mathieu-Daudé <philmd@redhat.com>
    Reviewed-by: default avatarStefan Hajnoczi <stefanha@redhat.com>
    Message-Id: <20200924185414.28642-7-vsementsov@virtuozzo.com>
Loading