提交 8ac470c1 编写于 作者: J Jan Kiszka 提交者: Luiz Capitulino

monitor: Establish cmd flags and convert the async tag

As we want to add more flags to monitor commands, convert the only so
far existing one accordingly.
Signed-off-by: NJan Kiszka <jan.kiszka@siemens.com>
Signed-off-by: NLuiz Capitulino <lcapitulino@redhat.com>
上级 3b6dbf27
...@@ -112,7 +112,7 @@ typedef struct mon_cmd_t { ...@@ -112,7 +112,7 @@ typedef struct mon_cmd_t {
int (*cmd_async)(Monitor *mon, const QDict *params, int (*cmd_async)(Monitor *mon, const QDict *params,
MonitorCompletion *cb, void *opaque); MonitorCompletion *cb, void *opaque);
} mhandler; } mhandler;
int async; int flags;
} mon_cmd_t; } mon_cmd_t;
/* file descriptors passed via SCM_RIGHTS */ /* file descriptors passed via SCM_RIGHTS */
...@@ -327,7 +327,7 @@ static inline int monitor_handler_ported(const mon_cmd_t *cmd) ...@@ -327,7 +327,7 @@ static inline int monitor_handler_ported(const mon_cmd_t *cmd)
static inline bool monitor_handler_is_async(const mon_cmd_t *cmd) static inline bool monitor_handler_is_async(const mon_cmd_t *cmd)
{ {
return cmd->async != 0; return cmd->flags & MONITOR_CMD_ASYNC;
} }
static inline int monitor_has_error(const Monitor *mon) static inline int monitor_has_error(const Monitor *mon)
...@@ -2536,7 +2536,7 @@ static const mon_cmd_t info_cmds[] = { ...@@ -2536,7 +2536,7 @@ static const mon_cmd_t info_cmds[] = {
.help = "show balloon information", .help = "show balloon information",
.user_print = monitor_print_balloon, .user_print = monitor_print_balloon,
.mhandler.info_async = do_info_balloon, .mhandler.info_async = do_info_balloon,
.async = 1, .flags = MONITOR_CMD_ASYNC,
}, },
{ {
.name = "qtree", .name = "qtree",
......
...@@ -15,6 +15,9 @@ extern Monitor *default_mon; ...@@ -15,6 +15,9 @@ extern Monitor *default_mon;
#define MONITOR_USE_READLINE 0x02 #define MONITOR_USE_READLINE 0x02
#define MONITOR_USE_CONTROL 0x04 #define MONITOR_USE_CONTROL 0x04
/* flags for monitor commands */
#define MONITOR_CMD_ASYNC 0x0001
/* QMP events */ /* QMP events */
typedef enum MonitorEvent { typedef enum MonitorEvent {
QEVENT_SHUTDOWN, QEVENT_SHUTDOWN,
......
...@@ -1287,7 +1287,7 @@ ETEXI ...@@ -1287,7 +1287,7 @@ ETEXI
.help = "request VM to change its memory allocation (in MB)", .help = "request VM to change its memory allocation (in MB)",
.user_print = monitor_user_noop, .user_print = monitor_user_noop,
.mhandler.cmd_async = do_balloon, .mhandler.cmd_async = do_balloon,
.async = 1, .flags = MONITOR_CMD_ASYNC,
}, },
STEXI STEXI
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册