Patchwork [virtio-9p] Flush the debug message out to the log file.

login
register
mail settings
Submitter jvrao
Date June 1, 2010, 8:23 p.m.
Message ID <1275423789-13850-1-git-send-email-jvrao@linux.vnet.ibm.com>
Download mbox | patch
Permalink /patch/54301/
State New
Headers show

Comments

jvrao - June 1, 2010, 8:23 p.m.
This patch fluesh the debug messages to the log file  at the end of each
debug message.

Signed-off-by: Venkateswararao Jujjuri <jvrao@linux.vnet.ibm.com>
---
 hw/virtio-9p-debug.c |    2 ++
 1 files changed, 2 insertions(+), 0 deletions(-)
Aneesh Kumar K.V - June 2, 2010, 11:27 a.m.
On Tue,  1 Jun 2010 13:23:09 -0700, "Venkateswararao Jujjuri (JV)" <jvrao@linux.vnet.ibm.com> wrote:
> This patch fluesh the debug messages to the log file  at the end of each
> debug message.
> 
> Signed-off-by: Venkateswararao Jujjuri <jvrao@linux.vnet.ibm.com>
> ---
>  hw/virtio-9p-debug.c |    2 ++
>  1 files changed, 2 insertions(+), 0 deletions(-)
> 
> diff --git a/hw/virtio-9p-debug.c b/hw/virtio-9p-debug.c
> index 2fb2673..5bfa689 100644
> --- a/hw/virtio-9p-debug.c
> +++ b/hw/virtio-9p-debug.c
> @@ -481,4 +481,6 @@ void pprint_pdu(V9fsPDU *pdu)
>      }
> 
>      fprintf(llogfile, ")\n");
> +    /* Flush the log message out */
> +    fseek(llogfile, 0L, SEEK_CUR);
>  }


Why do one use fseek to flush ? why not fflush(3)

-aneesh
jvrao - June 2, 2010, 2:32 p.m.
Aneesh Kumar K. V wrote:
> On Tue,  1 Jun 2010 13:23:09 -0700, "Venkateswararao Jujjuri (JV)" <jvrao@linux.vnet.ibm.com> wrote:
>> This patch fluesh the debug messages to the log file  at the end of each
>> debug message.
>>
>> Signed-off-by: Venkateswararao Jujjuri <jvrao@linux.vnet.ibm.com>
>> ---
>>  hw/virtio-9p-debug.c |    2 ++
>>  1 files changed, 2 insertions(+), 0 deletions(-)
>>
>> diff --git a/hw/virtio-9p-debug.c b/hw/virtio-9p-debug.c
>> index 2fb2673..5bfa689 100644
>> --- a/hw/virtio-9p-debug.c
>> +++ b/hw/virtio-9p-debug.c
>> @@ -481,4 +481,6 @@ void pprint_pdu(V9fsPDU *pdu)
>>      }
>>
>>      fprintf(llogfile, ")\n");
>> +    /* Flush the log message out */
>> +    fseek(llogfile, 0L, SEEK_CUR);
>>  }
> 
> 
> Why do one use fseek to flush ? why not fflush(3)

Good question. :) 
Even though functionally both are same, I will send a patch with fflush() as it is more straightforward. 

- JV

> 
> -aneesh
>

Patch

diff --git a/hw/virtio-9p-debug.c b/hw/virtio-9p-debug.c
index 2fb2673..5bfa689 100644
--- a/hw/virtio-9p-debug.c
+++ b/hw/virtio-9p-debug.c
@@ -481,4 +481,6 @@  void pprint_pdu(V9fsPDU *pdu)
     }
 
     fprintf(llogfile, ")\n");
+    /* Flush the log message out */
+    fseek(llogfile, 0L, SEEK_CUR);
 }