Re: [PATCH 20/20] migration: remove the QEMUFileOps abstraction

2022-06-09 Thread Dr. David Alan Gilbert
* Daniel P. Berrangé (berra...@redhat.com) wrote:
> Now that all QEMUFile callbacks are removed, the entire concept can be
> deleted.
> 
> Signed-off-by: Daniel P. Berrangé 

I think that's OK, there's one nit - you remove qemu_get_fd from one of
the headers; I think that probably belongs in an earlier patch.

Other than that,


Reviewed-by: Dr. David Alan Gilbert 

> ---
>  migration/channel.c   |  4 +--
>  migration/colo.c  |  5 ++--
>  migration/meson.build |  1 -
>  migration/migration.c |  7 ++---
>  migration/qemu-file-channel.c | 53 ---
>  migration/qemu-file-channel.h | 32 -
>  migration/qemu-file.c | 20 ++---
>  migration/qemu-file.h |  8 ++
>  migration/ram.c   |  3 +-
>  migration/rdma.c  |  5 ++--
>  migration/savevm.c| 11 
>  tests/unit/test-vmstate.c |  5 ++--
>  12 files changed, 27 insertions(+), 127 deletions(-)
>  delete mode 100644 migration/qemu-file-channel.c
>  delete mode 100644 migration/qemu-file-channel.h
> 
> diff --git a/migration/channel.c b/migration/channel.c
> index a162d00fea..90087d8986 100644
> --- a/migration/channel.c
> +++ b/migration/channel.c
> @@ -14,7 +14,7 @@
>  #include "channel.h"
>  #include "tls.h"
>  #include "migration.h"
> -#include "qemu-file-channel.h"
> +#include "qemu-file.h"
>  #include "trace.h"
>  #include "qapi/error.h"
>  #include "io/channel-tls.h"
> @@ -85,7 +85,7 @@ void migration_channel_connect(MigrationState *s,
>  return;
>  }
>  } else {
> -QEMUFile *f = qemu_fopen_channel_output(ioc);
> +QEMUFile *f = qemu_file_new_output(ioc);
>  
>  migration_ioc_register_yank(ioc);
>  
> diff --git a/migration/colo.c b/migration/colo.c
> index 5f7071b3cd..2b71722fd6 100644
> --- a/migration/colo.c
> +++ b/migration/colo.c
> @@ -14,7 +14,6 @@
>  #include "sysemu/sysemu.h"
>  #include "qapi/error.h"
>  #include "qapi/qapi-commands-migration.h"
> -#include "qemu-file-channel.h"
>  #include "migration.h"
>  #include "qemu-file.h"
>  #include "savevm.h"
> @@ -559,7 +558,7 @@ static void colo_process_checkpoint(MigrationState *s)
>  goto out;
>  }
>  bioc = qio_channel_buffer_new(COLO_BUFFER_BASE_SIZE);
> -fb = qemu_fopen_channel_output(QIO_CHANNEL(bioc));
> +fb = qemu_file_new_output(QIO_CHANNEL(bioc));
>  object_unref(OBJECT(bioc));
>  
>  qemu_mutex_lock_iothread();
> @@ -873,7 +872,7 @@ void *colo_process_incoming_thread(void *opaque)
>  colo_incoming_start_dirty_log();
>  
>  bioc = qio_channel_buffer_new(COLO_BUFFER_BASE_SIZE);
> -fb = qemu_fopen_channel_input(QIO_CHANNEL(bioc));
> +fb = qemu_file_new_input(QIO_CHANNEL(bioc));
>  object_unref(OBJECT(bioc));
>  
>  qemu_mutex_lock_iothread();
> diff --git a/migration/meson.build b/migration/meson.build
> index 8d309f5849..690487cf1a 100644
> --- a/migration/meson.build
> +++ b/migration/meson.build
> @@ -4,7 +4,6 @@ migration_files = files(
>'xbzrle.c',
>'vmstate-types.c',
>'vmstate.c',
> -  'qemu-file-channel.c',
>'qemu-file.c',
>'yank_functions.c',
>  )
> diff --git a/migration/migration.c b/migration/migration.c
> index ab1e9610ef..8a30ef17d9 100644
> --- a/migration/migration.c
> +++ b/migration/migration.c
> @@ -30,7 +30,6 @@
>  #include "migration/misc.h"
>  #include "migration.h"
>  #include "savevm.h"
> -#include "qemu-file-channel.h"
>  #include "qemu-file.h"
>  #include "migration/vmstate.h"
>  #include "block/block.h"
> @@ -722,7 +721,7 @@ void migration_ioc_process_incoming(QIOChannel *ioc, 
> Error **errp)
>  
>  if (!mis->from_src_file) {
>  /* The first connection (multifd may have multiple) */
> -QEMUFile *f = qemu_fopen_channel_input(ioc);
> +QEMUFile *f = qemu_file_new_input(ioc);
>  
>  if (!migration_incoming_setup(f, errp)) {
>  return;
> @@ -3081,7 +3080,7 @@ static int postcopy_start(MigrationState *ms)
>   */
>  bioc = qio_channel_buffer_new(4096);
>  qio_channel_set_name(QIO_CHANNEL(bioc), "migration-postcopy-buffer");
> -fb = qemu_fopen_channel_output(QIO_CHANNEL(bioc));
> +fb = qemu_file_new_output(QIO_CHANNEL(bioc));
>  object_unref(OBJECT(bioc));
>  
>  /*
> @@ -3970,7 +3969,7 @@ static void *bg_migration_thread(void *opaque)
>   */
>  s->bioc = qio_channel_buffer_new(512 * 1024);
>  qio_channel_set_name(QIO_CHANNEL(s->bioc), "vmstate-buffer");
> -fb = qemu_fopen_channel_output(QIO_CHANNEL(s->bioc));
> +fb = qemu_file_new_output(QIO_CHANNEL(s->bioc));
>  object_unref(OBJECT(s->bioc));
>  
>  update_iteration_initial_status(s);
> diff --git a/migration/qemu-file-channel.c b/migration/qemu-file-channel.c
> deleted file mode 100644
> index 51717c1137..00
> --- a/migration/qemu-file-channel.c
> +++ /dev/null
> @@ -1,53 +0,0 @@
> -/*
> - * QEMUFile backend for 

Re: [PATCH 20/20] migration: remove the QEMUFileOps abstraction

2022-06-09 Thread Daniel P . Berrangé
On Thu, Jun 09, 2022 at 05:59:00PM +0100, Dr. David Alan Gilbert wrote:
> * Daniel P. Berrangé (berra...@redhat.com) wrote:
> > Now that all QEMUFile callbacks are removed, the entire concept can be
> > deleted.
> > 
> > Signed-off-by: Daniel P. Berrangé 
> 
> I think that's OK, there's one nit - you remove qemu_get_fd from one of
> the headers; I think that probably belongs in an earlier patch.

Oh should probably be squashed back into patch 13, which removes
the corresponding unused callback typedef.

> 
> Other than that,
> 
> 
> Reviewed-by: Dr. David Alan Gilbert 
> 
> > ---
> >  migration/channel.c   |  4 +--
> >  migration/colo.c  |  5 ++--
> >  migration/meson.build |  1 -
> >  migration/migration.c |  7 ++---
> >  migration/qemu-file-channel.c | 53 ---
> >  migration/qemu-file-channel.h | 32 -
> >  migration/qemu-file.c | 20 ++---
> >  migration/qemu-file.h |  8 ++
> >  migration/ram.c   |  3 +-
> >  migration/rdma.c  |  5 ++--
> >  migration/savevm.c| 11 
> >  tests/unit/test-vmstate.c |  5 ++--
> >  12 files changed, 27 insertions(+), 127 deletions(-)
> >  delete mode 100644 migration/qemu-file-channel.c
> >  delete mode 100644 migration/qemu-file-channel.h
> > 
> > diff --git a/migration/channel.c b/migration/channel.c
> > index a162d00fea..90087d8986 100644
> > --- a/migration/channel.c
> > +++ b/migration/channel.c
> > @@ -14,7 +14,7 @@
> >  #include "channel.h"
> >  #include "tls.h"
> >  #include "migration.h"
> > -#include "qemu-file-channel.h"
> > +#include "qemu-file.h"
> >  #include "trace.h"
> >  #include "qapi/error.h"
> >  #include "io/channel-tls.h"
> > @@ -85,7 +85,7 @@ void migration_channel_connect(MigrationState *s,
> >  return;
> >  }
> >  } else {
> > -QEMUFile *f = qemu_fopen_channel_output(ioc);
> > +QEMUFile *f = qemu_file_new_output(ioc);
> >  
> >  migration_ioc_register_yank(ioc);
> >  
> > diff --git a/migration/colo.c b/migration/colo.c
> > index 5f7071b3cd..2b71722fd6 100644
> > --- a/migration/colo.c
> > +++ b/migration/colo.c
> > @@ -14,7 +14,6 @@
> >  #include "sysemu/sysemu.h"
> >  #include "qapi/error.h"
> >  #include "qapi/qapi-commands-migration.h"
> > -#include "qemu-file-channel.h"
> >  #include "migration.h"
> >  #include "qemu-file.h"
> >  #include "savevm.h"
> > @@ -559,7 +558,7 @@ static void colo_process_checkpoint(MigrationState *s)
> >  goto out;
> >  }
> >  bioc = qio_channel_buffer_new(COLO_BUFFER_BASE_SIZE);
> > -fb = qemu_fopen_channel_output(QIO_CHANNEL(bioc));
> > +fb = qemu_file_new_output(QIO_CHANNEL(bioc));
> >  object_unref(OBJECT(bioc));
> >  
> >  qemu_mutex_lock_iothread();
> > @@ -873,7 +872,7 @@ void *colo_process_incoming_thread(void *opaque)
> >  colo_incoming_start_dirty_log();
> >  
> >  bioc = qio_channel_buffer_new(COLO_BUFFER_BASE_SIZE);
> > -fb = qemu_fopen_channel_input(QIO_CHANNEL(bioc));
> > +fb = qemu_file_new_input(QIO_CHANNEL(bioc));
> >  object_unref(OBJECT(bioc));
> >  
> >  qemu_mutex_lock_iothread();
> > diff --git a/migration/meson.build b/migration/meson.build
> > index 8d309f5849..690487cf1a 100644
> > --- a/migration/meson.build
> > +++ b/migration/meson.build
> > @@ -4,7 +4,6 @@ migration_files = files(
> >'xbzrle.c',
> >'vmstate-types.c',
> >'vmstate.c',
> > -  'qemu-file-channel.c',
> >'qemu-file.c',
> >'yank_functions.c',
> >  )
> > diff --git a/migration/migration.c b/migration/migration.c
> > index ab1e9610ef..8a30ef17d9 100644
> > --- a/migration/migration.c
> > +++ b/migration/migration.c
> > @@ -30,7 +30,6 @@
> >  #include "migration/misc.h"
> >  #include "migration.h"
> >  #include "savevm.h"
> > -#include "qemu-file-channel.h"
> >  #include "qemu-file.h"
> >  #include "migration/vmstate.h"
> >  #include "block/block.h"
> > @@ -722,7 +721,7 @@ void migration_ioc_process_incoming(QIOChannel *ioc, 
> > Error **errp)
> >  
> >  if (!mis->from_src_file) {
> >  /* The first connection (multifd may have multiple) */
> > -QEMUFile *f = qemu_fopen_channel_input(ioc);
> > +QEMUFile *f = qemu_file_new_input(ioc);
> >  
> >  if (!migration_incoming_setup(f, errp)) {
> >  return;
> > @@ -3081,7 +3080,7 @@ static int postcopy_start(MigrationState *ms)
> >   */
> >  bioc = qio_channel_buffer_new(4096);
> >  qio_channel_set_name(QIO_CHANNEL(bioc), "migration-postcopy-buffer");
> > -fb = qemu_fopen_channel_output(QIO_CHANNEL(bioc));
> > +fb = qemu_file_new_output(QIO_CHANNEL(bioc));
> >  object_unref(OBJECT(bioc));
> >  
> >  /*
> > @@ -3970,7 +3969,7 @@ static void *bg_migration_thread(void *opaque)
> >   */
> >  s->bioc = qio_channel_buffer_new(512 * 1024);
> >  qio_channel_set_name(QIO_CHANNEL(s->bioc), "vmstate-buffer");
> > 

[PATCH 20/20] migration: remove the QEMUFileOps abstraction

2022-05-24 Thread Daniel P . Berrangé
Now that all QEMUFile callbacks are removed, the entire concept can be
deleted.

Signed-off-by: Daniel P. Berrangé 
---
 migration/channel.c   |  4 +--
 migration/colo.c  |  5 ++--
 migration/meson.build |  1 -
 migration/migration.c |  7 ++---
 migration/qemu-file-channel.c | 53 ---
 migration/qemu-file-channel.h | 32 -
 migration/qemu-file.c | 20 ++---
 migration/qemu-file.h |  8 ++
 migration/ram.c   |  3 +-
 migration/rdma.c  |  5 ++--
 migration/savevm.c| 11 
 tests/unit/test-vmstate.c |  5 ++--
 12 files changed, 27 insertions(+), 127 deletions(-)
 delete mode 100644 migration/qemu-file-channel.c
 delete mode 100644 migration/qemu-file-channel.h

diff --git a/migration/channel.c b/migration/channel.c
index a162d00fea..90087d8986 100644
--- a/migration/channel.c
+++ b/migration/channel.c
@@ -14,7 +14,7 @@
 #include "channel.h"
 #include "tls.h"
 #include "migration.h"
-#include "qemu-file-channel.h"
+#include "qemu-file.h"
 #include "trace.h"
 #include "qapi/error.h"
 #include "io/channel-tls.h"
@@ -85,7 +85,7 @@ void migration_channel_connect(MigrationState *s,
 return;
 }
 } else {
-QEMUFile *f = qemu_fopen_channel_output(ioc);
+QEMUFile *f = qemu_file_new_output(ioc);
 
 migration_ioc_register_yank(ioc);
 
diff --git a/migration/colo.c b/migration/colo.c
index 5f7071b3cd..2b71722fd6 100644
--- a/migration/colo.c
+++ b/migration/colo.c
@@ -14,7 +14,6 @@
 #include "sysemu/sysemu.h"
 #include "qapi/error.h"
 #include "qapi/qapi-commands-migration.h"
-#include "qemu-file-channel.h"
 #include "migration.h"
 #include "qemu-file.h"
 #include "savevm.h"
@@ -559,7 +558,7 @@ static void colo_process_checkpoint(MigrationState *s)
 goto out;
 }
 bioc = qio_channel_buffer_new(COLO_BUFFER_BASE_SIZE);
-fb = qemu_fopen_channel_output(QIO_CHANNEL(bioc));
+fb = qemu_file_new_output(QIO_CHANNEL(bioc));
 object_unref(OBJECT(bioc));
 
 qemu_mutex_lock_iothread();
@@ -873,7 +872,7 @@ void *colo_process_incoming_thread(void *opaque)
 colo_incoming_start_dirty_log();
 
 bioc = qio_channel_buffer_new(COLO_BUFFER_BASE_SIZE);
-fb = qemu_fopen_channel_input(QIO_CHANNEL(bioc));
+fb = qemu_file_new_input(QIO_CHANNEL(bioc));
 object_unref(OBJECT(bioc));
 
 qemu_mutex_lock_iothread();
diff --git a/migration/meson.build b/migration/meson.build
index 8d309f5849..690487cf1a 100644
--- a/migration/meson.build
+++ b/migration/meson.build
@@ -4,7 +4,6 @@ migration_files = files(
   'xbzrle.c',
   'vmstate-types.c',
   'vmstate.c',
-  'qemu-file-channel.c',
   'qemu-file.c',
   'yank_functions.c',
 )
diff --git a/migration/migration.c b/migration/migration.c
index ab1e9610ef..8a30ef17d9 100644
--- a/migration/migration.c
+++ b/migration/migration.c
@@ -30,7 +30,6 @@
 #include "migration/misc.h"
 #include "migration.h"
 #include "savevm.h"
-#include "qemu-file-channel.h"
 #include "qemu-file.h"
 #include "migration/vmstate.h"
 #include "block/block.h"
@@ -722,7 +721,7 @@ void migration_ioc_process_incoming(QIOChannel *ioc, Error 
**errp)
 
 if (!mis->from_src_file) {
 /* The first connection (multifd may have multiple) */
-QEMUFile *f = qemu_fopen_channel_input(ioc);
+QEMUFile *f = qemu_file_new_input(ioc);
 
 if (!migration_incoming_setup(f, errp)) {
 return;
@@ -3081,7 +3080,7 @@ static int postcopy_start(MigrationState *ms)
  */
 bioc = qio_channel_buffer_new(4096);
 qio_channel_set_name(QIO_CHANNEL(bioc), "migration-postcopy-buffer");
-fb = qemu_fopen_channel_output(QIO_CHANNEL(bioc));
+fb = qemu_file_new_output(QIO_CHANNEL(bioc));
 object_unref(OBJECT(bioc));
 
 /*
@@ -3970,7 +3969,7 @@ static void *bg_migration_thread(void *opaque)
  */
 s->bioc = qio_channel_buffer_new(512 * 1024);
 qio_channel_set_name(QIO_CHANNEL(s->bioc), "vmstate-buffer");
-fb = qemu_fopen_channel_output(QIO_CHANNEL(s->bioc));
+fb = qemu_file_new_output(QIO_CHANNEL(s->bioc));
 object_unref(OBJECT(s->bioc));
 
 update_iteration_initial_status(s);
diff --git a/migration/qemu-file-channel.c b/migration/qemu-file-channel.c
deleted file mode 100644
index 51717c1137..00
--- a/migration/qemu-file-channel.c
+++ /dev/null
@@ -1,53 +0,0 @@
-/*
- * QEMUFile backend for QIOChannel objects
- *
- * Copyright (c) 2015-2016 Red Hat, Inc
- *
- * Permission is hereby granted, free of charge, to any person obtaining a copy
- * of this software and associated documentation files (the "Software"), to 
deal
- * in the Software without restriction, including without limitation the rights
- * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
- * copies of the Software, and to permit persons to whom the Software is
- * furnished to do so, subject to the following