@ -199,10 +199,10 @@ qcow2_extract_crypto_opts(QemuOpts *opts, const char *fmt, Error **errp)
* unknown magic is skipped ( future extension this version knows nothing about )
* return 0 upon success , non - 0 otherwise
*/
static int qcow2_read_extensions ( BlockDriverState * bs , uint64_t start_offset ,
uint64_t end_offset , void * * p_feature_table ,
int flags , bool * need_update_header ,
Error * * errp )
static int coroutine_fn GRAPH_RDLOCK
qcow2_read_extensions ( BlockDriverState * bs , uint64_t start_offset ,
uint64_t end_offset , void * * p_feature_table ,
int flags , bool * need_update_header , Error * * errp )
{
BDRVQcow2State * s = bs - > opaque ;
QCowExtension ext ;
@ -228,7 +228,7 @@ static int qcow2_read_extensions(BlockDriverState *bs, uint64_t start_offset,
printf ( " attempting to read extended header in offset %lu \n " , offset ) ;
# endif
ret = bdrv_pread ( bs - > file , offset , sizeof ( ext ) , & ext , 0 ) ;
ret = bdrv_co_ pread ( bs - > file , offset , sizeof ( ext ) , & ext , 0 ) ;
if ( ret < 0 ) {
error_setg_errno ( errp , - ret , " qcow2_read_extension: ERROR: "
" pread fail from offset % " PRIu64 , offset ) ;
@ -256,7 +256,7 @@ static int qcow2_read_extensions(BlockDriverState *bs, uint64_t start_offset,
sizeof ( bs - > backing_format ) ) ;
return 2 ;
}
ret = bdrv_pread ( bs - > file , offset , ext . len , bs - > backing_format , 0 ) ;
ret = bdrv_co_ pread ( bs - > file , offset , ext . len , bs - > backing_format , 0 ) ;
if ( ret < 0 ) {
error_setg_errno ( errp , - ret , " ERROR: ext_backing_format: "
" Could not read format name " ) ;
@ -272,7 +272,7 @@ static int qcow2_read_extensions(BlockDriverState *bs, uint64_t start_offset,
case QCOW2_EXT_MAGIC_FEATURE_TABLE :
if ( p_feature_table ! = NULL ) {
void * feature_table = g_malloc0 ( ext . len + 2 * sizeof ( Qcow2Feature ) ) ;
ret = bdrv_pread ( bs - > file , offset , ext . len , feature_table , 0 ) ;
ret = bdrv_co_ pread ( bs - > file , offset , ext . len , feature_table , 0 ) ;
if ( ret < 0 ) {
error_setg_errno ( errp , - ret , " ERROR: ext_feature_table: "
" Could not read table " ) ;
@ -298,7 +298,7 @@ static int qcow2_read_extensions(BlockDriverState *bs, uint64_t start_offset,
return - EINVAL ;
}
ret = bdrv_pread ( bs - > file , offset , ext . len , & s - > crypto_header , 0 ) ;
ret = bdrv_co_ pread ( bs - > file , offset , ext . len , & s - > crypto_header , 0 ) ;
if ( ret < 0 ) {
error_setg_errno ( errp , - ret ,
" Unable to read CRYPTO header extension " ) ;
@ -354,7 +354,7 @@ static int qcow2_read_extensions(BlockDriverState *bs, uint64_t start_offset,
break ;
}
ret = bdrv_pread ( bs - > file , offset , ext . len , & bitmaps_ext , 0 ) ;
ret = bdrv_co_ pread ( bs - > file , offset , ext . len , & bitmaps_ext , 0 ) ;
if ( ret < 0 ) {
error_setg_errno ( errp , - ret , " bitmaps_ext: "
" Could not read ext header " ) ;
@ -418,7 +418,7 @@ static int qcow2_read_extensions(BlockDriverState *bs, uint64_t start_offset,
case QCOW2_EXT_MAGIC_DATA_FILE :
{
s - > image_data_file = g_malloc0 ( ext . len + 1 ) ;
ret = bdrv_pread ( bs - > file , offset , ext . len , s - > image_data_file , 0 ) ;
ret = bdrv_co_ pread ( bs - > file , offset , ext . len , s - > image_data_file , 0 ) ;
if ( ret < 0 ) {
error_setg_errno ( errp , - ret ,
" ERROR: Could not read data file name " ) ;
@ -442,7 +442,7 @@ static int qcow2_read_extensions(BlockDriverState *bs, uint64_t start_offset,
uext - > len = ext . len ;
QLIST_INSERT_HEAD ( & s - > unknown_header_ext , uext , next ) ;
ret = bdrv_pread ( bs - > file , offset , uext - > len , uext - > data , 0 ) ;
ret = bdrv_co_ pread ( bs - > file , offset , uext - > len , uext - > data , 0 ) ;
if ( ret < 0 ) {
error_setg_errno ( errp , - ret , " ERROR: unknown extension: "
" Could not read data " ) ;
@ -1241,8 +1241,9 @@ static void qcow2_update_options_abort(BlockDriverState *bs,
qapi_free_QCryptoBlockOpenOptions ( r - > crypto_opts ) ;
}
static int qcow2_update_options ( BlockDriverState * bs , QDict * options ,
int flags , Error * * errp )
static int coroutine_fn
qcow2_update_options ( BlockDriverState * bs , QDict * options , int flags ,
Error * * errp )
{
Qcow2ReopenState r = { } ;
int ret ;