diff mbox series

[v3,02/26] chardev: remove qemu_chr_fe_write_all() counter

Message ID 20180618161729.334-3-marcandre.lureau@redhat.com
State New
Headers show
Series None | expand

Commit Message

Marc-André Lureau June 18, 2018, 4:17 p.m. UTC
There is no obvious reason to have a loop counter. This limits from
reading several megabytes large buffers in one go, since socket
read/write usually have a limit.

Signed-off-by: Marc-André Lureau <marcandre.lureau@redhat.com>
---
 chardev/char-fe.c | 6 +-----
 1 file changed, 1 insertion(+), 5 deletions(-)

Comments

Paolo Bonzini June 20, 2018, 1:53 p.m. UTC | #1
On 18/06/2018 18:17, Marc-André Lureau wrote:
> There is no obvious reason to have a loop counter. This limits from
> reading several megabytes large buffers in one go, since socket
> read/write usually have a limit.
> 
> Signed-off-by: Marc-André Lureau <marcandre.lureau@redhat.com>
> ---
>  chardev/char-fe.c | 6 +-----
>  1 file changed, 1 insertion(+), 5 deletions(-)
> 
> diff --git a/chardev/char-fe.c b/chardev/char-fe.c
> index b1f228e8b5..f158f158f8 100644
> --- a/chardev/char-fe.c
> +++ b/chardev/char-fe.c
> @@ -56,7 +56,7 @@ int qemu_chr_fe_write_all(CharBackend *be, const uint8_t *buf, int len)
>  int qemu_chr_fe_read_all(CharBackend *be, uint8_t *buf, int len)
>  {
>      Chardev *s = be->chr;
> -    int offset = 0, counter = 10;
> +    int offset = 0;
>      int res;
>  
>      if (!s || !CHARDEV_GET_CLASS(s)->chr_sync_read) {
> @@ -88,10 +88,6 @@ int qemu_chr_fe_read_all(CharBackend *be, uint8_t *buf, int len)
>          }
>  
>          offset += res;
> -
> -        if (!counter--) {
> -            break;
> -        }
>      }
>  
>      if (qemu_chr_replay(s) && replay_mode == REPLAY_MODE_RECORD) {
> 

Reviewed-by: Paolo Bonzini <pbonzini@redhat.com>
Peter Maydell June 20, 2018, 2:03 p.m. UTC | #2
On 18 June 2018 at 17:17, Marc-André Lureau <marcandre.lureau@redhat.com> wrote:
> There is no obvious reason to have a loop counter. This limits from
> reading several megabytes large buffers in one go, since socket
> read/write usually have a limit.
>
> Signed-off-by: Marc-André Lureau <marcandre.lureau@redhat.com>
> ---
>  chardev/char-fe.c | 6 +-----
>  1 file changed, 1 insertion(+), 5 deletions(-)

> diff --git a/chardev/char-fe.c b/chardev/char-fe.c
> index b1f228e8b5..f158f158f8 100644
> --- a/chardev/char-fe.c
> +++ b/chardev/char-fe.c
> @@ -56,7 +56,7 @@ int qemu_chr_fe_write_all(CharBackend *be, const uint8_t *buf, int len)
>  int qemu_chr_fe_read_all(CharBackend *be, uint8_t *buf, int len)
>  {
>      Chardev *s = be->chr;
> -    int offset = 0, counter = 10;
> +    int offset = 0;
>      int res;

Subject says "qemu_char_fe_write_all()" but patch is changing
qemu_chr_fe_read_all()...

thanks
-- PMM
Marc-André Lureau June 20, 2018, 2:36 p.m. UTC | #3
On Wed, Jun 20, 2018 at 4:03 PM, Peter Maydell <peter.maydell@linaro.org> wrote:
> On 18 June 2018 at 17:17, Marc-André Lureau <marcandre.lureau@redhat.com> wrote:
>> There is no obvious reason to have a loop counter. This limits from
>> reading several megabytes large buffers in one go, since socket
>> read/write usually have a limit.
>>
>> Signed-off-by: Marc-André Lureau <marcandre.lureau@redhat.com>
>> ---
>>  chardev/char-fe.c | 6 +-----
>>  1 file changed, 1 insertion(+), 5 deletions(-)
>
>> diff --git a/chardev/char-fe.c b/chardev/char-fe.c
>> index b1f228e8b5..f158f158f8 100644
>> --- a/chardev/char-fe.c
>> +++ b/chardev/char-fe.c
>> @@ -56,7 +56,7 @@ int qemu_chr_fe_write_all(CharBackend *be, const uint8_t *buf, int len)
>>  int qemu_chr_fe_read_all(CharBackend *be, uint8_t *buf, int len)
>>  {
>>      Chardev *s = be->chr;
>> -    int offset = 0, counter = 10;
>> +    int offset = 0;
>>      int res;
>
> Subject says "qemu_char_fe_write_all()" but patch is changing
> qemu_chr_fe_read_all()...
>

indeed, fixed.
thanks
diff mbox series

Patch

diff --git a/chardev/char-fe.c b/chardev/char-fe.c
index b1f228e8b5..f158f158f8 100644
--- a/chardev/char-fe.c
+++ b/chardev/char-fe.c
@@ -56,7 +56,7 @@  int qemu_chr_fe_write_all(CharBackend *be, const uint8_t *buf, int len)
 int qemu_chr_fe_read_all(CharBackend *be, uint8_t *buf, int len)
 {
     Chardev *s = be->chr;
-    int offset = 0, counter = 10;
+    int offset = 0;
     int res;
 
     if (!s || !CHARDEV_GET_CLASS(s)->chr_sync_read) {
@@ -88,10 +88,6 @@  int qemu_chr_fe_read_all(CharBackend *be, uint8_t *buf, int len)
         }
 
         offset += res;
-
-        if (!counter--) {
-            break;
-        }
     }
 
     if (qemu_chr_replay(s) && replay_mode == REPLAY_MODE_RECORD) {