block: Code motion to get rid of stubs/blockdev.c

Signed-off-by: Markus Armbruster <armbru@redhat.com>
Reviewed-by: Benoît Canet <benoit.canet@nodalink.com>
Reviewed-by: Max Reitz <mreitz@redhat.com>
Reviewed-by: Kevin Wolf <kwolf@redhat.com>
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
This commit is contained in:
Markus Armbruster 2014-10-07 13:59:07 +02:00 committed by Kevin Wolf
parent 18e46a033d
commit 8fb3c76c94
5 changed files with 13 additions and 25 deletions

View file

@ -22,6 +22,8 @@ struct BlockBackend {
QTAILQ_ENTRY(BlockBackend) link; /* for blk_backends */
};
static void drive_info_del(DriveInfo *dinfo);
/* All the BlockBackends (except for hidden ones) */
static QTAILQ_HEAD(, BlockBackend) blk_backends =
QTAILQ_HEAD_INITIALIZER(blk_backends);
@ -93,6 +95,17 @@ static void blk_delete(BlockBackend *blk)
g_free(blk);
}
static void drive_info_del(DriveInfo *dinfo)
{
if (!dinfo) {
return;
}
qemu_opts_del(dinfo->opts);
g_free(dinfo->id);
g_free(dinfo->serial);
g_free(dinfo);
}
/*
* Increment @blk's reference count.
* @blk must not be null.

View file

@ -284,17 +284,6 @@ void drive_del(DriveInfo *dinfo)
blk_unref(blk);
}
void drive_info_del(DriveInfo *dinfo)
{
if (!dinfo) {
return;
}
qemu_opts_del(dinfo->opts);
g_free(dinfo->id);
g_free(dinfo->serial);
g_free(dinfo);
}
typedef struct {
QEMUBH *bh;
BlockDriverState *bs;

View file

@ -65,7 +65,6 @@ QemuOpts *drive_add(BlockInterfaceType type, int index, const char *file,
const char *optstr);
DriveInfo *drive_new(QemuOpts *arg, BlockInterfaceType block_default_type);
void drive_del(DriveInfo *dinfo);
void drive_info_del(DriveInfo *dinfo);
/* device-hotplug */

View file

@ -1,6 +1,5 @@
stub-obj-y += arch-query-cpu-def.o
stub-obj-y += bdrv-commit-all.o
stub-obj-y += blockdev.o
stub-obj-y += chr-baum-init.o
stub-obj-y += chr-msmouse.o
stub-obj-y += chr-testdev.o

View file

@ -1,12 +0,0 @@
#include <assert.h>
#include "sysemu/blockdev.h"
DriveInfo *drive_get_by_blockdev(BlockDriverState *bs)
{
return NULL;
}
void drive_info_del(DriveInfo *dinfo)
{
assert(!dinfo);
}