]> git.proxmox.com Git - mirror_qemu.git/blob - hw/block-common.c
hw/block-common: Factor out fall back to legacy -drive serial=...
[mirror_qemu.git] / hw / block-common.c
1 /*
2 * Common code for block device models
3 *
4 * Copyright (C) 2012 Red Hat, Inc.
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 */
9
10 #include "blockdev.h"
11 #include "hw/block-common.h"
12
13 void blkconf_serial(BlockConf *conf, char **serial)
14 {
15 DriveInfo *dinfo;
16
17 if (!*serial) {
18 /* try to fall back to value set with legacy -drive serial=... */
19 dinfo = drive_get_by_blockdev(conf->bs);
20 if (*dinfo->serial) {
21 *serial = g_strdup(dinfo->serial);
22 }
23 }
24 }