]> git.proxmox.com Git - mirror_qemu.git/commitdiff
blockdev: Rename drive_init(), drive_uninit() to drive_new(), drive_del()
authorMarkus Armbruster <armbru@redhat.com>
Fri, 6 Jun 2014 12:50:58 +0000 (14:50 +0200)
committerStefan Hajnoczi <stefanha@redhat.com>
Mon, 16 Jun 2014 09:23:19 +0000 (17:23 +0800)
"Init" and "uninit" suggest the functions don't allocate / free
storage.  But they do.

Signed-off-by: Markus Armbruster <armbru@redhat.com>
Reviewed-by: Benoit Canet <benoit@irqsave.net>
Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
blockdev.c
device-hotplug.c
hw/usb/dev-storage.c
include/sysemu/blockdev.h
vl.c

index 0505f9d8465cd45e75bc51de0b4bb447d08d6d20..0ed03b770fb4ebd8e3a3e169dbe6277e35cf15bd 100644 (file)
@@ -213,7 +213,7 @@ static void bdrv_format_print(void *opaque, const char *name)
     error_printf(" %s", name);
 }
 
-static void drive_uninit(DriveInfo *dinfo)
+static void drive_del(DriveInfo *dinfo)
 {
     if (dinfo->opts) {
         qemu_opts_del(dinfo->opts);
@@ -230,7 +230,7 @@ void drive_put_ref(DriveInfo *dinfo)
 {
     assert(dinfo->refcount);
     if (--dinfo->refcount == 0) {
-        drive_uninit(dinfo);
+        drive_del(dinfo);
     }
 }
 
@@ -656,7 +656,7 @@ QemuOptsList qemu_legacy_drive_opts = {
     },
 };
 
-DriveInfo *drive_init(QemuOpts *all_opts, BlockInterfaceType block_default_type)
+DriveInfo *drive_new(QemuOpts *all_opts, BlockInterfaceType block_default_type)
 {
     const char *value;
     DriveInfo *dinfo = NULL;
@@ -1801,7 +1801,7 @@ int do_drive_del(Monitor *mon, const QDict *qdict, QObject **ret_data)
         bdrv_set_on_error(bs, BLOCKDEV_ON_ERROR_REPORT,
                           BLOCKDEV_ON_ERROR_REPORT);
     } else {
-        drive_uninit(drive_get_by_blockdev(bs));
+        drive_del(drive_get_by_blockdev(bs));
     }
 
     return 0;
@@ -2344,9 +2344,9 @@ void qmp_blockdev_add(BlockdevOptions *options, Error **errp)
         goto fail;
     }
 
-    /* TODO Sort it out in raw-posix and drive_init: Reject aio=native with
+    /* TODO Sort it out in raw-posix and drive_new(): Reject aio=native with
      * cache.direct=false instead of silently switching to aio=threads, except
-     * if called from drive_init.
+     * when called from drive_new().
      *
      * For now, simply forbidding the combination for all drivers will do. */
     if (options->has_aio && options->aio == BLOCKDEV_AIO_OPTIONS_NATIVE) {
@@ -2378,7 +2378,7 @@ void qmp_blockdev_add(BlockdevOptions *options, Error **errp)
     }
 
     if (bdrv_key_required(dinfo->bdrv)) {
-        drive_uninit(dinfo);
+        drive_del(dinfo);
         error_setg(errp, "blockdev-add doesn't support encrypted devices");
         goto fail;
     }
index eecb08e2b1449f3856b03b7960e686f88d3cca8b..fc09d10fdb06c824e8d26708dbbed4802d31ffff 100644 (file)
@@ -40,7 +40,7 @@ DriveInfo *add_init_drive(const char *optstr)
         return NULL;
 
     mc = MACHINE_GET_CLASS(current_machine);
-    dinfo = drive_init(opts, mc->block_default_type);
+    dinfo = drive_new(opts, mc->block_default_type);
     if (!dinfo) {
         qemu_opts_del(opts);
         return NULL;
index e91910063728dff6355e06c73d4379b95ca96d5f..ae4efcbd2d6789d6bd9d69d8393fbe3f0eaf1114 100644 (file)
@@ -691,7 +691,7 @@ static USBDevice *usb_msd_init(USBBus *bus, const char *filename)
     qemu_opt_set(opts, "if", "none");
 
     /* create host drive */
-    dinfo = drive_init(opts, 0);
+    dinfo = drive_new(opts, 0);
     if (!dinfo) {
         qemu_opts_del(opts);
         return NULL;
index 134712b5008388224027524fcf1916ba1d7d85fb..0fdbd689c1d562ef14bd53aafb39a8948d524ed8 100644 (file)
@@ -37,7 +37,7 @@ struct DriveInfo {
     int bus;
     int unit;
     int auto_del;               /* see blockdev_mark_auto_del() */
-    bool enable_auto_del; /* Only for legacy drive_init() */
+    bool enable_auto_del;       /* Only for legacy drive_new() */
     int media_cd;
     int cyls, heads, secs, trans;
     QemuOpts *opts;
@@ -57,7 +57,7 @@ DriveInfo *drive_get_by_blockdev(BlockDriverState *bs);
 QemuOpts *drive_def(const char *optstr);
 QemuOpts *drive_add(BlockInterfaceType type, int index, const char *file,
                     const char *optstr);
-DriveInfo *drive_init(QemuOpts *arg, BlockInterfaceType block_default_type);
+DriveInfo *drive_new(QemuOpts *arg, BlockInterfaceType block_default_type);
 
 /* device-hotplug */
 
diff --git a/vl.c b/vl.c
index ac0e3d7e835fb5291346201554b649dfcd218844..be69c7f3468f7eaa9bbbe3243fd9f213650198fc 100644 (file)
--- a/vl.c
+++ b/vl.c
@@ -1074,7 +1074,7 @@ static int drive_init_func(QemuOpts *opts, void *opaque)
 {
     BlockInterfaceType *block_default_type = opaque;
 
-    return drive_init(opts, *block_default_type) == NULL;
+    return drive_new(opts, *block_default_type) == NULL;
 }
 
 static int drive_enable_snapshot(QemuOpts *opts, void *opaque)
@@ -1098,7 +1098,7 @@ static void default_drive(int enable, int snapshot, BlockInterfaceType type,
     if (snapshot) {
         drive_enable_snapshot(opts, NULL);
     }
-    if (!drive_init(opts, type)) {
+    if (!drive_new(opts, type)) {
         exit(1);
     }
 }