On Fri, Dec 01, 2023 at 12:11:32PM -0500, Steven Sistare wrote: > >> diff --git a/include/sysemu/runstate.h b/include/sysemu/runstate.h > >> index f6a337b..1d6828f 100644 > >> --- a/include/sysemu/runstate.h > >> +++ b/include/sysemu/runstate.h > >> @@ -40,6 +40,11 @@ static inline bool > >> shutdown_caused_by_guest(ShutdownCause cause) > >> return cause >= SHUTDOWN_CAUSE_GUEST_SHUTDOWN; > >> } > >> > >> +static inline bool runstate_is_started(RunState state) > > > > Would runstate_has_vm_running() sound better? It is a bit awkward when > > saying something like "start a runstate". > > I have been searching for the perfect name for this accessor. > IMO using "running" in this accessor is confusing because it applies to both > the running and suspended state. So, I invented a new aggregate state called > started. vm_start transitions the machine to a started state. > > How about runstate_was_started? It works well at both start and stop call > sites: > > void vm_resume(RunState state) > if (runstate_was_started(state)) {
This one looks fine, but... > vm_start(); > > int vm_stop_force_state(RunState state) > if (runstate_was_started(runstate_get())) { .. this one makes the past tense not looking good. > return vm_stop(state); How about runstate_is_alive()? So far the best I can come up with. :) Even if you prefer "started", I'd vote for not using past tense, hence runstate_is_started(). Thanks, -- Peter Xu