Vladimir Sementsov-Ogievskiy <[email protected]> wrote:
> Actually global_state_store() can never fail. Let's get rid of extra
> error paths.
>
> To make things clear, use new runstate_get() and use same approach for
> global_state_store() and global_state_store_running().
>
> Signed-off-by: Vladimir Sementsov-Ogievskiy <[email protected]>
I don't know.
On one hand, you have removed a lot of code that "can't" happen.
On the other:
> +static void global_state_do_store(RunState state)
> {
> - if (!runstate_store((char *)global_state.runstate,
> - sizeof(global_state.runstate))) {
> - error_report("runstate name too big: %s", global_state.runstate);
> - trace_migrate_state_too_big();
> - return -EINVAL;
> - }
> - return 0;
> + const char *state_str = RunState_str(state);
> + assert(strlen(state_str) < sizeof(global_state.runstate));
First: g_assert() please.
Second: We try really hard not to fail during migration and get the
whole qemu back. One assert is bad. Specially in a place like this
one, where we know that nothing is broken, simpli that we can't migrate.
Later, Juan.