Re: [Qemu-devel] [PATCH 2/2] vhost-user: add reply for set_mem_table

2015-02-09 Thread Linhaifeng


On 2015/2/10 11:57, Gonglei wrote:
> On 2015/2/10 11:24, linhaifeng wrote:
>> From: Linhaifeng 
>>
>> If u64 is not 0 we should return -1 to tell qemu not going on.
>>
>> Signed-off-by: Linhaifeng 
>> ---
>>  hw/virtio/vhost-user.c | 13 -
>>  1 file changed, 12 insertions(+), 1 deletion(-)
>>
>> diff --git a/hw/virtio/vhost-user.c b/hw/virtio/vhost-user.c
>> index aefe0bb..a68ce36 100644
>> --- a/hw/virtio/vhost-user.c
>> +++ b/hw/virtio/vhost-user.c
>> @@ -243,7 +243,7 @@ static int vhost_user_call(struct vhost_dev *dev, 
>> unsigned long int request,
>>  msg.size = sizeof(m.memory.nregions);
>>  msg.size += sizeof(m.memory.padding);
>>  msg.size += fd_num * sizeof(VhostUserMemoryRegion);
>> -
>> +need_reply = 1;
>>  break;
>>  
>>  case VHOST_SET_LOG_FD:
>> @@ -315,6 +315,17 @@ static int vhost_user_call(struct vhost_dev *dev, 
>> unsigned long int request,
>>  }
>>  memcpy(arg, &msg.state, sizeof(struct vhost_vring_state));
>>  break;
>> +case VHOST_SET_MEM_TABLE:
>> +if (msg.size != sizeof(m.u64)) {
>> +error_report("Received bad msg size.\n");
> A superfluous "\n" character.

Hi Gonglei

Thank you for your review.

Yes, error_report has printed '\n'.
I will remove it.

>> +return -1;
>> +} else {
>> +if (m.u64) {
>> +error_report("Failed to set memory table.\n");
> A superfluous "\n" character.
> 
> Regards,
> -Gonglei
>> +return -1;
>> +}
>> +}
>> +break;
>>  default:
>>  error_report("Received unexpected msg type.\n");
>>  return -1;
>>
> 
> 
> 
> .
> 

-- 
Regards,
Haifeng




Re: [Qemu-devel] [PATCH 2/2] vhost-user: add reply for set_mem_table

2015-02-09 Thread Gonglei
On 2015/2/10 11:24, linhaifeng wrote:
> From: Linhaifeng 
> 
> If u64 is not 0 we should return -1 to tell qemu not going on.
> 
> Signed-off-by: Linhaifeng 
> ---
>  hw/virtio/vhost-user.c | 13 -
>  1 file changed, 12 insertions(+), 1 deletion(-)
> 
> diff --git a/hw/virtio/vhost-user.c b/hw/virtio/vhost-user.c
> index aefe0bb..a68ce36 100644
> --- a/hw/virtio/vhost-user.c
> +++ b/hw/virtio/vhost-user.c
> @@ -243,7 +243,7 @@ static int vhost_user_call(struct vhost_dev *dev, 
> unsigned long int request,
>  msg.size = sizeof(m.memory.nregions);
>  msg.size += sizeof(m.memory.padding);
>  msg.size += fd_num * sizeof(VhostUserMemoryRegion);
> -
> +need_reply = 1;
>  break;
>  
>  case VHOST_SET_LOG_FD:
> @@ -315,6 +315,17 @@ static int vhost_user_call(struct vhost_dev *dev, 
> unsigned long int request,
>  }
>  memcpy(arg, &msg.state, sizeof(struct vhost_vring_state));
>  break;
> +case VHOST_SET_MEM_TABLE:
> +if (msg.size != sizeof(m.u64)) {
> +error_report("Received bad msg size.\n");
A superfluous "\n" character.
> +return -1;
> +} else {
> +if (m.u64) {
> +error_report("Failed to set memory table.\n");
A superfluous "\n" character.

Regards,
-Gonglei
> +return -1;
> +}
> +}
> +break;
>  default:
>  error_report("Received unexpected msg type.\n");
>  return -1;
> 





[Qemu-devel] [PATCH 2/2] vhost-user: add reply for set_mem_table

2015-02-09 Thread linhaifeng
From: Linhaifeng 

If u64 is not 0 we should return -1 to tell qemu not going on.

Signed-off-by: Linhaifeng 
---
 hw/virtio/vhost-user.c | 13 -
 1 file changed, 12 insertions(+), 1 deletion(-)

diff --git a/hw/virtio/vhost-user.c b/hw/virtio/vhost-user.c
index aefe0bb..a68ce36 100644
--- a/hw/virtio/vhost-user.c
+++ b/hw/virtio/vhost-user.c
@@ -243,7 +243,7 @@ static int vhost_user_call(struct vhost_dev *dev, unsigned 
long int request,
 msg.size = sizeof(m.memory.nregions);
 msg.size += sizeof(m.memory.padding);
 msg.size += fd_num * sizeof(VhostUserMemoryRegion);
-
+need_reply = 1;
 break;
 
 case VHOST_SET_LOG_FD:
@@ -315,6 +315,17 @@ static int vhost_user_call(struct vhost_dev *dev, unsigned 
long int request,
 }
 memcpy(arg, &msg.state, sizeof(struct vhost_vring_state));
 break;
+case VHOST_SET_MEM_TABLE:
+if (msg.size != sizeof(m.u64)) {
+error_report("Received bad msg size.\n");
+return -1;
+} else {
+if (m.u64) {
+error_report("Failed to set memory table.\n");
+return -1;
+}
+}
+break;
 default:
 error_report("Received unexpected msg type.\n");
 return -1;
-- 
1.7.12.4