[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[PATCH V7 11/24] migration: enhance migrate_uri_parse
From: |
Steve Sistare |
Subject: |
[PATCH V7 11/24] migration: enhance migrate_uri_parse |
Date: |
Wed, 15 Jan 2025 11:00:37 -0800 |
Export migrate_uri_parse for use outside migration internals, and define
a method migrate_is_uri that indicates when migrate_uri_parse should
be used.
Signed-off-by: Steve Sistare <steven.sistare@oracle.com>
Reviewed-by: Peter Xu <peterx@redhat.com>
---
include/migration/misc.h | 7 +++++++
migration/migration.c | 11 +++++++++++
migration/migration.h | 2 --
3 files changed, 18 insertions(+), 2 deletions(-)
diff --git a/include/migration/misc.h b/include/migration/misc.h
index 67f7ef7..c660be8 100644
--- a/include/migration/misc.h
+++ b/include/migration/misc.h
@@ -108,4 +108,11 @@ bool migration_in_bg_snapshot(void);
bool migration_block_activate(Error **errp);
bool migration_block_inactivate(void);
+/* True if @uri starts with a syntactically valid URI prefix */
+bool migrate_is_uri(const char *uri);
+
+/* Parse @uri and return @channel, returning true on success */
+bool migrate_uri_parse(const char *uri, MigrationChannel **channel,
+ Error **errp);
+
#endif
diff --git a/migration/migration.c b/migration/migration.c
index fce7b22..b5ee98e 100644
--- a/migration/migration.c
+++ b/migration/migration.c
@@ -14,6 +14,7 @@
*/
#include "qemu/osdep.h"
+#include "qemu/ctype.h"
#include "qemu/cutils.h"
#include "qemu/error-report.h"
#include "qemu/main-loop.h"
@@ -587,6 +588,16 @@ void migrate_add_address(SocketAddress *address)
QAPI_CLONE(SocketAddress, address));
}
+bool migrate_is_uri(const char *uri)
+{
+ while (*uri && *uri != ':') {
+ if (!qemu_isalpha(*uri++)) {
+ return false;
+ }
+ }
+ return *uri == ':';
+}
+
bool migrate_uri_parse(const char *uri, MigrationChannel **channel,
Error **errp)
{
diff --git a/migration/migration.h b/migration/migration.h
index 0df2a18..1d4d4e9 100644
--- a/migration/migration.h
+++ b/migration/migration.h
@@ -519,8 +519,6 @@ bool check_dirty_bitmap_mig_alias_map(const
BitmapMigrationNodeAliasList *bbm,
Error **errp);
void migrate_add_address(SocketAddress *address);
-bool migrate_uri_parse(const char *uri, MigrationChannel **channel,
- Error **errp);
int foreach_not_ignored_block(RAMBlockIterFunc func, void *opaque);
#define qemu_ram_foreach_block \
--
1.8.3.1
- [PATCH V7 00/24] Live update: cpr-transfer, Steve Sistare, 2025/01/15
- [PATCH V7 01/24] backends/hostmem-shm: factor out allocation of "anonymous shared memory with an fd", Steve Sistare, 2025/01/15
- [PATCH V7 08/24] physmem: preserve ram blocks for cpr, Steve Sistare, 2025/01/15
- [PATCH V7 03/24] physmem: qemu_ram_alloc_from_fd extensions, Steve Sistare, 2025/01/15
- [PATCH V7 04/24] physmem: fd-based shared memory, Steve Sistare, 2025/01/15
- [PATCH V7 02/24] physmem: fix qemu_ram_alloc_from_fd size calculation, Steve Sistare, 2025/01/15
- [PATCH V7 05/24] memory: add RAM_PRIVATE, Steve Sistare, 2025/01/15
- [PATCH V7 07/24] migration: cpr-state, Steve Sistare, 2025/01/15
- [PATCH V7 09/24] hostmem-memfd: preserve for cpr, Steve Sistare, 2025/01/15
- [PATCH V7 06/24] machine: aux-ram-share option, Steve Sistare, 2025/01/15
- [PATCH V7 11/24] migration: enhance migrate_uri_parse,
Steve Sistare <=
- [PATCH V7 12/24] migration: incoming channel, Steve Sistare, 2025/01/15
- [PATCH V7 14/24] migration: VMSTATE_FD, Steve Sistare, 2025/01/15
- [PATCH V7 13/24] migration: SCM_RIGHTS for QEMUFile, Steve Sistare, 2025/01/15
- [PATCH V7 17/24] migration-test: memory_backend, Steve Sistare, 2025/01/15
- [PATCH V7 15/24] migration: cpr-transfer save and load, Steve Sistare, 2025/01/15
- [PATCH V7 10/24] hostmem-shm: preserve for cpr, Steve Sistare, 2025/01/15
- [PATCH V7 16/24] migration: cpr-transfer mode, Steve Sistare, 2025/01/15
- [PATCH V7 22/24] tests/qtest: assert qmp connected, Steve Sistare, 2025/01/15
- [PATCH V7 21/24] tests/qtest: enhance migration channels, Steve Sistare, 2025/01/15
- [PATCH V7 24/24] migration: cpr-transfer documentation, Steve Sistare, 2025/01/15