From 911525dba9ecc21f97b05c0f09bf9319a9de3a7d Mon Sep 17 00:00:00 2001 From: Markus Armbruster Date: Wed, 11 Jul 2012 15:08:37 +0200 Subject: hw/block-common: Factor out fall back to legacy -drive serial=... Signed-off-by: Markus Armbruster Signed-off-by: Kevin Wolf --- hw/block-common.c | 24 ++++++++++++++++++++++++ 1 file changed, 24 insertions(+) create mode 100644 hw/block-common.c (limited to 'hw/block-common.c') diff --git a/hw/block-common.c b/hw/block-common.c new file mode 100644 index 0000000000..036334b1ec --- /dev/null +++ b/hw/block-common.c @@ -0,0 +1,24 @@ +/* + * Common code for block device models + * + * Copyright (C) 2012 Red Hat, Inc. + * + * This work is licensed under the terms of the GNU GPL, version 2 or + * later. See the COPYING file in the top-level directory. + */ + +#include "blockdev.h" +#include "hw/block-common.h" + +void blkconf_serial(BlockConf *conf, char **serial) +{ + DriveInfo *dinfo; + + if (!*serial) { + /* try to fall back to value set with legacy -drive serial=... */ + dinfo = drive_get_by_blockdev(conf->bs); + if (*dinfo->serial) { + *serial = g_strdup(dinfo->serial); + } + } +} -- cgit v1.2.3