@@ -65,7 +65,7 @@ struct BlockBackend {
BlockdevOnError on_read_error, on_write_error;
bool iostatus_enabled;
- BlockDeviceIoStatus iostatus;
+ IoStatus iostatus;
uint64_t perm;
uint64_t shared_perm;
@@ -1198,7 +1198,7 @@ void blk_iostatus_enable(BlockBackend *blk)
{
GLOBAL_STATE_CODE();
blk->iostatus_enabled = true;
- blk->iostatus = BLOCK_DEVICE_IO_STATUS_OK;
+ blk->iostatus = IO_STATUS_OK;
}
/* The I/O status is only enabled if the drive explicitly
@@ -1212,7 +1212,7 @@ bool blk_iostatus_is_enabled(const BlockBackend *blk)
blk->on_read_error == BLOCKDEV_ON_ERROR_STOP));
}
-BlockDeviceIoStatus blk_iostatus(const BlockBackend *blk)
+IoStatus blk_iostatus(const BlockBackend *blk)
{
GLOBAL_STATE_CODE();
return blk->iostatus;
@@ -1228,7 +1228,7 @@ void blk_iostatus_reset(BlockBackend *blk)
{
GLOBAL_STATE_CODE();
if (blk_iostatus_is_enabled(blk)) {
- blk->iostatus = BLOCK_DEVICE_IO_STATUS_OK;
+ blk->iostatus = IO_STATUS_OK;
}
}
@@ -1236,9 +1236,9 @@ void blk_iostatus_set_err(BlockBackend *blk, int error)
{
IO_CODE();
assert(blk_iostatus_is_enabled(blk));
- if (blk->iostatus == BLOCK_DEVICE_IO_STATUS_OK) {
- blk->iostatus = error == ENOSPC ? BLOCK_DEVICE_IO_STATUS_NOSPACE :
- BLOCK_DEVICE_IO_STATUS_FAILED;
+ if (blk->iostatus == IO_STATUS_OK) {
+ blk->iostatus = error == ENOSPC ? IO_STATUS_NOSPACE :
+ IO_STATUS_FAILED;
}
}
@@ -923,7 +923,7 @@ static int coroutine_fn mirror_run(Job *job, Error **errp)
MirrorBDSOpaque *mirror_top_opaque = s->mirror_top_bs->opaque;
BlockDriverState *target_bs = blk_bs(s->target);
bool need_drain = true;
- BlockDeviceIoStatus iostatus;
+ IoStatus iostatus;
int64_t length;
int64_t target_length;
BlockDriverInfo bdi;
@@ -1060,7 +1060,7 @@ static int coroutine_fn mirror_run(Job *job, Error **errp)
iostatus = s->common.iostatus;
}
if (delta < BLOCK_JOB_SLICE_TIME &&
- iostatus == BLOCK_DEVICE_IO_STATUS_OK) {
+ iostatus == IO_STATUS_OK) {
if (s->in_flight >= MAX_IN_FLIGHT || s->buf_free_count == 0 ||
(cnt == 0 && s->in_flight > 0)) {
trace_mirror_yield(s, cnt, s->buf_free_count, s->in_flight);
@@ -642,9 +642,9 @@ static void print_block_info(Monitor *mon, BlockInfo *info,
if (info->qdev) {
monitor_printf(mon, " Attached to: %s\n", info->qdev);
}
- if (info->has_io_status && info->io_status != BLOCK_DEVICE_IO_STATUS_OK) {
+ if (info->has_io_status && info->io_status != IO_STATUS_OK) {
monitor_printf(mon, " I/O status: %s\n",
- BlockDeviceIoStatus_str(info->io_status));
+ IoStatus_str(info->io_status));
}
if (info->removable) {
@@ -394,9 +394,9 @@ BlockJobInfo *block_job_query_locked(BlockJob *job, Error **errp)
/* Called with job lock held */
static void block_job_iostatus_set_err_locked(BlockJob *job, int error)
{
- if (job->iostatus == BLOCK_DEVICE_IO_STATUS_OK) {
- job->iostatus = error == ENOSPC ? BLOCK_DEVICE_IO_STATUS_NOSPACE :
- BLOCK_DEVICE_IO_STATUS_FAILED;
+ if (job->iostatus == IO_STATUS_OK) {
+ job->iostatus = error == ENOSPC ? IO_STATUS_NOSPACE :
+ IO_STATUS_FAILED;
}
}
@@ -550,11 +550,11 @@ fail:
void block_job_iostatus_reset_locked(BlockJob *job)
{
GLOBAL_STATE_CODE();
- if (job->iostatus == BLOCK_DEVICE_IO_STATUS_OK) {
+ if (job->iostatus == IO_STATUS_OK) {
return;
}
assert(job->job.user_paused && job->job.pause_count > 0);
- job->iostatus = BLOCK_DEVICE_IO_STATUS_OK;
+ job->iostatus = IO_STATUS_OK;
}
static void block_job_iostatus_reset(BlockJob *job)
@@ -50,7 +50,7 @@ typedef struct BlockJob {
* Status that is published by the query-block-jobs QMP API.
* Protected by job mutex.
*/
- BlockDeviceIoStatus iostatus;
+ IoStatus iostatus;
/**
* Speed that was set with @block_job_set_speed.
@@ -66,7 +66,7 @@ int GRAPH_UNLOCKED blk_set_perm(BlockBackend *blk, uint64_t perm,
void blk_get_perm(BlockBackend *blk, uint64_t *perm, uint64_t *shared_perm);
void blk_iostatus_enable(BlockBackend *blk);
-BlockDeviceIoStatus blk_iostatus(const BlockBackend *blk);
+IoStatus blk_iostatus(const BlockBackend *blk);
void blk_iostatus_disable(BlockBackend *blk);
void blk_iostatus_reset(BlockBackend *blk);
int blk_attach_dev(BlockBackend *blk, DeviceState *dev);
@@ -571,7 +571,7 @@
'write_threshold': 'int', '*dirty-bitmaps': ['BlockDirtyInfo'] } }
##
-# @BlockDeviceIoStatus:
+# @IoStatus:
#
# An enumeration of block device I/O status.
#
@@ -584,7 +584,7 @@
#
# Since: 1.0
##
-{ 'enum': 'BlockDeviceIoStatus', 'data': [ 'ok', 'failed', 'nospace' ] }
+{ 'enum': 'IoStatus', 'data': [ 'ok', 'failed', 'nospace' ] }
##
# @BlockDirtyInfo:
@@ -705,7 +705,7 @@
# @tray_open: True if the device's tray is open (only present if it
# has a tray)
#
-# @io-status: @BlockDeviceIoStatus. Only present if the device
+# @io-status: @IoStatus. Only present if the device
# supports it and the VM is configured to stop on errors
# (supported device models: virtio-blk, IDE, SCSI except
# scsi-generic)
@@ -718,7 +718,7 @@
{ 'struct': 'BlockInfo',
'data': {'device': 'str', '*qdev': 'str', 'type': 'str', 'removable': 'bool',
'locked': 'bool', '*inserted': 'BlockDeviceInfo',
- '*tray_open': 'bool', '*io-status': 'BlockDeviceIoStatus' } }
+ '*tray_open': 'bool', '*io-status': 'IoStatus' } }
##
# @BlockMeasureInfo:
@@ -1424,7 +1424,7 @@
{ 'union': 'BlockJobInfo',
'base': {'type': 'JobType', 'device': 'str', 'len': 'int',
'offset': 'int', 'busy': 'bool', 'paused': 'bool', 'speed': 'int',
- 'io-status': 'BlockDeviceIoStatus', 'ready': 'bool',
+ 'io-status': 'IoStatus', 'ready': 'bool',
'status': 'JobStatus',
'auto-finalize': 'bool', 'auto-dismiss': 'bool',
'*error': 'str' },
This status is already shared between block-jobs and block-devices, so structure name is misleading a bit. We also will need to use the structure both in block-core.json and job.json. So give it more generic name first. The commit is made by commands: git grep -l BlockDeviceIoStatus | \ xargs sed -i 's/BlockDeviceIoStatus/IoStatus/g' git grep -l BLOCK_DEVICE_IO_STATUS | \ xargs sed -i 's/BLOCK_DEVICE_IO_STATUS/IO_STATUS/g' Signed-off-by: Vladimir Sementsov-Ogievskiy <vsementsov@yandex-team.ru> --- block/block-backend.c | 14 +++++++------- block/mirror.c | 4 ++-- block/monitor/block-hmp-cmds.c | 4 ++-- blockjob.c | 10 +++++----- include/block/blockjob.h | 2 +- include/sysemu/block-backend-global-state.h | 2 +- qapi/block-core.json | 10 +++++----- 7 files changed, 23 insertions(+), 23 deletions(-)