[2/4] migration/ram.c: use same type in MultiFDPages_t to define offsest
diff mbox series

Message ID 20190528014703.21030-3-richardw.yang@linux.intel.com
State New
Headers show
Series
  • Multifd Cleanup
Related show

Commit Message

Wei Yang May 28, 2019, 1:47 a.m. UTC
MultiFDPacket_t.offset is allocated to store MultiFDPages_t.offset.

It would be better to use the same type.

Signed-off-by: Wei Yang <richardw.yang@linux.intel.com>
---
 migration/ram.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

Comments

Juan Quintela May 28, 2019, 8:12 a.m. UTC | #1
Wei Yang <richardw.yang@linux.intel.com> wrote:
> MultiFDPacket_t.offset is allocated to store MultiFDPages_t.offset.
>
> It would be better to use the same type.
>
> Signed-off-by: Wei Yang <richardw.yang@linux.intel.com>
> ---
>  migration/ram.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/migration/ram.c b/migration/ram.c
> index 4c60869226..dcf4c54eb5 100644
> --- a/migration/ram.c
> +++ b/migration/ram.c
> @@ -607,7 +607,7 @@ typedef struct {
>      uint64_t packet_num;
>      uint64_t unused[4];    /* Reserved for future use */
>      char ramblock[256];
> -    uint64_t offset[];
> +    ram_addr_t offset[];
>  } __attribute__((packed)) MultiFDPacket_t;
>  
>  typedef struct {

This needs a comment, but it is on purpose.  We want that the value on
the wire to be the same for any architecture.  (Migration stream is
supposed to be architecture independent).  ram_addr_t is architecture
dependent.

Later, Juan.
Wei Yang May 29, 2019, 12:34 a.m. UTC | #2
On Tue, May 28, 2019 at 10:12:39AM +0200, Juan Quintela wrote:
>Wei Yang <richardw.yang@linux.intel.com> wrote:
>> MultiFDPacket_t.offset is allocated to store MultiFDPages_t.offset.
>>
>> It would be better to use the same type.
>>
>> Signed-off-by: Wei Yang <richardw.yang@linux.intel.com>
>> ---
>>  migration/ram.c | 2 +-
>>  1 file changed, 1 insertion(+), 1 deletion(-)
>>
>> diff --git a/migration/ram.c b/migration/ram.c
>> index 4c60869226..dcf4c54eb5 100644
>> --- a/migration/ram.c
>> +++ b/migration/ram.c
>> @@ -607,7 +607,7 @@ typedef struct {
>>      uint64_t packet_num;
>>      uint64_t unused[4];    /* Reserved for future use */
>>      char ramblock[256];
>> -    uint64_t offset[];
>> +    ram_addr_t offset[];
>>  } __attribute__((packed)) MultiFDPacket_t;
>>  
>>  typedef struct {
>
>This needs a comment, but it is on purpose.  We want that the value on
>the wire to be the same for any architecture.  (Migration stream is
>supposed to be architecture independent).  ram_addr_t is architecture
>dependent.
>

Sounds reasonable.

>Later, Juan.

Patch
diff mbox series

diff --git a/migration/ram.c b/migration/ram.c
index 4c60869226..dcf4c54eb5 100644
--- a/migration/ram.c
+++ b/migration/ram.c
@@ -607,7 +607,7 @@  typedef struct {
     uint64_t packet_num;
     uint64_t unused[4];    /* Reserved for future use */
     char ramblock[256];
-    uint64_t offset[];
+    ram_addr_t offset[];
 } __attribute__((packed)) MultiFDPacket_t;
 
 typedef struct {