Skip to contentSkip to conversation

convert fprintf() calls to error_setg() in block/qed.c:bdrv_qed_create()

PATCH Applied Aakriti Gupta 3 participants 3 messages Mar 15, 2014 – Mar 18, 2014 Block layer

lore
Share & tools
lore
#0 lore raw

PATCH v2 1/1 convert fprintf() calls to error_setg() in block/qed.c:bdrv_qed_create()

This patch converts fprintf() calls to error_setg() in block/qed.c:bdrv_qed_create() (error_setg() is part of error reporting API in include/qapi/error.h)

---
 block/qed.c |    8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)
block/qed.c +4 -4
index 837accd..01fa91b 100644
@@ -650,18 +650,18 @@ static int bdrv_qed_create(const char *filename, QEMUOptionParameter *options,
     }
 
     if (!qed_is_cluster_size_valid(cluster_size)) {
-        fprintf(stderr, "QED cluster size must be within range [%u, %u] and power of 2\n",
+        error_setg(errp, "QED cluster size must be within range [%u, %u] and power of 2",
                 QED_MIN_CLUSTER_SIZE, QED_MAX_CLUSTER_SIZE);
         return -EINVAL;
     }
     if (!qed_is_table_size_valid(table_size)) {
-        fprintf(stderr, "QED table size must be within range [%u, %u] and power of 2\n",
+        error_setg(errp, "QED table size must be within range [%u, %u] and power of 2",
                 QED_MIN_TABLE_SIZE, QED_MAX_TABLE_SIZE);
         return -EINVAL;
     }
     if (!qed_is_image_size_valid(image_size, cluster_size, table_size)) {
-        fprintf(stderr, "QED image size must be a non-zero multiple of "
-                        "cluster size and less than %" PRIu64 " bytes\n",
+        error_setg(errp, "QED image size must be a non-zero multiple of "
+                        "cluster size and less than %" PRIu64 " bytes",
                 qed_max_image_size(cluster_size, table_size));
         return -EINVAL;
     }
Signature · 1 line
1.7.9.5
Acked-by on v2 1/1
#1 lore raw
Quoted 7 lines · Aakriti Gupta

This patch converts fprintf() calls to error_setg() in block/qed.c:bdrv_qed_create() (error_setg() is part of error reporting API in include/qapi/error.h)

---
 block/qed.c |    8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)

block/qed.c static int bdrv_qed_create(const char *filename, QEMUOptionParameter *options, · line 654

Quoted 4 lines
     if (!qed_is_cluster_size_valid(cluster_size)) {
block/qed.c +1 -1
-        fprintf(stderr, "QED cluster size must be within range [%u, %u] and power of 2\n",
+        error_setg(errp, "QED cluster size must be within range [%u, %u] and power of 2",
                 QED_MIN_CLUSTER_SIZE, QED_MAX_CLUSTER_SIZE);

Kevin: Do you want to fix up the indentation of the next line when merging?

Applied
#2 lore raw

Am 17.03.2014 um 15:59 hat Stefan Hajnoczi geschrieben:

Quoted 10 lines · Aakriti Gupta
Quoted 7 lines

This patch converts fprintf() calls to error_setg() in block/qed.c:bdrv_qed_create() (error_setg() is part of error reporting API in include/qapi/error.h)

---
 block/qed.c |    8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)

Thanks, applied to the block-next branch for qemu 2.1.

Quoted 7 lines

block/qed.c static int bdrv_qed_create(const char *filename, QEMUOptionParameter *options, · line 654

Quoted 4 lines
     if (!qed_is_cluster_size_valid(cluster_size)) {
block/qed.c +1 -1
-        fprintf(stderr, "QED cluster size must be within range [%u, %u] and power of 2\n",
+        error_setg(errp, "QED cluster size must be within range [%u, %u] and power of 2",
                 QED_MIN_CLUSTER_SIZE, QED_MAX_CLUSTER_SIZE);

Kevin: Do you want to fix up the indentation of the next line when merging?

Sure, I did that, and wrapped the line at 80 characters, too.

Kevin