Revision a6c4d364

b/monitor.c
333 333
    return cmd->flags & MONITOR_CMD_ASYNC;
334 334
}
335 335

  
336
static inline bool monitor_cmd_user_only(const mon_cmd_t *cmd)
337
{
338
    return (cmd->flags & MONITOR_CMD_USER_ONLY);
339
}
340

  
336 341
static inline int monitor_has_error(const Monitor *mon)
337 342
{
338 343
    return mon->error != NULL;
......
615 620
        goto help;
616 621
    }
617 622

  
623
    if (monitor_ctrl_mode(mon) && monitor_cmd_user_only(cmd)) {
624
        qerror_report(QERR_COMMAND_NOT_FOUND, item);
625
        return -1;
626
    }
627

  
618 628
    if (monitor_handler_is_async(cmd)) {
619 629
        if (monitor_ctrl_mode(mon)) {
620 630
            qmp_async_info_handler(mon, cmd);
......
712 722
    cmd_list = qlist_new();
713 723

  
714 724
    for (cmd = mon_cmds; cmd->name != NULL; cmd++) {
715
        if (monitor_handler_ported(cmd) && !compare_cmd(cmd->name, "info")) {
725
        if (monitor_handler_ported(cmd) && !monitor_cmd_user_only(cmd) &&
726
            !compare_cmd(cmd->name, "info")) {
716 727
            qlist_append_obj(cmd_list, get_cmd_dict(cmd->name));
717 728
        }
718 729
    }
719 730

  
720 731
    for (cmd = info_cmds; cmd->name != NULL; cmd++) {
721
        if (monitor_handler_ported(cmd)) {
732
        if (monitor_handler_ported(cmd) && !monitor_cmd_user_only(cmd)) {
722 733
            char buf[128];
723 734
            snprintf(buf, sizeof(buf), "query-%s", cmd->name);
724 735
            qlist_append_obj(cmd_list, get_cmd_dict(buf));
......
4271 4282
                      qobject_from_jsonf("{ 'item': %s }", info_item));
4272 4283
    } else {
4273 4284
        cmd = monitor_find_command(cmd_name);
4274
        if (!cmd || !monitor_handler_ported(cmd)) {
4285
        if (!cmd || !monitor_handler_ported(cmd)
4286
            || monitor_cmd_user_only(cmd)) {
4275 4287
            qerror_report(QERR_COMMAND_NOT_FOUND, cmd_name);
4276 4288
            goto err_out;
4277 4289
        }
b/monitor.h
17 17

  
18 18
/* flags for monitor commands */
19 19
#define MONITOR_CMD_ASYNC       0x0001
20
#define MONITOR_CMD_USER_ONLY   0x0002
20 21

  
21 22
/* QMP events */
22 23
typedef enum MonitorEvent {

Also available in: Unified diff