]> git.proxmox.com Git - mirror_qemu.git/commit
qga: bios_supports_mode: decoupling pm-utils and sys logic
authorDaniel Henrique Barboza <danielhb413@gmail.com>
Thu, 21 Jun 2018 10:21:49 +0000 (07:21 -0300)
committerMichael Roth <mdroth@linux.vnet.ibm.com>
Tue, 3 Jul 2018 20:20:51 +0000 (15:20 -0500)
commita5fcf0e3e491ede0d03e71f064e8e6d24e889aab
tree572a6336494cb8b9e0b27f7e1fae680fa2fa9e82
parent304a0fcb397efba40dffded985a6539143cca82c
qga: bios_supports_mode: decoupling pm-utils and sys logic

In bios_supports_mode there is a verification to assert if
the chosen suspend mode is supported by the pmutils tools and,
if not, we see if the Linux sys state files supports it.

This verification is done in the same function, one after
the other, and it works for now. But, when adding a new
suspend mechanism that will not necessarily follow the same
return 0 or 1 logic of pmutils, this code will be hard
to deal with.

This patch decouple the two existing logics into their own
functions, pmutils_supports_mode and linux_sys_state_supports_mode,
which in turn are used inside bios_support_mode. The existing
logic is kept but now it's easier to extend it.

Signed-off-by: Daniel Henrique Barboza <danielhb413@gmail.com>
Signed-off-by: Michael Roth <mdroth@linux.vnet.ibm.com>
qga/commands-posix.c