#include "qapi/qapi-commands-control.h"
#include "qapi/qapi-commands-misc.h"
#include "qapi/qapi-commands-machine.h"
-#include "qapi/error.h"
-#include "qemu/cutils.h"
#if defined(TARGET_S390X)
#include "hw/s390x/storage-keys.h"
/* Make devices configuration available for use in hmp-commands*.hx templates */
#include CONFIG_DEVICES
-/**
- * Is @name in the '|' separated list of names @list?
- */
-int hmp_compare_cmd(const char *name, const char *list)
-{
- const char *p, *pstart;
- int len;
- len = strlen(name);
- p = list;
- for (;;) {
- pstart = p;
- p = qemu_strchrnul(p, '|');
- if ((p - pstart) == len && !memcmp(pstart, name, len)) {
- return 1;
- }
- if (*p == '\0') {
- break;
- }
- p++;
- }
- return 0;
-}
-
/* Please update hmp-commands.hx when adding or changing commands */
static HMPCommand hmp_info_cmds[] = {
#include "hmp-commands-info.h"
sizeof(*hmp_info_cmds),
compare_mon_cmd);
}
-
-void monitor_register_hmp(const char *name, bool info,
- void (*cmd)(Monitor *mon, const QDict *qdict))
-{
- HMPCommand *table = hmp_cmds_for_target(info);
-
- while (table->name != NULL) {
- if (strcmp(table->name, name) == 0) {
- g_assert(table->cmd == NULL && table->cmd_info_hrt == NULL);
- table->cmd = cmd;
- return;
- }
- table++;
- }
- g_assert_not_reached();
-}
-
-void monitor_register_hmp_info_hrt(const char *name,
- HumanReadableText *(*handler)(Error **errp))
-{
- HMPCommand *table = hmp_cmds_for_target(true);
-
- while (table->name != NULL) {
- if (strcmp(table->name, name) == 0) {
- g_assert(table->cmd == NULL && table->cmd_info_hrt == NULL);
- table->cmd_info_hrt = handler;
- return;
- }
- table++;
- }
- g_assert_not_reached();
-}
monitor_event, NULL, &mon->common, NULL, true);
monitor_list_append(&mon->common);
}
+
+/**
+ * Is @name in the '|' separated list of names @list?
+ */
+int hmp_compare_cmd(const char *name, const char *list)
+{
+ const char *p, *pstart;
+ int len;
+ len = strlen(name);
+ p = list;
+ for (;;) {
+ pstart = p;
+ p = qemu_strchrnul(p, '|');
+ if ((p - pstart) == len && !memcmp(pstart, name, len)) {
+ return 1;
+ }
+ if (*p == '\0') {
+ break;
+ }
+ p++;
+ }
+ return 0;
+}
+
+void monitor_register_hmp(const char *name, bool info,
+ void (*cmd)(Monitor *mon, const QDict *qdict))
+{
+ HMPCommand *table = hmp_cmds_for_target(info);
+
+ while (table->name != NULL) {
+ if (strcmp(table->name, name) == 0) {
+ g_assert(table->cmd == NULL && table->cmd_info_hrt == NULL);
+ table->cmd = cmd;
+ return;
+ }
+ table++;
+ }
+ g_assert_not_reached();
+}
+
+void monitor_register_hmp_info_hrt(const char *name,
+ HumanReadableText *(*handler)(Error **errp))
+{
+ HMPCommand *table = hmp_cmds_for_target(true);
+
+ while (table->name != NULL) {
+ if (strcmp(table->name, name) == 0) {
+ g_assert(table->cmd == NULL && table->cmd_info_hrt == NULL);
+ table->cmd_info_hrt = handler;
+ return;
+ }
+ table++;
+ }
+ g_assert_not_reached();
+}