Patchwork [14/14] Rename buffered_ to migration_

login
register
mail settings
Submitter Juan Quintela
Date Jan. 15, 2013, 11:18 a.m.
Message ID <1358248702-14278-15-git-send-email-quintela@redhat.com>
Download mbox | patch
Permalink /patch/212111/
State New
Headers show

Comments

Juan Quintela - Jan. 15, 2013, 11:18 a.m.
This is consistent once that we have moved everything to migration.c

Signed-off-by: Juan Quintela <quintela@redhat.com>
---
 migration.c | 38 +++++++++++++++++++-------------------
 1 file changed, 19 insertions(+), 19 deletions(-)
Paolo Bonzini - Jan. 15, 2013, 3:12 p.m.
Il 15/01/2013 12:18, Juan Quintela ha scritto:
> This is consistent once that we have moved everything to migration.c

Please drop this patch, I have the same changes later in my queue and it
causes a lot of conflicts if you put it here.  It's true that the code
is migration.c, but it is still about buffering so I think the renaming
is premature.

Otherwise the series looks good, thanks!

Paolo

> Signed-off-by: Juan Quintela <quintela@redhat.com>
> ---
>  migration.c | 38 +++++++++++++++++++-------------------
>  1 file changed, 19 insertions(+), 19 deletions(-)
> 
> diff --git a/migration.c b/migration.c
> index 77c1971..ac67525 100644
> --- a/migration.c
> +++ b/migration.c
> @@ -522,7 +522,7 @@ int64_t migrate_xbzrle_cache_size(void)
>  /* migration thread support */
> 
> 
> -static ssize_t buffered_flush(MigrationState *s)
> +static ssize_t migration_flush(MigrationState *s)
>  {
>      size_t offset = 0;
>      ssize_t ret = 0;
> @@ -552,7 +552,7 @@ static ssize_t buffered_flush(MigrationState *s)
>      return offset;
>  }
> 
> -static int buffered_put_buffer(void *opaque, const uint8_t *buf,
> +static int migration_put_buffer(void *opaque, const uint8_t *buf,
>                                 int64_t pos, int size)
>  {
>      MigrationState *s = opaque;
> @@ -585,7 +585,7 @@ static int buffered_put_buffer(void *opaque, const uint8_t *buf,
>      return size;
>  }
> 
> -static int buffered_close(void *opaque)
> +static int migration_close(void *opaque)
>  {
>      MigrationState *s = opaque;
>      ssize_t ret = 0;
> @@ -595,7 +595,7 @@ static int buffered_close(void *opaque)
> 
>      s->xfer_limit = INT_MAX;
>      while (!qemu_file_get_error(s->file) && s->buffer_size) {
> -        ret = buffered_flush(s);
> +        ret = migration_flush(s);
>          if (ret < 0) {
>              break;
>          }
> @@ -609,7 +609,7 @@ static int buffered_close(void *opaque)
>      return ret;
>  }
> 
> -static int buffered_get_fd(void *opaque)
> +static int migration_get_fd(void *opaque)
>  {
>      MigrationState *s = opaque;
> 
> @@ -622,7 +622,7 @@ static int buffered_get_fd(void *opaque)
>   *   1: Time to stop
>   *   negative: There has been an error
>   */
> -static int buffered_rate_limit(void *opaque)
> +static int migration_rate_limit(void *opaque)
>  {
>      MigrationState *s = opaque;
>      int ret;
> @@ -639,7 +639,7 @@ static int buffered_rate_limit(void *opaque)
>      return 0;
>  }
> 
> -static int64_t buffered_set_rate_limit(void *opaque, int64_t new_rate)
> +static int64_t migration_set_rate_limit(void *opaque, int64_t new_rate)
>  {
>      MigrationState *s = opaque;
>      if (qemu_file_get_error(s->file)) {
> @@ -655,14 +655,14 @@ out:
>      return s->xfer_limit;
>  }
> 
> -static int64_t buffered_get_rate_limit(void *opaque)
> +static int64_t migration_get_rate_limit(void *opaque)
>  {
>      MigrationState *s = opaque;
> 
>      return s->xfer_limit;
>  }
> 
> -static void *buffered_file_thread(void *opaque)
> +static void *migration_file_thread(void *opaque)
>  {
>      MigrationState *s = opaque;
>      int64_t initial_time = qemu_get_clock_ms(rt_clock);
> @@ -752,7 +752,7 @@ static void *buffered_file_thread(void *opaque)
>              /* usleep expects microseconds */
>              g_usleep((initial_time + BUFFER_DELAY - current_time)*1000);
>          }
> -        ret = buffered_flush(s);
> +        ret = migration_flush(s);
>          if (ret < 0) {
>              break;
>          }
> @@ -766,13 +766,13 @@ out:
>      return NULL;
>  }
> 
> -static const QEMUFileOps buffered_file_ops = {
> -    .get_fd =         buffered_get_fd,
> -    .put_buffer =     buffered_put_buffer,
> -    .close =          buffered_close,
> -    .rate_limit =     buffered_rate_limit,
> -    .get_rate_limit = buffered_get_rate_limit,
> -    .set_rate_limit = buffered_set_rate_limit,
> +static const QEMUFileOps migration_file_ops = {
> +    .get_fd =         migration_get_fd,
> +    .put_buffer =     migration_put_buffer,
> +    .close =          migration_close,
> +    .rate_limit =     migration_rate_limit,
> +    .get_rate_limit = migration_get_rate_limit,
> +    .set_rate_limit = migration_set_rate_limit,
>  };
> 
>  void migrate_fd_connect(MigrationState *s)
> @@ -786,9 +786,9 @@ void migrate_fd_connect(MigrationState *s)
>      s->xfer_limit = s->bandwidth_limit / XFER_LIMIT_RATIO;
>      s->complete = false;
> 
> -    s->file = qemu_fopen_ops(s, &buffered_file_ops);
> +    s->file = qemu_fopen_ops(s, &migration_file_ops);
> 
> -    qemu_thread_create(&s->thread, buffered_file_thread, s,
> +    qemu_thread_create(&s->thread, migration_file_thread, s,
>                         QEMU_THREAD_DETACHED);
>      notifier_list_notify(&migration_state_notifiers, s);
>  }
>

Patch

diff --git a/migration.c b/migration.c
index 77c1971..ac67525 100644
--- a/migration.c
+++ b/migration.c
@@ -522,7 +522,7 @@  int64_t migrate_xbzrle_cache_size(void)
 /* migration thread support */


-static ssize_t buffered_flush(MigrationState *s)
+static ssize_t migration_flush(MigrationState *s)
 {
     size_t offset = 0;
     ssize_t ret = 0;
@@ -552,7 +552,7 @@  static ssize_t buffered_flush(MigrationState *s)
     return offset;
 }

-static int buffered_put_buffer(void *opaque, const uint8_t *buf,
+static int migration_put_buffer(void *opaque, const uint8_t *buf,
                                int64_t pos, int size)
 {
     MigrationState *s = opaque;
@@ -585,7 +585,7 @@  static int buffered_put_buffer(void *opaque, const uint8_t *buf,
     return size;
 }

-static int buffered_close(void *opaque)
+static int migration_close(void *opaque)
 {
     MigrationState *s = opaque;
     ssize_t ret = 0;
@@ -595,7 +595,7 @@  static int buffered_close(void *opaque)

     s->xfer_limit = INT_MAX;
     while (!qemu_file_get_error(s->file) && s->buffer_size) {
-        ret = buffered_flush(s);
+        ret = migration_flush(s);
         if (ret < 0) {
             break;
         }
@@ -609,7 +609,7 @@  static int buffered_close(void *opaque)
     return ret;
 }

-static int buffered_get_fd(void *opaque)
+static int migration_get_fd(void *opaque)
 {
     MigrationState *s = opaque;

@@ -622,7 +622,7 @@  static int buffered_get_fd(void *opaque)
  *   1: Time to stop
  *   negative: There has been an error
  */
-static int buffered_rate_limit(void *opaque)
+static int migration_rate_limit(void *opaque)
 {
     MigrationState *s = opaque;
     int ret;
@@ -639,7 +639,7 @@  static int buffered_rate_limit(void *opaque)
     return 0;
 }

-static int64_t buffered_set_rate_limit(void *opaque, int64_t new_rate)
+static int64_t migration_set_rate_limit(void *opaque, int64_t new_rate)
 {
     MigrationState *s = opaque;
     if (qemu_file_get_error(s->file)) {
@@ -655,14 +655,14 @@  out:
     return s->xfer_limit;
 }

-static int64_t buffered_get_rate_limit(void *opaque)
+static int64_t migration_get_rate_limit(void *opaque)
 {
     MigrationState *s = opaque;

     return s->xfer_limit;
 }

-static void *buffered_file_thread(void *opaque)
+static void *migration_file_thread(void *opaque)
 {
     MigrationState *s = opaque;
     int64_t initial_time = qemu_get_clock_ms(rt_clock);
@@ -752,7 +752,7 @@  static void *buffered_file_thread(void *opaque)
             /* usleep expects microseconds */
             g_usleep((initial_time + BUFFER_DELAY - current_time)*1000);
         }
-        ret = buffered_flush(s);
+        ret = migration_flush(s);
         if (ret < 0) {
             break;
         }
@@ -766,13 +766,13 @@  out:
     return NULL;
 }

-static const QEMUFileOps buffered_file_ops = {
-    .get_fd =         buffered_get_fd,
-    .put_buffer =     buffered_put_buffer,
-    .close =          buffered_close,
-    .rate_limit =     buffered_rate_limit,
-    .get_rate_limit = buffered_get_rate_limit,
-    .set_rate_limit = buffered_set_rate_limit,
+static const QEMUFileOps migration_file_ops = {
+    .get_fd =         migration_get_fd,
+    .put_buffer =     migration_put_buffer,
+    .close =          migration_close,
+    .rate_limit =     migration_rate_limit,
+    .get_rate_limit = migration_get_rate_limit,
+    .set_rate_limit = migration_set_rate_limit,
 };

 void migrate_fd_connect(MigrationState *s)
@@ -786,9 +786,9 @@  void migrate_fd_connect(MigrationState *s)
     s->xfer_limit = s->bandwidth_limit / XFER_LIMIT_RATIO;
     s->complete = false;

-    s->file = qemu_fopen_ops(s, &buffered_file_ops);
+    s->file = qemu_fopen_ops(s, &migration_file_ops);

-    qemu_thread_create(&s->thread, buffered_file_thread, s,
+    qemu_thread_create(&s->thread, migration_file_thread, s,
                        QEMU_THREAD_DETACHED);
     notifier_list_notify(&migration_state_notifiers, s);
 }