[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [PATCH 1/2] migration: Boost SaveStateEntry.instance_id to 64 bits
From: |
Juan Quintela |
Subject: |
Re: [PATCH 1/2] migration: Boost SaveStateEntry.instance_id to 64 bits |
Date: |
Tue, 15 Oct 2019 14:57:40 +0200 |
User-agent: |
Gnus/5.13 (Gnus v5.13) Emacs/26.2 (gnu/linux) |
"Dr. David Alan Gilbert" <address@hidden> wrote:
> * Juan Quintela (address@hidden) wrote:
>> Peter Xu <address@hidden> wrote:
>> > It was "int" and used as 32bits fields (see save_section_header()).
>> > It's unsafe already because sizeof(int) could be 2 on i386, I think.
>> > So at least uint32_t would suite more. While it also uses "-1" as a
>> > placeholder of "we want to generate the instance ID automatically".
>> > Hence a more proper value should be int64_t.
>> >
>> > This will start to be useful after next patch in which we can start to
>> > convert a real uint32_t value as instance ID.
>> >
>> > Signed-off-by: Peter Xu <address@hidden>
>>
>> Hi
>>
>> Being more helpful, I think that it is better to just:
>>
>> * change instance_id to be an uint32_t (notice that for all architectures
>> that we support, it is actually int32_t).
>>
>> * export calculate_new_instance_id() and adjust callers that use -1.
>>
>> or
>>
>> * export a new function that just use the calculate_new_instance_id()
>
> Do you mean that we end up with two functions, one that does it
> automatically, and one that takes an ID?
That is one option.
The other is that we export calculate_new_instance_id(), and we use that
instead of -1.
Later, Juan.