Revision e05486cb
b/monitor.c | ||
---|---|---|
514 | 514 |
QEMU_VERSION, QEMU_PKGVERSION); |
515 | 515 |
} |
516 | 516 |
|
517 |
static void do_info_name(Monitor *mon)
|
|
517 |
static void do_info_name_print(Monitor *mon, const QObject *data)
|
|
518 | 518 |
{ |
519 |
if (qemu_name) |
|
520 |
monitor_printf(mon, "%s\n", qemu_name); |
|
519 |
QDict *qdict; |
|
520 |
|
|
521 |
qdict = qobject_to_qdict(data); |
|
522 |
if (qdict_size(qdict) == 0) { |
|
523 |
return; |
|
524 |
} |
|
525 |
|
|
526 |
monitor_printf(mon, "%s\n", qdict_get_str(qdict, "name")); |
|
527 |
} |
|
528 |
|
|
529 |
/** |
|
530 |
* do_info_name(): Show VM name |
|
531 |
* |
|
532 |
* Return a QDict with the following information: |
|
533 |
* |
|
534 |
* - "name": VM's name (optional) |
|
535 |
* |
|
536 |
* Example: |
|
537 |
* |
|
538 |
* { "name": "qemu-name" } |
|
539 |
*/ |
|
540 |
static void do_info_name(Monitor *mon, QObject **ret_data) |
|
541 |
{ |
|
542 |
*ret_data = qemu_name ? qobject_from_jsonf("{'name': %s }", qemu_name) : |
|
543 |
qobject_from_jsonf("{}"); |
|
521 | 544 |
} |
522 | 545 |
|
523 | 546 |
static QObject *get_cmd_dict(const char *name) |
... | ... | |
2472 | 2495 |
.args_type = "", |
2473 | 2496 |
.params = "", |
2474 | 2497 |
.help = "show the current VM name", |
2475 |
.mhandler.info = do_info_name, |
|
2498 |
.user_print = do_info_name_print, |
|
2499 |
.mhandler.info_new = do_info_name, |
|
2476 | 2500 |
}, |
2477 | 2501 |
{ |
2478 | 2502 |
.name = "uuid", |
Also available in: Unified diff