[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[PATCH V5 10/23] migration: enhance migrate_uri_parse
From: |
Steve Sistare |
Subject: |
[PATCH V5 10/23] migration: enhance migrate_uri_parse |
Date: |
Tue, 24 Dec 2024 08:16:55 -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>
---
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 804eb23..b726872 100644
--- a/include/migration/misc.h
+++ b/include/migration/misc.h
@@ -106,4 +106,11 @@ bool migration_incoming_postcopy_advised(void);
/* True if background snapshot is active */
bool migration_in_bg_snapshot(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 218239c..881684a 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"
@@ -572,6 +573,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 7b6e718..a1ac03b 100644
--- a/migration/migration.h
+++ b/migration/migration.h
@@ -522,8 +522,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 V5 05/23] machine: aux-ram-share option, (continued)
- [PATCH V5 05/23] machine: aux-ram-share option, Steve Sistare, 2024/12/24
- [PATCH V5 03/23] physmem: fd-based shared memory, Steve Sistare, 2024/12/24
- [PATCH V5 04/23] memory: add RAM_PRIVATE, Steve Sistare, 2024/12/24
- [PATCH V5 07/23] physmem: preserve ram blocks for cpr, Steve Sistare, 2024/12/24
- [PATCH V5 06/23] migration: cpr-state, Steve Sistare, 2024/12/24
- [PATCH V5 01/23] backends/hostmem-shm: factor out allocation of "anonymous shared memory with an fd", Steve Sistare, 2024/12/24
- [PATCH V5 08/23] hostmem-memfd: preserve for cpr, Steve Sistare, 2024/12/24
- [PATCH V5 10/23] migration: enhance migrate_uri_parse,
Steve Sistare <=
- [PATCH V5 13/23] migration: VMSTATE_FD, Steve Sistare, 2024/12/24
- [PATCH V5 02/23] physmem: qemu_ram_alloc_from_fd extensions, Steve Sistare, 2024/12/24
- [PATCH V5 09/23] hostmem-shm: preserve for cpr, Steve Sistare, 2024/12/24
- [PATCH V5 12/23] migration: SCM_RIGHTS for QEMUFile, Steve Sistare, 2024/12/24
- [PATCH V5 11/23] migration: incoming channel, Steve Sistare, 2024/12/24
- [PATCH V5 14/23] migration: cpr-transfer save and load, Steve Sistare, 2024/12/24
- [PATCH V5 18/23] tests/qtest: defer connection, Steve Sistare, 2024/12/24