[Qemu-devel] [PATCH 12/13] char: rename functions that are not part of fe

Marc-André Lureau posted 13 patches 8 years, 9 months ago
There is a newer version of this series
[Qemu-devel] [PATCH 12/13] char: rename functions that are not part of fe
Posted by Marc-André Lureau 8 years, 9 months ago
There is no clear reason to have those functions associated with
frontend.

Signed-off-by: Marc-André Lureau <marcandre.lureau@redhat.com>
---
 chardev/char.c | 15 +++++++--------
 1 file changed, 7 insertions(+), 8 deletions(-)

diff --git a/chardev/char.c b/chardev/char.c
index b986ce1857..77e7b347f4 100644
--- a/chardev/char.c
+++ b/chardev/char.c
@@ -66,8 +66,7 @@ void qemu_chr_be_event(Chardev *s, int event)
 
 /* Not reporting errors from writing to logfile, as logs are
  * defined to be "best effort" only */
-static void qemu_chr_fe_write_log(Chardev *s,
-                                  const uint8_t *buf, size_t len)
+static void qemu_chr_write_log(Chardev *s, const uint8_t *buf, size_t len)
 {
     size_t done = 0;
     ssize_t ret;
@@ -91,9 +90,9 @@ static void qemu_chr_fe_write_log(Chardev *s,
     }
 }
 
-static int qemu_chr_fe_write_buffer(Chardev *s,
-                                    const uint8_t *buf, int len,
-                                    int *offset, bool all)
+static int qemu_chr_write_buffer(Chardev *s,
+                                 const uint8_t *buf, int len,
+                                 int *offset, bool all)
 {
     ChardevClass *cc = CHARDEV_GET_CLASS(s);
     int res = 0;
@@ -118,7 +117,7 @@ static int qemu_chr_fe_write_buffer(Chardev *s,
         }
     }
     if (*offset > 0) {
-        qemu_chr_fe_write_log(s, buf, *offset);
+        qemu_chr_write_log(s, buf, *offset);
     }
     qemu_mutex_unlock(&s->chr_write_lock);
 
@@ -133,11 +132,11 @@ int qemu_chr_write(Chardev *s, const uint8_t *buf, int len, bool all)
     if (qemu_chr_replay(s) && replay_mode == REPLAY_MODE_PLAY) {
         replay_char_write_event_load(&res, &offset);
         assert(offset <= len);
-        qemu_chr_fe_write_buffer(s, buf, offset, &offset, true);
+        qemu_chr_write_buffer(s, buf, offset, &offset, true);
         return res;
     }
 
-    res = qemu_chr_fe_write_buffer(s, buf, len, &offset, all);
+    res = qemu_chr_write_buffer(s, buf, len, &offset, all);
 
     if (qemu_chr_replay(s) && replay_mode == REPLAY_MODE_RECORD) {
         replay_char_write_event_save(res, offset);
-- 
2.13.0.rc1.16.gd80b50c3f


Re: [Qemu-devel] [PATCH 12/13] char: rename functions that are not part of fe
Posted by Philippe Mathieu-Daudé 8 years, 9 months ago
On 05/09/2017 08:33 AM, Marc-André Lureau wrote:
> There is no clear reason to have those functions associated with
> frontend.
>
> Signed-off-by: Marc-André Lureau <marcandre.lureau@redhat.com>

Reviewed-by: Philippe Mathieu-Daudé <f4bug@amsat.org>

> ---
>  chardev/char.c | 15 +++++++--------
>  1 file changed, 7 insertions(+), 8 deletions(-)
>
> diff --git a/chardev/char.c b/chardev/char.c
> index b986ce1857..77e7b347f4 100644
> --- a/chardev/char.c
> +++ b/chardev/char.c
> @@ -66,8 +66,7 @@ void qemu_chr_be_event(Chardev *s, int event)
>
>  /* Not reporting errors from writing to logfile, as logs are
>   * defined to be "best effort" only */
> -static void qemu_chr_fe_write_log(Chardev *s,
> -                                  const uint8_t *buf, size_t len)
> +static void qemu_chr_write_log(Chardev *s, const uint8_t *buf, size_t len)
>  {
>      size_t done = 0;
>      ssize_t ret;
> @@ -91,9 +90,9 @@ static void qemu_chr_fe_write_log(Chardev *s,
>      }
>  }
>
> -static int qemu_chr_fe_write_buffer(Chardev *s,
> -                                    const uint8_t *buf, int len,
> -                                    int *offset, bool all)
> +static int qemu_chr_write_buffer(Chardev *s,
> +                                 const uint8_t *buf, int len,
> +                                 int *offset, bool all)
>  {
>      ChardevClass *cc = CHARDEV_GET_CLASS(s);
>      int res = 0;
> @@ -118,7 +117,7 @@ static int qemu_chr_fe_write_buffer(Chardev *s,
>          }
>      }
>      if (*offset > 0) {
> -        qemu_chr_fe_write_log(s, buf, *offset);
> +        qemu_chr_write_log(s, buf, *offset);
>      }
>      qemu_mutex_unlock(&s->chr_write_lock);
>
> @@ -133,11 +132,11 @@ int qemu_chr_write(Chardev *s, const uint8_t *buf, int len, bool all)
>      if (qemu_chr_replay(s) && replay_mode == REPLAY_MODE_PLAY) {
>          replay_char_write_event_load(&res, &offset);
>          assert(offset <= len);
> -        qemu_chr_fe_write_buffer(s, buf, offset, &offset, true);
> +        qemu_chr_write_buffer(s, buf, offset, &offset, true);
>          return res;
>      }
>
> -    res = qemu_chr_fe_write_buffer(s, buf, len, &offset, all);
> +    res = qemu_chr_write_buffer(s, buf, len, &offset, all);
>
>      if (qemu_chr_replay(s) && replay_mode == REPLAY_MODE_RECORD) {
>          replay_char_write_event_save(res, offset);
>