mirror of
https://github.com/Motorhead1991/qemu.git
synced 2025-08-03 15:53:54 -06:00
Merge remote-tracking branch 'qmp/queue/qmp' into staging
* qmp/queue/qmp: qapi: Convert getfd and closefd qapi: input_type_enum(): fix error message qmp: dump-guest-memory: improve schema doc
This commit is contained in:
commit
513e6bde4f
7 changed files with 98 additions and 41 deletions
32
monitor.c
32
monitor.c
|
@ -2307,48 +2307,45 @@ static void do_inject_mce(Monitor *mon, const QDict *qdict)
|
|||
}
|
||||
#endif
|
||||
|
||||
static int do_getfd(Monitor *mon, const QDict *qdict, QObject **ret_data)
|
||||
void qmp_getfd(const char *fdname, Error **errp)
|
||||
{
|
||||
const char *fdname = qdict_get_str(qdict, "fdname");
|
||||
mon_fd_t *monfd;
|
||||
int fd;
|
||||
|
||||
fd = qemu_chr_fe_get_msgfd(mon->chr);
|
||||
fd = qemu_chr_fe_get_msgfd(cur_mon->chr);
|
||||
if (fd == -1) {
|
||||
qerror_report(QERR_FD_NOT_SUPPLIED);
|
||||
return -1;
|
||||
error_set(errp, QERR_FD_NOT_SUPPLIED);
|
||||
return;
|
||||
}
|
||||
|
||||
if (qemu_isdigit(fdname[0])) {
|
||||
qerror_report(QERR_INVALID_PARAMETER_VALUE, "fdname",
|
||||
"a name not starting with a digit");
|
||||
return -1;
|
||||
error_set(errp, QERR_INVALID_PARAMETER_VALUE, "fdname",
|
||||
"a name not starting with a digit");
|
||||
return;
|
||||
}
|
||||
|
||||
QLIST_FOREACH(monfd, &mon->fds, next) {
|
||||
QLIST_FOREACH(monfd, &cur_mon->fds, next) {
|
||||
if (strcmp(monfd->name, fdname) != 0) {
|
||||
continue;
|
||||
}
|
||||
|
||||
close(monfd->fd);
|
||||
monfd->fd = fd;
|
||||
return 0;
|
||||
return;
|
||||
}
|
||||
|
||||
monfd = g_malloc0(sizeof(mon_fd_t));
|
||||
monfd->name = g_strdup(fdname);
|
||||
monfd->fd = fd;
|
||||
|
||||
QLIST_INSERT_HEAD(&mon->fds, monfd, next);
|
||||
return 0;
|
||||
QLIST_INSERT_HEAD(&cur_mon->fds, monfd, next);
|
||||
}
|
||||
|
||||
static int do_closefd(Monitor *mon, const QDict *qdict, QObject **ret_data)
|
||||
void qmp_closefd(const char *fdname, Error **errp)
|
||||
{
|
||||
const char *fdname = qdict_get_str(qdict, "fdname");
|
||||
mon_fd_t *monfd;
|
||||
|
||||
QLIST_FOREACH(monfd, &mon->fds, next) {
|
||||
QLIST_FOREACH(monfd, &cur_mon->fds, next) {
|
||||
if (strcmp(monfd->name, fdname) != 0) {
|
||||
continue;
|
||||
}
|
||||
|
@ -2357,11 +2354,10 @@ static int do_closefd(Monitor *mon, const QDict *qdict, QObject **ret_data)
|
|||
close(monfd->fd);
|
||||
g_free(monfd->name);
|
||||
g_free(monfd);
|
||||
return 0;
|
||||
return;
|
||||
}
|
||||
|
||||
qerror_report(QERR_FD_NOT_FOUND, fdname);
|
||||
return -1;
|
||||
error_set(errp, QERR_FD_NOT_FOUND, fdname);
|
||||
}
|
||||
|
||||
static void do_loadvm(Monitor *mon, const QDict *qdict)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue