blockdev.c (21e2db72601c48fa593ef7187faf17f324d925c5) blockdev.c (98522f63f40adaebc412481e1d2e9170160d4539)
1/*
2 * QEMU host block devices
3 *
4 * Copyright (c) 2003-2008 Fabrice Bellard
5 *
6 * This work is licensed under the terms of the GNU GPL, version 2 or
7 * later. See the COPYING file in the top-level directory.
8 *

--- 447 unchanged lines hidden (view full) ---

456 error_setg(errp, "device id=%s is conflicting with a node-name",
457 qemu_opts_id(opts));
458 goto early_err;
459 }
460
461 /* init */
462 dinfo = g_malloc0(sizeof(*dinfo));
463 dinfo->id = g_strdup(qemu_opts_id(opts));
1/*
2 * QEMU host block devices
3 *
4 * Copyright (c) 2003-2008 Fabrice Bellard
5 *
6 * This work is licensed under the terms of the GNU GPL, version 2 or
7 * later. See the COPYING file in the top-level directory.
8 *

--- 447 unchanged lines hidden (view full) ---

456 error_setg(errp, "device id=%s is conflicting with a node-name",
457 qemu_opts_id(opts));
458 goto early_err;
459 }
460
461 /* init */
462 dinfo = g_malloc0(sizeof(*dinfo));
463 dinfo->id = g_strdup(qemu_opts_id(opts));
464 dinfo->bdrv = bdrv_new(dinfo->id);
464 dinfo->bdrv = bdrv_new(dinfo->id, &error);
465 if (error) {
466 error_propagate(errp, error);
467 goto bdrv_new_err;
468 }
465 dinfo->bdrv->open_flags = snapshot ? BDRV_O_SNAPSHOT : 0;
466 dinfo->bdrv->read_only = ro;
467 dinfo->refcount = 1;
468 if (serial != NULL) {
469 dinfo->serial = g_strdup(serial);
470 }
471 QTAILQ_INSERT_TAIL(&drives, dinfo, next);
472

--- 45 unchanged lines hidden (view full) ---

518
519 QDECREF(bs_opts);
520 qemu_opts_del(opts);
521
522 return dinfo;
523
524err:
525 bdrv_unref(dinfo->bdrv);
469 dinfo->bdrv->open_flags = snapshot ? BDRV_O_SNAPSHOT : 0;
470 dinfo->bdrv->read_only = ro;
471 dinfo->refcount = 1;
472 if (serial != NULL) {
473 dinfo->serial = g_strdup(serial);
474 }
475 QTAILQ_INSERT_TAIL(&drives, dinfo, next);
476

--- 45 unchanged lines hidden (view full) ---

522
523 QDECREF(bs_opts);
524 qemu_opts_del(opts);
525
526 return dinfo;
527
528err:
529 bdrv_unref(dinfo->bdrv);
526 g_free(dinfo->id);
527 QTAILQ_REMOVE(&drives, dinfo, next);
530 QTAILQ_REMOVE(&drives, dinfo, next);
531bdrv_new_err:
532 g_free(dinfo->id);
528 g_free(dinfo);
529early_err:
530 QDECREF(bs_opts);
531 qemu_opts_del(opts);
532 return NULL;
533}
534
535static void qemu_opt_rename(QemuOpts *opts, const char *from, const char *to)

--- 1933 unchanged lines hidden ---
533 g_free(dinfo);
534early_err:
535 QDECREF(bs_opts);
536 qemu_opts_del(opts);
537 return NULL;
538}
539
540static void qemu_opt_rename(QemuOpts *opts, const char *from, const char *to)

--- 1933 unchanged lines hidden ---