diff options
author | Markus Armbruster <armbru@redhat.com> | 2014-10-07 13:59:11 +0200 |
---|---|---|
committer | Kevin Wolf <kwolf@redhat.com> | 2014-10-20 13:41:26 +0200 |
commit | bfb197e0d998bea8741c65492b2b42f443729249 (patch) | |
tree | c7b9a48dc7dd7790d678a7a13f5ba245931876ad /block | |
parent | fea68bb6e9fa65c7cc6caa6adda810d1d0fdbde4 (diff) |
block: Eliminate BlockDriverState member device_name[]
device_name[] can become non-empty only in bdrv_new_root() and
bdrv_move_feature_fields(). The latter is used only to undo damage
done by bdrv_swap(). The former is called only by blk_new_with_bs().
Therefore, when a BlockDriverState's device_name[] is non-empty, then
it's been created with a BlockBackend, and vice versa. Furthermore,
blk_new_with_bs() keeps the two names equal.
Therefore, device_name[] is redundant. Eliminate it.
Signed-off-by: Markus Armbruster <armbru@redhat.com>
Reviewed-by: Max Reitz <mreitz@redhat.com>
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
Diffstat (limited to 'block')
-rw-r--r-- | block/mirror.c | 3 | ||||
-rw-r--r-- | block/qapi.c | 6 | ||||
-rw-r--r-- | block/qcow.c | 4 | ||||
-rw-r--r-- | block/qcow2.c | 4 | ||||
-rw-r--r-- | block/qed.c | 2 | ||||
-rw-r--r-- | block/quorum.c | 4 | ||||
-rw-r--r-- | block/vdi.c | 2 | ||||
-rw-r--r-- | block/vhdx.c | 2 | ||||
-rw-r--r-- | block/vmdk.c | 4 | ||||
-rw-r--r-- | block/vpc.c | 2 | ||||
-rw-r--r-- | block/vvfat.c | 2 |
11 files changed, 18 insertions, 17 deletions
diff --git a/block/mirror.c b/block/mirror.c index 18b18e0353..829be2f88a 100644 --- a/block/mirror.c +++ b/block/mirror.c @@ -567,7 +567,8 @@ static void mirror_complete(BlockJob *job, Error **errp) return; } if (!s->synced) { - error_set(errp, QERR_BLOCK_JOB_NOT_READY, job->bs->device_name); + error_set(errp, QERR_BLOCK_JOB_NOT_READY, + bdrv_get_device_name(job->bs)); return; } diff --git a/block/qapi.c b/block/qapi.c index 9733ebd328..d071ee564e 100644 --- a/block/qapi.c +++ b/block/qapi.c @@ -272,7 +272,7 @@ void bdrv_query_info(BlockDriverState *bs, BlockDriverState *bs0; ImageInfo **p_image_info; Error *local_err = NULL; - info->device = g_strdup(bs->device_name); + info->device = g_strdup(bdrv_get_device_name(bs)); info->type = g_strdup("unknown"); info->locked = bdrv_dev_is_medium_locked(bs); info->removable = bdrv_dev_has_removable_media(bs); @@ -327,9 +327,9 @@ static BlockStats *bdrv_query_stats(const BlockDriverState *bs) s = g_malloc0(sizeof(*s)); - if (bs->device_name[0]) { + if (bdrv_get_device_name(bs)[0]) { s->has_device = true; - s->device = g_strdup(bs->device_name); + s->device = g_strdup(bdrv_get_device_name(bs)); } s->stats = g_malloc0(sizeof(*s->stats)); diff --git a/block/qcow.c b/block/qcow.c index a87bd692f0..ece22697a6 100644 --- a/block/qcow.c +++ b/block/qcow.c @@ -124,7 +124,7 @@ static int qcow_open(BlockDriverState *bs, QDict *options, int flags, snprintf(version, sizeof(version), "QCOW version %" PRIu32, header.version); error_set(errp, QERR_UNKNOWN_BLOCK_FORMAT_FEATURE, - bs->device_name, "qcow", version); + bdrv_get_device_name(bs), "qcow", version); ret = -ENOTSUP; goto fail; } @@ -231,7 +231,7 @@ static int qcow_open(BlockDriverState *bs, QDict *options, int flags, /* Disable migration when qcow images are used */ error_set(&s->migration_blocker, QERR_BLOCK_FORMAT_FEATURE_NOT_SUPPORTED, - "qcow", bs->device_name, "live migration"); + "qcow", bdrv_get_device_name(bs), "live migration"); migrate_add_blocker(s->migration_blocker); qemu_co_mutex_init(&s->lock); diff --git a/block/qcow2.c b/block/qcow2.c index fb28493c02..156a219993 100644 --- a/block/qcow2.c +++ b/block/qcow2.c @@ -206,8 +206,8 @@ static void GCC_FMT_ATTR(3, 4) report_unsupported(BlockDriverState *bs, vsnprintf(msg, sizeof(msg), fmt, ap); va_end(ap); - error_set(errp, QERR_UNKNOWN_BLOCK_FORMAT_FEATURE, bs->device_name, "qcow2", - msg); + error_set(errp, QERR_UNKNOWN_BLOCK_FORMAT_FEATURE, + bdrv_get_device_name(bs), "qcow2", msg); } static void report_unsupported_feature(BlockDriverState *bs, diff --git a/block/qed.c b/block/qed.c index e2316d7ff0..7f03c26227 100644 --- a/block/qed.c +++ b/block/qed.c @@ -408,7 +408,7 @@ static int bdrv_qed_open(BlockDriverState *bs, QDict *options, int flags, snprintf(buf, sizeof(buf), "%" PRIx64, s->header.features & ~QED_FEATURE_MASK); error_set(errp, QERR_UNKNOWN_BLOCK_FORMAT_FEATURE, - bs->device_name, "QED", buf); + bdrv_get_device_name(bs), "QED", buf); return -ENOTSUP; } if (!qed_is_cluster_size_valid(s->header.cluster_size)) { diff --git a/block/quorum.c b/block/quorum.c index 7687466733..6ce5904824 100644 --- a/block/quorum.c +++ b/block/quorum.c @@ -226,8 +226,8 @@ static void quorum_report_bad(QuorumAIOCB *acb, char *node_name, int ret) static void quorum_report_failure(QuorumAIOCB *acb) { - const char *reference = acb->common.bs->device_name[0] ? - acb->common.bs->device_name : + const char *reference = bdrv_get_device_name(acb->common.bs)[0] ? + bdrv_get_device_name(acb->common.bs) : acb->common.bs->node_name; qapi_event_send_quorum_failure(reference, acb->sector_num, diff --git a/block/vdi.c b/block/vdi.c index cfa08b0b93..9604721476 100644 --- a/block/vdi.c +++ b/block/vdi.c @@ -490,7 +490,7 @@ static int vdi_open(BlockDriverState *bs, QDict *options, int flags, /* Disable migration when vdi images are used */ error_set(&s->migration_blocker, QERR_BLOCK_FORMAT_FEATURE_NOT_SUPPORTED, - "vdi", bs->device_name, "live migration"); + "vdi", bdrv_get_device_name(bs), "live migration"); migrate_add_blocker(s->migration_blocker); return 0; diff --git a/block/vhdx.c b/block/vhdx.c index b0464487a5..12bfe75e51 100644 --- a/block/vhdx.c +++ b/block/vhdx.c @@ -1004,7 +1004,7 @@ static int vhdx_open(BlockDriverState *bs, QDict *options, int flags, /* Disable migration when VHDX images are used */ error_set(&s->migration_blocker, QERR_BLOCK_FORMAT_FEATURE_NOT_SUPPORTED, - "vhdx", bs->device_name, "live migration"); + "vhdx", bdrv_get_device_name(bs), "live migration"); migrate_add_blocker(s->migration_blocker); return 0; diff --git a/block/vmdk.c b/block/vmdk.c index 4ae6c75310..673d3f5fb4 100644 --- a/block/vmdk.c +++ b/block/vmdk.c @@ -657,7 +657,7 @@ static int vmdk_open_vmdk4(BlockDriverState *bs, snprintf(buf, sizeof(buf), "VMDK version %" PRId32, le32_to_cpu(header.version)); error_set(errp, QERR_UNKNOWN_BLOCK_FORMAT_FEATURE, - bs->device_name, "vmdk", buf); + bdrv_get_device_name(bs), "vmdk", buf); return -ENOTSUP; } else if (le32_to_cpu(header.version) == 3 && (flags & BDRV_O_RDWR)) { /* VMware KB 2064959 explains that version 3 added support for @@ -939,7 +939,7 @@ static int vmdk_open(BlockDriverState *bs, QDict *options, int flags, /* Disable migration when VMDK images are used */ error_set(&s->migration_blocker, QERR_BLOCK_FORMAT_FEATURE_NOT_SUPPORTED, - "vmdk", bs->device_name, "live migration"); + "vmdk", bdrv_get_device_name(bs), "live migration"); migrate_add_blocker(s->migration_blocker); g_free(buf); return 0; diff --git a/block/vpc.c b/block/vpc.c index e08144a76e..38c4f02fff 100644 --- a/block/vpc.c +++ b/block/vpc.c @@ -320,7 +320,7 @@ static int vpc_open(BlockDriverState *bs, QDict *options, int flags, /* Disable migration when VHD images are used */ error_set(&s->migration_blocker, QERR_BLOCK_FORMAT_FEATURE_NOT_SUPPORTED, - "vpc", bs->device_name, "live migration"); + "vpc", bdrv_get_device_name(bs), "live migration"); migrate_add_blocker(s->migration_blocker); return 0; diff --git a/block/vvfat.c b/block/vvfat.c index 6c9fde017b..cefe3a4f79 100644 --- a/block/vvfat.c +++ b/block/vvfat.c @@ -1182,7 +1182,7 @@ static int vvfat_open(BlockDriverState *bs, QDict *options, int flags, if (s->qcow) { error_set(&s->migration_blocker, QERR_BLOCK_FORMAT_FEATURE_NOT_SUPPORTED, - "vvfat (rw)", bs->device_name, "live migration"); + "vvfat (rw)", bdrv_get_device_name(bs), "live migration"); migrate_add_blocker(s->migration_blocker); } |