The handlers for 'add-fd' and 'remove-fd' are unused now and riddled
with legacy cruft. Purge them.
Last use was removed in f2019083de3430101b94d4991a38fd947a08fd32.
Signed-off-by: Peter Krempa <pkrempa(a)redhat.com>
---
src/qemu/qemu_monitor.c | 53 -------------------------
src/qemu/qemu_monitor.h | 4 +-
src/qemu/qemu_monitor_json.c | 75 ------------------------------------
src/qemu/qemu_monitor_json.h | 3 --
4 files changed, 1 insertion(+), 134 deletions(-)
diff --git a/src/qemu/qemu_monitor.c b/src/qemu/qemu_monitor.c
index aa230b3306..865bdbfed1 100644
--- a/src/qemu/qemu_monitor.c
+++ b/src/qemu/qemu_monitor.c
@@ -2789,59 +2789,6 @@ qemuMonitorCloseFileHandle(qemuMonitorPtr mon,
}
-/* Add the open file descriptor FD into the non-negative set FDSET.
- * If NAME is present, it will be passed along for logging purposes.
- * Returns the counterpart fd that qemu received, or -1 on error. */
-int
-qemuMonitorAddFd(qemuMonitorPtr mon, int fdset, int fd, const char *name)
-{
- VIR_DEBUG("fdset=%d, fd=%d, name=%s", fdset, fd, NULLSTR(name));
-
- QEMU_CHECK_MONITOR(mon);
-
- if (fd < 0 || fdset < 0) {
- virReportError(VIR_ERR_INVALID_ARG, "%s",
- _("fd and fdset must be valid"));
- return -1;
- }
-
- if (!mon->hasSendFD) {
- virReportError(VIR_ERR_OPERATION_UNSUPPORTED,
- _("qemu is not using a unix socket monitor, "
- "cannot send fd %s"), NULLSTR(name));
- return -1;
- }
-
- return qemuMonitorJSONAddFd(mon, fdset, fd, name);
-}
-
-
-/* Remove one of qemu's fds from the given FDSET, or if FD is
- * negative, remove the entire set. Preserve any previous error on
- * entry. Returns 0 on success, -1 on error. */
-int
-qemuMonitorRemoveFd(qemuMonitorPtr mon, int fdset, int fd)
-{
- int ret = -1;
- virErrorPtr error;
-
- VIR_DEBUG("fdset=%d, fd=%d", fdset, fd);
-
- error = virSaveLastError();
-
- QEMU_CHECK_MONITOR_GOTO(mon, cleanup);
-
- ret = qemuMonitorJSONRemoveFd(mon, fdset, fd);
-
- cleanup:
- if (error) {
- virSetError(error);
- virFreeError(error);
- }
- return ret;
-}
-
-
int
qemuMonitorAddNetdev(qemuMonitorPtr mon,
const char *netdevstr,
diff --git a/src/qemu/qemu_monitor.h b/src/qemu/qemu_monitor.h
index 70000a1c72..7fdda01bdd 100644
--- a/src/qemu/qemu_monitor.h
+++ b/src/qemu/qemu_monitor.h
@@ -874,14 +874,12 @@ int qemuMonitorGraphicsRelocate(qemuMonitorPtr mon,
int qemuMonitorSendFileHandle(qemuMonitorPtr mon,
const char *fdname,
int fd);
-int qemuMonitorAddFd(qemuMonitorPtr mon, int fdset, int fd, const char *name);
-/* These two functions preserve previous error and only set their own
+/* This function preserves previous error and only set their own
* error if no error was set before.
*/
int qemuMonitorCloseFileHandle(qemuMonitorPtr mon,
const char *fdname);
-int qemuMonitorRemoveFd(qemuMonitorPtr mon, int fdset, int fd);
int qemuMonitorAddNetdev(qemuMonitorPtr mon,
const char *netdevstr,
diff --git a/src/qemu/qemu_monitor_json.c b/src/qemu/qemu_monitor_json.c
index e4404f0199..ae2b3c1992 100644
--- a/src/qemu/qemu_monitor_json.c
+++ b/src/qemu/qemu_monitor_json.c
@@ -3850,81 +3850,6 @@ int qemuMonitorJSONCloseFileHandle(qemuMonitorPtr mon,
}
-int
-qemuMonitorJSONAddFd(qemuMonitorPtr mon, int fdset, int fd, const char *name)
-{
- int ret;
- virJSONValuePtr cmd = qemuMonitorJSONMakeCommand("add-fd",
- "i:fdset-id", fdset,
- "S:opaque", name,
- NULL);
- virJSONValuePtr reply = NULL;
- if (!cmd)
- return -1;
-
- ret = qemuMonitorJSONCommandWithFd(mon, cmd, fd, &reply);
-
- if (ret == 0) {
- /* qemu 1.2 lacks the functionality we need; but we have to
- * probe to find that out. Don't log errors in that case. */
- if (STREQ_NULLABLE(name, "/dev/null") &&
- qemuMonitorJSONHasError(reply, "GenericError")) {
- ret = -2;
- goto cleanup;
- }
- ret = qemuMonitorJSONCheckReply(cmd, reply, VIR_JSON_TYPE_OBJECT);
- }
- if (ret == 0) {
- virJSONValuePtr data = virJSONValueObjectGetObject(reply, "return");
-
- if (virJSONValueObjectGetNumberInt(data, "fd", &ret) < 0) {
- virReportError(VIR_ERR_INTERNAL_ERROR, "%s",
- _("incomplete return information"));
- goto error;
- }
- }
-
- cleanup:
- virJSONValueFree(cmd);
- virJSONValueFree(reply);
- return ret;
-
- error:
- /* Best effort cleanup - kill the entire fdset (even if it has
- * earlier successful fd registrations), since we don't know which
- * fd qemu got, and don't want to leave the fd leaked in qemu. */
- qemuMonitorJSONRemoveFd(mon, fdset, -1);
- ret = -1;
- goto cleanup;
-}
-
-
-int
-qemuMonitorJSONRemoveFd(qemuMonitorPtr mon, int fdset, int fd)
-{
- int ret = -1;
- virJSONValuePtr cmd = qemuMonitorJSONMakeCommand("remove-fd",
- "i:fdset-id", fdset,
- fd < 0 ? NULL :
"i:fd",
- fd, NULL);
- virJSONValuePtr reply = NULL;
- if (!cmd)
- return -1;
-
- if (qemuMonitorJSONCommand(mon, cmd, &reply) < 0)
- goto cleanup;
-
- if (qemuMonitorJSONCheckError(cmd, reply) < 0)
- goto cleanup;
-
- ret = 0;
- cleanup:
- virJSONValueFree(cmd);
- virJSONValueFree(reply);
- return ret;
-}
-
-
int qemuMonitorJSONAddNetdev(qemuMonitorPtr mon,
const char *netdevstr)
{
diff --git a/src/qemu/qemu_monitor_json.h b/src/qemu/qemu_monitor_json.h
index 61e64e831b..af4e15594e 100644
--- a/src/qemu/qemu_monitor_json.h
+++ b/src/qemu/qemu_monitor_json.h
@@ -203,12 +203,9 @@ int qemuMonitorJSONRemovePCIDevice(qemuMonitorPtr mon,
int qemuMonitorJSONSendFileHandle(qemuMonitorPtr mon,
const char *fdname,
int fd);
-int qemuMonitorJSONAddFd(qemuMonitorPtr mon, int fdset, int fd,
- const char *name);
int qemuMonitorJSONCloseFileHandle(qemuMonitorPtr mon,
const char *fdname);
-int qemuMonitorJSONRemoveFd(qemuMonitorPtr mon, int fdset, int fd);
int qemuMonitorJSONAddNetdev(qemuMonitorPtr mon,
const char *netdevstr);
--
2.21.0