Skip to contentSkip to conversation

block: Fix build with tracing enabled

PATCH Applied Kevin Wolf 5 participants 5 messages Apr 22, 2013 – Apr 24, 2013

lore
Share & tools
lore

Kevin Wolf

author
#0 lore raw

PATCH 1/1 block: Fix build with tracing enabled

filename was still uninitialised when it's used as a parameter to a tracing function, so let's move the initialisation. Also, commit c2ad1b0c forgot to add a NULL check, which this patch adds while we're at it.

---
 block.c | 14 +++++++-------
 1 file changed, 7 insertions(+), 7 deletions(-)
block.c +7 -7
index 819eb4e..aa9a533 100644
@@ -676,7 +676,13 @@ static int bdrv_open_common(BlockDriverState *bs, BlockDriverState *file,
     assert(bs->file == NULL);
     assert(options != NULL && bs->options != options);
 
-    trace_bdrv_open_common(bs, filename, flags, drv->format_name);
+    if (file != NULL) {
+        filename = file->filename;
+    } else {
+        filename = qdict_get_try_str(options, "filename");
+    }
+
+    trace_bdrv_open_common(bs, filename ?: "", flags, drv->format_name);
 
     if (use_bdrv_whitelist && !bdrv_is_whitelisted(drv)) {
         return -ENOTSUP;
@@ -698,12 +704,6 @@ static int bdrv_open_common(BlockDriverState *bs, BlockDriverState *file,
         bdrv_enable_copy_on_read(bs);
     }
 
-    if (file != NULL) {
-        filename = file->filename;
-    } else {
-        filename = qdict_get_try_str(options, "filename");
-    }
-
     if (filename != NULL) {
         pstrcpy(bs->filename, sizeof(bs->filename), filename);
     } else {
Signature · 1 line
1.8.1.4
Tested-by on v1 1/1
#1 lore raw

Am 22.04.2013 17:48, schrieb Kevin Wolf:

Quoted 5 lines

filename was still uninitialised when it's used as a parameter to a tracing function, so let's move the initialisation. Also, commit c2ad1b0c forgot to add a NULL check, which this patch adds while we're at it.

and queued a copy on qom-cpu until it gets applied.

Thanks,
Andreas

Signature · 2 lines
SUSE LINUX Products GmbH, Maxfeldstr. 5, 90409 Nürnberg, Germany
GF: Jeff Hawn, Jennifer Guild, Felix Imendörffer; HRB 16746 AG Nürnberg
Reviewed-by on v1 1/1
#2 lore raw
In reply to Kevin Wolf
Quoted 15 lines · Kevin Wolf

filename was still uninitialised when it's used as a parameter to a tracing function, so let's move the initialisation. Also, commit c2ad1b0c forgot to add a NULL check, which this patch adds while we're at it.

---
 block.c | 14 +++++++-------
 1 file changed, 7 insertions(+), 7 deletions(-)
block.c +0 -0
index 819eb4e..aa9a533 100644
@@ -676,7 +676,13 @@ static int bdrv_open_common(BlockDriverState *bs, BlockDriverState *file,
     assert(bs->file == NULL);

block.c static int bdrv_open_common(BlockDriverState *bs, BlockDriverState *file, · line 685

Quoted 10 lines
block.c +7 -1
     assert(options != NULL && bs->options != options);
 
-    trace_bdrv_open_common(bs, filename, flags, drv->format_name);
+    if (file != NULL) {
+        filename = file->filename;
+    } else {
+        filename = qdict_get_try_str(options, "filename");
+    }
+
+    trace_bdrv_open_common(bs, filename ?: "", flags, drv->format_name);

Yet another case of a non-C99 gcc extension; but as this is not the first use, I'll overlook it, and give:

Signature · 2 lines
Eric Blake   eblake redhat com    +1-919-301-3266
Libvirt virtualization library http://libvirt.org
#3 lore raw
In reply to Kevin Wolf
Quoted 8 lines · Kevin Wolf

filename was still uninitialised when it's used as a parameter to a tracing function, so let's move the initialisation. Also, commit c2ad1b0c forgot to add a NULL check, which this patch adds while we're at it.

---
 block.c | 14 +++++++-------
 1 file changed, 7 insertions(+), 7 deletions(-)

Thanks, applied to my block tree:
https://github.com/stefanha/qemu/commits/block

Stefan