-
Notifications
You must be signed in to change notification settings - Fork 13
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
A simple example conversion 'info name'. This also adds the new files for QMP and HMP. Signed-off-by: Anthony Liguori <aliguori@us.ibm.com> Signed-off-by: Luiz Capitulino <lcapitulino@redhat.com>
- Loading branch information
Anthony Liguori
authored and
Luiz Capitulino
committed
Oct 4, 2011
1 parent
303b54b
commit 48a32be
Showing
7 changed files
with
108 additions
and
28 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
/* | ||
* Human Monitor Interface | ||
* | ||
* Copyright IBM, Corp. 2011 | ||
* | ||
* Authors: | ||
* Anthony Liguori <aliguori@us.ibm.com> | ||
* | ||
* This work is licensed under the terms of the GNU GPL, version 2. See | ||
* the COPYING file in the top-level directory. | ||
* | ||
*/ | ||
|
||
#include "hmp.h" | ||
#include "qmp-commands.h" | ||
|
||
void hmp_info_name(Monitor *mon) | ||
{ | ||
NameInfo *info; | ||
|
||
info = qmp_query_name(NULL); | ||
if (info->has_name) { | ||
monitor_printf(mon, "%s\n", info->name); | ||
} | ||
qapi_free_NameInfo(info); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
/* | ||
* Human Monitor Interface | ||
* | ||
* Copyright IBM, Corp. 2011 | ||
* | ||
* Authors: | ||
* Anthony Liguori <aliguori@us.ibm.com> | ||
* | ||
* This work is licensed under the terms of the GNU GPL, version 2. See | ||
* the COPYING file in the top-level directory. | ||
* | ||
*/ | ||
|
||
#ifndef HMP_H | ||
#define HMP_H | ||
|
||
#include "qemu-common.h" | ||
#include "qapi-types.h" | ||
|
||
void hmp_info_name(Monitor *mon); | ||
|
||
#endif |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,25 @@ | ||
# -*- Mode: Python -*- | ||
# | ||
# QAPI Schema | ||
|
||
## | ||
# @NameInfo: | ||
# | ||
# Guest name information. | ||
# | ||
# @name: #optional The name of the guest | ||
# | ||
# Since 0.14.0 | ||
## | ||
{ 'type': 'NameInfo', 'data': {'*name': 'str'} } | ||
|
||
## | ||
# @query-name: | ||
# | ||
# Return the name information of a guest. | ||
# | ||
# Returns: @NameInfo of the guest | ||
# | ||
# Since 0.14.0 | ||
## | ||
{ 'command': 'query-name', 'returns': 'NameInfo' } |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
/* | ||
* QEMU Management Protocol | ||
* | ||
* Copyright IBM, Corp. 2011 | ||
* | ||
* Authors: | ||
* Anthony Liguori <aliguori@us.ibm.com> | ||
* | ||
* This work is licensed under the terms of the GNU GPL, version 2. See | ||
* the COPYING file in the top-level directory. | ||
* | ||
*/ | ||
|
||
#include "qemu-common.h" | ||
#include "sysemu.h" | ||
#include "qmp-commands.h" | ||
|
||
NameInfo *qmp_query_name(Error **errp) | ||
{ | ||
NameInfo *info = g_malloc0(sizeof(*info)); | ||
|
||
if (qemu_name) { | ||
info->has_name = true; | ||
info->name = g_strdup(qemu_name); | ||
} | ||
|
||
return info; | ||
} |