mirror of
https://github.com/mii443/qemu.git
synced 2025-08-22 23:25:48 +00:00
migration: Convert the file backend to the new QAPI syntax
Convert the file: URI to accept a FileMigrationArgs to be compatible with the new migration QAPI. Signed-off-by: Fabiano Rosas <farosas@suse.de> Reviewed-by: Juan Quintela <quintela@redhat.com> Signed-off-by: Juan Quintela <quintela@redhat.com> Message-ID: <20231023182053.8711-9-farosas@suse.de>
This commit is contained in:
committed by
Juan Quintela
parent
cbab4face5
commit
02afba63e9
@ -36,20 +36,16 @@ int file_parse_offset(char *filespec, uint64_t *offsetp, Error **errp)
|
||||
return 0;
|
||||
}
|
||||
|
||||
void file_start_outgoing_migration(MigrationState *s, const char *filespec,
|
||||
Error **errp)
|
||||
void file_start_outgoing_migration(MigrationState *s,
|
||||
FileMigrationArgs *file_args, Error **errp)
|
||||
{
|
||||
g_autofree char *filename = g_strdup(filespec);
|
||||
g_autoptr(QIOChannelFile) fioc = NULL;
|
||||
uint64_t offset = 0;
|
||||
g_autofree char *filename = g_strdup(file_args->filename);
|
||||
uint64_t offset = file_args->offset;
|
||||
QIOChannel *ioc;
|
||||
|
||||
trace_migration_file_outgoing(filename);
|
||||
|
||||
if (file_parse_offset(filename, &offset, errp)) {
|
||||
return;
|
||||
}
|
||||
|
||||
fioc = qio_channel_file_new_path(filename, O_CREAT | O_WRONLY | O_TRUNC,
|
||||
0600, errp);
|
||||
if (!fioc) {
|
||||
@ -73,19 +69,15 @@ static gboolean file_accept_incoming_migration(QIOChannel *ioc,
|
||||
return G_SOURCE_REMOVE;
|
||||
}
|
||||
|
||||
void file_start_incoming_migration(const char *filespec, Error **errp)
|
||||
void file_start_incoming_migration(FileMigrationArgs *file_args, Error **errp)
|
||||
{
|
||||
g_autofree char *filename = g_strdup(filespec);
|
||||
g_autofree char *filename = g_strdup(file_args->filename);
|
||||
QIOChannelFile *fioc = NULL;
|
||||
uint64_t offset = 0;
|
||||
uint64_t offset = file_args->offset;
|
||||
QIOChannel *ioc;
|
||||
|
||||
trace_migration_file_incoming(filename);
|
||||
|
||||
if (file_parse_offset(filename, &offset, errp)) {
|
||||
return;
|
||||
}
|
||||
|
||||
fioc = qio_channel_file_new_path(filename, O_RDONLY, 0, errp);
|
||||
if (!fioc) {
|
||||
return;
|
||||
|
Reference in New Issue
Block a user