Commit bfb197e0 authored by Markus Armbruster's avatar Markus Armbruster Committed by Kevin Wolf

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: default avatarMarkus Armbruster <armbru@redhat.com>
Reviewed-by: default avatarMax Reitz <mreitz@redhat.com>
Signed-off-by: default avatarKevin Wolf <kwolf@redhat.com>
parent fea68bb6
...@@ -14,7 +14,9 @@ ...@@ -14,7 +14,9 @@
*/ */
#include "qemu-common.h" #include "qemu-common.h"
#include "block/block_int.h" #include "block/block.h"
#include "qemu/error-report.h"
#include "qemu/main-loop.h"
#include "hw/hw.h" #include "hw/hw.h"
#include "qemu/queue.h" #include "qemu/queue.h"
#include "qemu/timer.h" #include "qemu/timer.h"
...@@ -130,9 +132,9 @@ static void blk_send(QEMUFile *f, BlkMigBlock * blk) ...@@ -130,9 +132,9 @@ static void blk_send(QEMUFile *f, BlkMigBlock * blk)
| flags); | flags);
/* device name */ /* device name */
len = strlen(blk->bmds->bs->device_name); len = strlen(bdrv_get_device_name(blk->bmds->bs));
qemu_put_byte(f, len); qemu_put_byte(f, len);
qemu_put_buffer(f, (uint8_t *)blk->bmds->bs->device_name, len); qemu_put_buffer(f, (uint8_t *)bdrv_get_device_name(blk->bmds->bs), len);
/* if a block is zero we need to flush here since the network /* if a block is zero we need to flush here since the network
* bandwidth is now a lot higher than the storage device bandwidth. * bandwidth is now a lot higher than the storage device bandwidth.
...@@ -382,9 +384,9 @@ static void init_blk_migration(QEMUFile *f) ...@@ -382,9 +384,9 @@ static void init_blk_migration(QEMUFile *f)
if (bmds->shared_base) { if (bmds->shared_base) {
DPRINTF("Start migration for %s with shared base image\n", DPRINTF("Start migration for %s with shared base image\n",
bs->device_name); bdrv_get_device_name(bs));
} else { } else {
DPRINTF("Start full migration for %s\n", bs->device_name); DPRINTF("Start full migration for %s\n", bdrv_get_device_name(bs));
} }
QSIMPLEQ_INSERT_TAIL(&block_mig_state.bmds_list, bmds, entry); QSIMPLEQ_INSERT_TAIL(&block_mig_state.bmds_list, bmds, entry);
......
...@@ -28,6 +28,7 @@ ...@@ -28,6 +28,7 @@
#include "block/blockjob.h" #include "block/blockjob.h"
#include "qemu/module.h" #include "qemu/module.h"
#include "qapi/qmp/qjson.h" #include "qapi/qmp/qjson.h"
#include "sysemu/block-backend.h"
#include "sysemu/sysemu.h" #include "sysemu/sysemu.h"
#include "qemu/notify.h" #include "qemu/notify.h"
#include "block/coroutine.h" #include "block/coroutine.h"
...@@ -360,9 +361,7 @@ BlockDriverState *bdrv_new_root(const char *device_name, Error **errp) ...@@ -360,9 +361,7 @@ BlockDriverState *bdrv_new_root(const char *device_name, Error **errp)
bs = bdrv_new(); bs = bdrv_new();
pstrcpy(bs->device_name, sizeof(bs->device_name), device_name);
QTAILQ_INSERT_TAIL(&bdrv_states, bs, device_list); QTAILQ_INSERT_TAIL(&bdrv_states, bs, device_list);
return bs; return bs;
} }
...@@ -1168,7 +1167,7 @@ void bdrv_set_backing_hd(BlockDriverState *bs, BlockDriverState *backing_hd) ...@@ -1168,7 +1167,7 @@ void bdrv_set_backing_hd(BlockDriverState *bs, BlockDriverState *backing_hd)
} else if (backing_hd) { } else if (backing_hd) {
error_setg(&bs->backing_blocker, error_setg(&bs->backing_blocker,
"device is used as backing hd of '%s'", "device is used as backing hd of '%s'",
bs->device_name); bdrv_get_device_name(bs));
} }
bs->backing_hd = backing_hd; bs->backing_hd = backing_hd;
...@@ -1542,7 +1541,7 @@ int bdrv_open(BlockDriverState **pbs, const char *filename, ...@@ -1542,7 +1541,7 @@ int bdrv_open(BlockDriverState **pbs, const char *filename,
} else { } else {
error_setg(errp, "Block format '%s' used by device '%s' doesn't " error_setg(errp, "Block format '%s' used by device '%s' doesn't "
"support the option '%s'", drv->format_name, "support the option '%s'", drv->format_name,
bs->device_name, entry->key); bdrv_get_device_name(bs), entry->key);
} }
ret = -EINVAL; ret = -EINVAL;
...@@ -1749,7 +1748,7 @@ int bdrv_reopen_prepare(BDRVReopenState *reopen_state, BlockReopenQueue *queue, ...@@ -1749,7 +1748,7 @@ int bdrv_reopen_prepare(BDRVReopenState *reopen_state, BlockReopenQueue *queue,
if (!(reopen_state->bs->open_flags & BDRV_O_ALLOW_RDWR) && if (!(reopen_state->bs->open_flags & BDRV_O_ALLOW_RDWR) &&
reopen_state->flags & BDRV_O_RDWR) { reopen_state->flags & BDRV_O_RDWR) {
error_set(errp, QERR_DEVICE_IS_READ_ONLY, error_set(errp, QERR_DEVICE_IS_READ_ONLY,
reopen_state->bs->device_name); bdrv_get_device_name(reopen_state->bs));
goto error; goto error;
} }
...@@ -1776,7 +1775,7 @@ int bdrv_reopen_prepare(BDRVReopenState *reopen_state, BlockReopenQueue *queue, ...@@ -1776,7 +1775,7 @@ int bdrv_reopen_prepare(BDRVReopenState *reopen_state, BlockReopenQueue *queue,
/* It is currently mandatory to have a bdrv_reopen_prepare() /* It is currently mandatory to have a bdrv_reopen_prepare()
* handler for each supported drv. */ * handler for each supported drv. */
error_set(errp, QERR_BLOCK_FORMAT_FEATURE_NOT_SUPPORTED, error_set(errp, QERR_BLOCK_FORMAT_FEATURE_NOT_SUPPORTED,
drv->format_name, reopen_state->bs->device_name, drv->format_name, bdrv_get_device_name(reopen_state->bs),
"reopening of file"); "reopening of file");
ret = -1; ret = -1;
goto error; goto error;
...@@ -1964,10 +1963,17 @@ void bdrv_drain_all(void) ...@@ -1964,10 +1963,17 @@ void bdrv_drain_all(void)
Also, NULL terminate the device_name to prevent double remove */ Also, NULL terminate the device_name to prevent double remove */
void bdrv_make_anon(BlockDriverState *bs) void bdrv_make_anon(BlockDriverState *bs)
{ {
if (bs->device_name[0] != '\0') { /*
* Take care to remove bs from bdrv_states only when it's actually
* in it. Note that bs->device_list.tqe_prev is initially null,
* and gets set to non-null by QTAILQ_INSERT_TAIL(). Establish
* the useful invariant "bs in bdrv_states iff bs->tqe_prev" by
* resetting it to null on remove.
*/
if (bs->device_list.tqe_prev) {
QTAILQ_REMOVE(&bdrv_states, bs, device_list); QTAILQ_REMOVE(&bdrv_states, bs, device_list);
bs->device_list.tqe_prev = NULL;
} }
bs->device_name[0] = '\0';
if (bs->node_name[0] != '\0') { if (bs->node_name[0] != '\0') {
QTAILQ_REMOVE(&graph_bdrv_states, bs, node_list); QTAILQ_REMOVE(&graph_bdrv_states, bs, node_list);
} }
...@@ -2021,8 +2027,6 @@ static void bdrv_move_feature_fields(BlockDriverState *bs_dest, ...@@ -2021,8 +2027,6 @@ static void bdrv_move_feature_fields(BlockDriverState *bs_dest,
bs_dest->job = bs_src->job; bs_dest->job = bs_src->job;
/* keep the same entry in bdrv_states */ /* keep the same entry in bdrv_states */
pstrcpy(bs_dest->device_name, sizeof(bs_dest->device_name),
bs_src->device_name);
bs_dest->device_list = bs_src->device_list; bs_dest->device_list = bs_src->device_list;
bs_dest->blk = bs_src->blk; bs_dest->blk = bs_src->blk;
...@@ -2038,7 +2042,7 @@ static void bdrv_move_feature_fields(BlockDriverState *bs_dest, ...@@ -2038,7 +2042,7 @@ static void bdrv_move_feature_fields(BlockDriverState *bs_dest,
* This will modify the BlockDriverState fields, and swap contents * This will modify the BlockDriverState fields, and swap contents
* between bs_new and bs_old. Both bs_new and bs_old are modified. * between bs_new and bs_old. Both bs_new and bs_old are modified.
* *
* bs_new must be nameless and not attached to a BlockBackend. * bs_new must not be attached to a BlockBackend.
* *
* This function does not create any image files. * This function does not create any image files.
*/ */
...@@ -2057,8 +2061,7 @@ void bdrv_swap(BlockDriverState *bs_new, BlockDriverState *bs_old) ...@@ -2057,8 +2061,7 @@ void bdrv_swap(BlockDriverState *bs_new, BlockDriverState *bs_old)
QTAILQ_REMOVE(&graph_bdrv_states, bs_old, node_list); QTAILQ_REMOVE(&graph_bdrv_states, bs_old, node_list);
} }
/* bs_new must be nameless and shouldn't have anything fancy enabled */ /* bs_new must be unattached and shouldn't have anything fancy enabled */
assert(bs_new->device_name[0] == '\0');
assert(!bs_new->blk); assert(!bs_new->blk);
assert(QLIST_EMPTY(&bs_new->dirty_bitmaps)); assert(QLIST_EMPTY(&bs_new->dirty_bitmaps));
assert(bs_new->job == NULL); assert(bs_new->job == NULL);
...@@ -2075,8 +2078,7 @@ void bdrv_swap(BlockDriverState *bs_new, BlockDriverState *bs_old) ...@@ -2075,8 +2078,7 @@ void bdrv_swap(BlockDriverState *bs_new, BlockDriverState *bs_old)
bdrv_move_feature_fields(bs_old, bs_new); bdrv_move_feature_fields(bs_old, bs_new);
bdrv_move_feature_fields(bs_new, &tmp); bdrv_move_feature_fields(bs_new, &tmp);
/* bs_new must remain nameless and unattached */ /* bs_new must remain unattached */
assert(bs_new->device_name[0] == '\0');
assert(!bs_new->blk); assert(!bs_new->blk);
/* Check a few fields that should remain attached to the device */ /* Check a few fields that should remain attached to the device */
...@@ -2104,7 +2106,7 @@ void bdrv_swap(BlockDriverState *bs_new, BlockDriverState *bs_old) ...@@ -2104,7 +2106,7 @@ void bdrv_swap(BlockDriverState *bs_new, BlockDriverState *bs_old)
* This will modify the BlockDriverState fields, and swap contents * This will modify the BlockDriverState fields, and swap contents
* between bs_new and bs_top. Both bs_new and bs_top are modified. * between bs_new and bs_top. Both bs_new and bs_top are modified.
* *
* bs_new must be nameless and not attached to a BlockBackend. * bs_new must not be attached to a BlockBackend.
* *
* This function does not create any image files. * This function does not create any image files.
*/ */
...@@ -3820,7 +3822,7 @@ BlockDriverState *bdrv_find(const char *name) ...@@ -3820,7 +3822,7 @@ BlockDriverState *bdrv_find(const char *name)
BlockDriverState *bs; BlockDriverState *bs;
QTAILQ_FOREACH(bs, &bdrv_states, device_list) { QTAILQ_FOREACH(bs, &bdrv_states, device_list) {
if (!strcmp(name, bs->device_name)) { if (!strcmp(name, bdrv_get_device_name(bs))) {
return bs; return bs;
} }
} }
...@@ -3906,9 +3908,9 @@ BlockDriverState *bdrv_next(BlockDriverState *bs) ...@@ -3906,9 +3908,9 @@ BlockDriverState *bdrv_next(BlockDriverState *bs)
return QTAILQ_NEXT(bs, device_list); return QTAILQ_NEXT(bs, device_list);
} }
const char *bdrv_get_device_name(BlockDriverState *bs) const char *bdrv_get_device_name(const BlockDriverState *bs)
{ {
return bs->device_name; return bs->blk ? blk_name(bs->blk) : "";
} }
int bdrv_get_flags(BlockDriverState *bs) int bdrv_get_flags(BlockDriverState *bs)
...@@ -5262,13 +5264,15 @@ int bdrv_media_changed(BlockDriverState *bs) ...@@ -5262,13 +5264,15 @@ int bdrv_media_changed(BlockDriverState *bs)
void bdrv_eject(BlockDriverState *bs, bool eject_flag) void bdrv_eject(BlockDriverState *bs, bool eject_flag)
{ {
BlockDriver *drv = bs->drv; BlockDriver *drv = bs->drv;
const char *device_name;
if (drv && drv->bdrv_eject) { if (drv && drv->bdrv_eject) {
drv->bdrv_eject(bs, eject_flag); drv->bdrv_eject(bs, eject_flag);
} }
if (bs->device_name[0] != '\0') { device_name = bdrv_get_device_name(bs);
qapi_event_send_device_tray_moved(bdrv_get_device_name(bs), if (device_name[0] != '\0') {
qapi_event_send_device_tray_moved(device_name,
eject_flag, &error_abort); eject_flag, &error_abort);
} }
} }
...@@ -5478,7 +5482,8 @@ bool bdrv_op_is_blocked(BlockDriverState *bs, BlockOpType op, Error **errp) ...@@ -5478,7 +5482,8 @@ bool bdrv_op_is_blocked(BlockDriverState *bs, BlockOpType op, Error **errp)
blocker = QLIST_FIRST(&bs->op_blockers[op]); blocker = QLIST_FIRST(&bs->op_blockers[op]);
if (errp) { if (errp) {
error_setg(errp, "Device '%s' is busy: %s", error_setg(errp, "Device '%s' is busy: %s",
bs->device_name, error_get_pretty(blocker->reason)); bdrv_get_device_name(bs),
error_get_pretty(blocker->reason));
} }
return true; return true;
} }
......
...@@ -567,7 +567,8 @@ static void mirror_complete(BlockJob *job, Error **errp) ...@@ -567,7 +567,8 @@ static void mirror_complete(BlockJob *job, Error **errp)
return; return;
} }
if (!s->synced) { 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; return;
} }
......
...@@ -272,7 +272,7 @@ void bdrv_query_info(BlockDriverState *bs, ...@@ -272,7 +272,7 @@ void bdrv_query_info(BlockDriverState *bs,
BlockDriverState *bs0; BlockDriverState *bs0;
ImageInfo **p_image_info; ImageInfo **p_image_info;
Error *local_err = NULL; 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->type = g_strdup("unknown");
info->locked = bdrv_dev_is_medium_locked(bs); info->locked = bdrv_dev_is_medium_locked(bs);
info->removable = bdrv_dev_has_removable_media(bs); info->removable = bdrv_dev_has_removable_media(bs);
...@@ -327,9 +327,9 @@ static BlockStats *bdrv_query_stats(const BlockDriverState *bs) ...@@ -327,9 +327,9 @@ static BlockStats *bdrv_query_stats(const BlockDriverState *bs)
s = g_malloc0(sizeof(*s)); s = g_malloc0(sizeof(*s));
if (bs->device_name[0]) { if (bdrv_get_device_name(bs)[0]) {
s->has_device = true; 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)); s->stats = g_malloc0(sizeof(*s->stats));
......
...@@ -124,7 +124,7 @@ static int qcow_open(BlockDriverState *bs, QDict *options, int flags, ...@@ -124,7 +124,7 @@ static int qcow_open(BlockDriverState *bs, QDict *options, int flags,
snprintf(version, sizeof(version), "QCOW version %" PRIu32, snprintf(version, sizeof(version), "QCOW version %" PRIu32,
header.version); header.version);
error_set(errp, QERR_UNKNOWN_BLOCK_FORMAT_FEATURE, error_set(errp, QERR_UNKNOWN_BLOCK_FORMAT_FEATURE,
bs->device_name, "qcow", version); bdrv_get_device_name(bs), "qcow", version);
ret = -ENOTSUP; ret = -ENOTSUP;
goto fail; goto fail;
} }
...@@ -231,7 +231,7 @@ static int qcow_open(BlockDriverState *bs, QDict *options, int flags, ...@@ -231,7 +231,7 @@ static int qcow_open(BlockDriverState *bs, QDict *options, int flags,
/* Disable migration when qcow images are used */ /* Disable migration when qcow images are used */
error_set(&s->migration_blocker, error_set(&s->migration_blocker,
QERR_BLOCK_FORMAT_FEATURE_NOT_SUPPORTED, 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); migrate_add_blocker(s->migration_blocker);
qemu_co_mutex_init(&s->lock); qemu_co_mutex_init(&s->lock);
......
...@@ -206,8 +206,8 @@ static void GCC_FMT_ATTR(3, 4) report_unsupported(BlockDriverState *bs, ...@@ -206,8 +206,8 @@ static void GCC_FMT_ATTR(3, 4) report_unsupported(BlockDriverState *bs,
vsnprintf(msg, sizeof(msg), fmt, ap); vsnprintf(msg, sizeof(msg), fmt, ap);
va_end(ap); va_end(ap);
error_set(errp, QERR_UNKNOWN_BLOCK_FORMAT_FEATURE, bs->device_name, "qcow2", error_set(errp, QERR_UNKNOWN_BLOCK_FORMAT_FEATURE,
msg); bdrv_get_device_name(bs), "qcow2", msg);
} }
static void report_unsupported_feature(BlockDriverState *bs, static void report_unsupported_feature(BlockDriverState *bs,
......
...@@ -408,7 +408,7 @@ static int bdrv_qed_open(BlockDriverState *bs, QDict *options, int flags, ...@@ -408,7 +408,7 @@ static int bdrv_qed_open(BlockDriverState *bs, QDict *options, int flags,
snprintf(buf, sizeof(buf), "%" PRIx64, snprintf(buf, sizeof(buf), "%" PRIx64,
s->header.features & ~QED_FEATURE_MASK); s->header.features & ~QED_FEATURE_MASK);
error_set(errp, QERR_UNKNOWN_BLOCK_FORMAT_FEATURE, error_set(errp, QERR_UNKNOWN_BLOCK_FORMAT_FEATURE,
bs->device_name, "QED", buf); bdrv_get_device_name(bs), "QED", buf);
return -ENOTSUP; return -ENOTSUP;
} }
if (!qed_is_cluster_size_valid(s->header.cluster_size)) { if (!qed_is_cluster_size_valid(s->header.cluster_size)) {
......
...@@ -226,8 +226,8 @@ static void quorum_report_bad(QuorumAIOCB *acb, char *node_name, int ret) ...@@ -226,8 +226,8 @@ static void quorum_report_bad(QuorumAIOCB *acb, char *node_name, int ret)
static void quorum_report_failure(QuorumAIOCB *acb) static void quorum_report_failure(QuorumAIOCB *acb)
{ {
const char *reference = acb->common.bs->device_name[0] ? const char *reference = bdrv_get_device_name(acb->common.bs)[0] ?
acb->common.bs->device_name : bdrv_get_device_name(acb->common.bs) :
acb->common.bs->node_name; acb->common.bs->node_name;
qapi_event_send_quorum_failure(reference, acb->sector_num, qapi_event_send_quorum_failure(reference, acb->sector_num,
......
...@@ -490,7 +490,7 @@ static int vdi_open(BlockDriverState *bs, QDict *options, int flags, ...@@ -490,7 +490,7 @@ static int vdi_open(BlockDriverState *bs, QDict *options, int flags,
/* Disable migration when vdi images are used */ /* Disable migration when vdi images are used */
error_set(&s->migration_blocker, error_set(&s->migration_blocker,
QERR_BLOCK_FORMAT_FEATURE_NOT_SUPPORTED, 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); migrate_add_blocker(s->migration_blocker);
return 0; return 0;
......
...@@ -1004,7 +1004,7 @@ static int vhdx_open(BlockDriverState *bs, QDict *options, int flags, ...@@ -1004,7 +1004,7 @@ static int vhdx_open(BlockDriverState *bs, QDict *options, int flags,
/* Disable migration when VHDX images are used */ /* Disable migration when VHDX images are used */
error_set(&s->migration_blocker, error_set(&s->migration_blocker,
QERR_BLOCK_FORMAT_FEATURE_NOT_SUPPORTED, 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); migrate_add_blocker(s->migration_blocker);
return 0; return 0;
......
...@@ -657,7 +657,7 @@ static int vmdk_open_vmdk4(BlockDriverState *bs, ...@@ -657,7 +657,7 @@ static int vmdk_open_vmdk4(BlockDriverState *bs,
snprintf(buf, sizeof(buf), "VMDK version %" PRId32, snprintf(buf, sizeof(buf), "VMDK version %" PRId32,
le32_to_cpu(header.version)); le32_to_cpu(header.version));
error_set(errp, QERR_UNKNOWN_BLOCK_FORMAT_FEATURE, error_set(errp, QERR_UNKNOWN_BLOCK_FORMAT_FEATURE,
bs->device_name, "vmdk", buf); bdrv_get_device_name(bs), "vmdk", buf);
return -ENOTSUP; return -ENOTSUP;
} else if (le32_to_cpu(header.version) == 3 && (flags & BDRV_O_RDWR)) { } else if (le32_to_cpu(header.version) == 3 && (flags & BDRV_O_RDWR)) {
/* VMware KB 2064959 explains that version 3 added support for /* VMware KB 2064959 explains that version 3 added support for
...@@ -939,7 +939,7 @@ static int vmdk_open(BlockDriverState *bs, QDict *options, int flags, ...@@ -939,7 +939,7 @@ static int vmdk_open(BlockDriverState *bs, QDict *options, int flags,
/* Disable migration when VMDK images are used */ /* Disable migration when VMDK images are used */
error_set(&s->migration_blocker, error_set(&s->migration_blocker,
QERR_BLOCK_FORMAT_FEATURE_NOT_SUPPORTED, 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); migrate_add_blocker(s->migration_blocker);
g_free(buf); g_free(buf);
return 0; return 0;
......
...@@ -320,7 +320,7 @@ static int vpc_open(BlockDriverState *bs, QDict *options, int flags, ...@@ -320,7 +320,7 @@ static int vpc_open(BlockDriverState *bs, QDict *options, int flags,
/* Disable migration when VHD images are used */ /* Disable migration when VHD images are used */
error_set(&s->migration_blocker, error_set(&s->migration_blocker,
QERR_BLOCK_FORMAT_FEATURE_NOT_SUPPORTED, 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); migrate_add_blocker(s->migration_blocker);
return 0; return 0;
......
...@@ -1182,7 +1182,7 @@ static int vvfat_open(BlockDriverState *bs, QDict *options, int flags, ...@@ -1182,7 +1182,7 @@ static int vvfat_open(BlockDriverState *bs, QDict *options, int flags,
if (s->qcow) { if (s->qcow) {
error_set(&s->migration_blocker, error_set(&s->migration_blocker,
QERR_BLOCK_FORMAT_FEATURE_NOT_SUPPORTED, 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); migrate_add_blocker(s->migration_blocker);
} }
......
...@@ -107,7 +107,8 @@ void block_job_set_speed(BlockJob *job, int64_t speed, Error **errp) ...@@ -107,7 +107,8 @@ void block_job_set_speed(BlockJob *job, int64_t speed, Error **errp)
void block_job_complete(BlockJob *job, Error **errp) void block_job_complete(BlockJob *job, Error **errp)
{ {
if (job->paused || job->cancelled || !job->driver->complete) { if (job->paused || job->cancelled || !job->driver->complete) {
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; return;
} }
......
...@@ -417,7 +417,7 @@ int bdrv_set_key(BlockDriverState *bs, const char *key); ...@@ -417,7 +417,7 @@ int bdrv_set_key(BlockDriverState *bs, const char *key);
int bdrv_query_missing_keys(void); int bdrv_query_missing_keys(void);
void bdrv_iterate_format(void (*it)(void *opaque, const char *name), void bdrv_iterate_format(void (*it)(void *opaque, const char *name),
void *opaque); void *opaque);
const char *bdrv_get_device_name(BlockDriverState *bs); const char *bdrv_get_device_name(const BlockDriverState *bs);
int bdrv_get_flags(BlockDriverState *bs); int bdrv_get_flags(BlockDriverState *bs);
int bdrv_write_compressed(BlockDriverState *bs, int64_t sector_num, int bdrv_write_compressed(BlockDriverState *bs, int64_t sector_num,
const uint8_t *buf, int nb_sectors); const uint8_t *buf, int nb_sectors);
......
...@@ -392,8 +392,6 @@ struct BlockDriverState { ...@@ -392,8 +392,6 @@ struct BlockDriverState {
char node_name[32]; char node_name[32];
/* element of the list of named nodes building the graph */ /* element of the list of named nodes building the graph */
QTAILQ_ENTRY(BlockDriverState) node_list; QTAILQ_ENTRY(BlockDriverState) node_list;
/* Device name is the name associated with the "drive" the guest sees */
char device_name[32];
/* element of the list of "drives" the guest sees */ /* element of the list of "drives" the guest sees */
QTAILQ_ENTRY(BlockDriverState) device_list; QTAILQ_ENTRY(BlockDriverState) device_list;
QLIST_HEAD(, BdrvDirtyBitmap) dirty_bitmaps; QLIST_HEAD(, BdrvDirtyBitmap) dirty_bitmaps;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment