mirror of
https://github.com/Motorhead1991/qemu.git
synced 2025-12-11 16:00:50 -07:00
dump: add 'query-dump-guest-memory-capability' command
'query-dump-guest-memory-capability' is used to query the available formats for
'dump-guest-memory'. The output of the command will be like:
-> { "execute": "query-dump-guest-memory-capability" }
<- { "return": { "formats":
["elf", "kdump-zlib", "kdump-lzo", "kdump-snappy"] }
Signed-off-by: Qiao Nuohan <qiaonuohan@cn.fujitsu.com>
Reviewed-by: Eric Blake <eblake@redhat.com>
Signed-off-by: Luiz Capitulino <lcapitulino@redhat.com>
This commit is contained in:
parent
4ab23a9182
commit
7d6dc7f30c
3 changed files with 77 additions and 0 deletions
33
dump.c
33
dump.c
|
|
@ -1791,3 +1791,36 @@ void qmp_dump_guest_memory(bool paging, const char *file, bool has_begin,
|
|||
|
||||
g_free(s);
|
||||
}
|
||||
|
||||
DumpGuestMemoryCapability *qmp_query_dump_guest_memory_capability(Error **errp)
|
||||
{
|
||||
DumpGuestMemoryFormatList *item;
|
||||
DumpGuestMemoryCapability *cap =
|
||||
g_malloc0(sizeof(DumpGuestMemoryCapability));
|
||||
|
||||
/* elf is always available */
|
||||
item = g_malloc0(sizeof(DumpGuestMemoryFormatList));
|
||||
cap->formats = item;
|
||||
item->value = DUMP_GUEST_MEMORY_FORMAT_ELF;
|
||||
|
||||
/* kdump-zlib is always available */
|
||||
item->next = g_malloc0(sizeof(DumpGuestMemoryFormatList));
|
||||
item = item->next;
|
||||
item->value = DUMP_GUEST_MEMORY_FORMAT_KDUMP_ZLIB;
|
||||
|
||||
/* add new item if kdump-lzo is available */
|
||||
#ifdef CONFIG_LZO
|
||||
item->next = g_malloc0(sizeof(DumpGuestMemoryFormatList));
|
||||
item = item->next;
|
||||
item->value = DUMP_GUEST_MEMORY_FORMAT_KDUMP_LZO;
|
||||
#endif
|
||||
|
||||
/* add new item if kdump-snappy is available */
|
||||
#ifdef CONFIG_SNAPPY
|
||||
item->next = g_malloc0(sizeof(DumpGuestMemoryFormatList));
|
||||
item = item->next;
|
||||
item->value = DUMP_GUEST_MEMORY_FORMAT_KDUMP_SNAPPY;
|
||||
#endif
|
||||
|
||||
return cap;
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue