small cleanups for pbs-restore

Add trailing newline to two error messages, and drop an extra
unconditional `qdict_put_str(options, "driver", format);`
Besides that it's just formatting.

Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
This commit is contained in:
Thomas Lamprecht 2020-05-30 15:24:11 +02:00
parent 4e74eca7ed
commit c6979241f1
2 changed files with 31 additions and 35 deletions

View File

@ -6,8 +6,8 @@ Subject: [PATCH] PVE-Backup: pbs-restore - new command to restore from proxmox
--- ---
Makefile | 4 +- Makefile | 4 +-
pbs-restore.c | 208 ++++++++++++++++++++++++++++++++++++++++++++++++++ pbs-restore.c | 206 ++++++++++++++++++++++++++++++++++++++++++++++++++
2 files changed, 211 insertions(+), 1 deletion(-) 2 files changed, 209 insertions(+), 1 deletion(-)
create mode 100644 pbs-restore.c create mode 100644 pbs-restore.c
diff --git a/Makefile b/Makefile diff --git a/Makefile b/Makefile
@ -34,10 +34,10 @@ index dbd9542ae4..7c1fb58e18 100644
diff --git a/pbs-restore.c b/pbs-restore.c diff --git a/pbs-restore.c b/pbs-restore.c
new file mode 100644 new file mode 100644
index 0000000000..f65de8b890 index 0000000000..0b24e35403
--- /dev/null --- /dev/null
+++ b/pbs-restore.c +++ b/pbs-restore.c
@@ -0,0 +1,208 @@ @@ -0,0 +1,206 @@
+/* +/*
+ * Qemu image restore helper for Proxmox Backup + * Qemu image restore helper for Proxmox Backup
+ * + *
@ -140,10 +140,10 @@ index 0000000000..f65de8b890
+ } + }
+ switch (c) { + switch (c) {
+ case ':': + case ':':
+ fprintf(stderr, "missing argument for option '%s'", argv[optind - 1]); + fprintf(stderr, "missing argument for option '%s'\n", argv[optind - 1]);
+ return -1; + return -1;
+ case '?': + case '?':
+ fprintf(stderr, "unrecognized option '%s'", argv[optind - 1]); + fprintf(stderr, "unrecognized option '%s'\n", argv[optind - 1]);
+ return -1; + return -1;
+ case 'f': + case 'f':
+ format = g_strdup(argv[optind - 1]); + format = g_strdup(argv[optind - 1]);
@ -206,7 +206,6 @@ index 0000000000..f65de8b890
+ } + }
+ +
+ QDict *options = qdict_new(); + QDict *options = qdict_new();
+ qdict_put_str(options, "driver", format);
+ +
+ if (format) { + if (format) {
+ qdict_put_str(options, "driver", format); + qdict_put_str(options, "driver", format);
@ -214,7 +213,6 @@ index 0000000000..f65de8b890
+ +
+ Error *local_err = NULL; + Error *local_err = NULL;
+ int flags = BDRV_O_RDWR; + int flags = BDRV_O_RDWR;
+
+ BlockBackend *blk = blk_new_open(target, NULL, options, flags, &local_err); + BlockBackend *blk = blk_new_open(target, NULL, options, flags, &local_err);
+ if (!blk) { + if (!blk) {
+ fprintf(stderr, "%s\n", error_get_pretty(local_err)); + fprintf(stderr, "%s\n", error_get_pretty(local_err));

View File

@ -3,8 +3,6 @@ From: Kevin Wolf <kwolf@redhat.com>
Date: Wed, 27 May 2020 11:33:20 +0200 Date: Wed, 27 May 2020 11:33:20 +0200
Subject: [PATCH] util/async: Add aio_co_reschedule_self() Subject: [PATCH] util/async: Add aio_co_reschedule_self()
From: Kevin Wolf <kwolf@redhat.com>
Add a function that can be used to move the currently running coroutine Add a function that can be used to move the currently running coroutine
to a different AioContext (and therefore potentially a different to a different AioContext (and therefore potentially a different
thread). thread).