This change is merely because admin_server would contain all the code
from dispatchers and helpers to the actual APIs. Admin should have
similar structure to the daemon-side remote driver - dispatchers and
helpers in a separate module, APIs in a separate module.
Best viewed with -M.
Signed-off-by: Erik Skultety <eskultet(a)redhat.com>
Signed-off-by: Martin Kletzander <mkletzan(a)redhat.com>
---
daemon/Makefile.am | 5 +-
daemon/admin.c | 126 ++++++++++++++++++++++++++++++++++++++++++++++++++
daemon/admin.h | 36 +++++++++++++++
daemon/admin_server.c | 126 --------------------------------------------------
daemon/admin_server.h | 36 ---------------
daemon/libvirtd.c | 2 +-
po/POTFILES.in | 2 +-
7 files changed, 167 insertions(+), 166 deletions(-)
create mode 100644 daemon/admin.c
create mode 100644 daemon/admin.h
delete mode 100644 daemon/admin_server.c
delete mode 100644 daemon/admin_server.h
diff --git a/daemon/Makefile.am b/daemon/Makefile.am
index be1b5a9..9edaf5f 100644
--- a/daemon/Makefile.am
+++ b/daemon/Makefile.am
@@ -128,7 +128,7 @@ libvirtd_conf_la_LIBADD = $(LIBXML_LIBS)
noinst_LTLIBRARIES += libvirtd_admin.la
libvirtd_admin_la_SOURCES = \
- admin_server.c admin_server.h
+ admin.c admin.h
libvirtd_admin_la_CFLAGS = \
$(AM_CFLAGS) \
@@ -319,7 +319,8 @@ endif ! WITH_POLKIT
remote.c: $(DAEMON_GENERATED)
remote.h: $(DAEMON_GENERATED)
-admin_server.c: $(DAEMON_GENERATED)
+admin.c: $(DAEMON_GENERATED)
+admin.h: $(DAEMON_GENERATED)
LOGROTATE_CONFS = libvirtd.qemu.logrotate libvirtd.lxc.logrotate \
libvirtd.libxl.logrotate libvirtd.uml.logrotate \
diff --git a/daemon/admin.c b/daemon/admin.c
new file mode 100644
index 0000000..fa6caf3
--- /dev/null
+++ b/daemon/admin.c
@@ -0,0 +1,126 @@
+/*
+ * admin.c: handlers for admin RPC method calls
+ *
+ * Copyright (C) 2014-2016 Red Hat, Inc.
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library. If not, see
+ * <
http://www.gnu.org/licenses/>.
+ *
+ * Author: Martin Kletzander <mkletzan(a)redhat.com>
+ */
+
+#include <config.h>
+
+#include "internal.h"
+#include "libvirtd.h"
+#include "libvirt_internal.h"
+
+#include "admin_protocol.h"
+#include "admin.h"
+#include "datatypes.h"
+#include "viralloc.h"
+#include "virerror.h"
+#include "virlog.h"
+#include "virnetdaemon.h"
+#include "virnetserver.h"
+#include "virstring.h"
+#include "virthreadjob.h"
+
+#define VIR_FROM_THIS VIR_FROM_ADMIN
+
+VIR_LOG_INIT("daemon.admin");
+
+
+void
+remoteAdmClientFreeFunc(void *data)
+{
+ struct daemonAdmClientPrivate *priv = data;
+
+ virMutexDestroy(&priv->lock);
+ virObjectUnref(priv->dmn);
+ VIR_FREE(priv);
+}
+
+void *
+remoteAdmClientInitHook(virNetServerClientPtr client ATTRIBUTE_UNUSED,
+ void *opaque)
+{
+ struct daemonAdmClientPrivate *priv;
+
+ if (VIR_ALLOC(priv) < 0)
+ return NULL;
+
+ if (virMutexInit(&priv->lock) < 0) {
+ VIR_FREE(priv);
+ virReportSystemError(errno, "%s", _("unable to init
mutex"));
+ return NULL;
+ }
+
+ /*
+ * We don't necessarily need to ref this object right now as there
+ * must be one ref being held throughout the life of the daemon,
+ * but let's just be safe for future.
+ */
+ priv->dmn = virObjectRef(opaque);
+
+ return priv;
+}
+
+/* Functions */
+static int
+adminDispatchConnectOpen(virNetServerPtr server ATTRIBUTE_UNUSED,
+ virNetServerClientPtr client,
+ virNetMessagePtr msg ATTRIBUTE_UNUSED,
+ virNetMessageErrorPtr rerr,
+ struct admin_connect_open_args *args)
+{
+ unsigned int flags;
+ struct daemonAdmClientPrivate *priv =
+ virNetServerClientGetPrivateData(client);
+ int ret = -1;
+
+ VIR_DEBUG("priv=%p dmn=%p", priv, priv->dmn);
+ virMutexLock(&priv->lock);
+
+ flags = args->flags;
+ virCheckFlagsGoto(0, cleanup);
+
+ ret = 0;
+ cleanup:
+ if (ret < 0)
+ virNetMessageSaveError(rerr);
+ virMutexUnlock(&priv->lock);
+ return ret;
+}
+
+static int
+adminDispatchConnectClose(virNetServerPtr server ATTRIBUTE_UNUSED,
+ virNetServerClientPtr client,
+ virNetMessagePtr msg ATTRIBUTE_UNUSED,
+ virNetMessageErrorPtr rerr ATTRIBUTE_UNUSED)
+{
+ virNetServerClientDelayedClose(client);
+ return 0;
+}
+
+static int
+adminConnectGetLibVersion(virNetDaemonPtr dmn ATTRIBUTE_UNUSED,
+ unsigned long long *libVer)
+{
+ if (libVer)
+ *libVer = LIBVIR_VERSION_NUMBER;
+ return 0;
+}
+
+#include "admin_dispatch.h"
diff --git a/daemon/admin.h b/daemon/admin.h
new file mode 100644
index 0000000..c869cc7
--- /dev/null
+++ b/daemon/admin.h
@@ -0,0 +1,36 @@
+/*
+ * admin.h: handlers for admin RPC method calls
+ *
+ * Copyright (C) 2014-2016 Red Hat, Inc.
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library. If not, see
+ * <
http://www.gnu.org/licenses/>.
+ *
+ * Author: Martin Kletzander <mkletzan(a)redhat.com>
+ */
+
+#ifndef __LIBVIRTD_ADMIN_H__
+# define __LIBVIRTD_ADMIN_H__
+
+# include "rpc/virnetserverprogram.h"
+# include "rpc/virnetserverclient.h"
+
+
+extern virNetServerProgramProc adminProcs[];
+extern size_t adminNProcs;
+
+void remoteAdmClientFreeFunc(void *data);
+void *remoteAdmClientInitHook(virNetServerClientPtr client, void *opaque);
+
+#endif /* __ADMIN_REMOTE_H__ */
diff --git a/daemon/admin_server.c b/daemon/admin_server.c
deleted file mode 100644
index 189091e..0000000
--- a/daemon/admin_server.c
+++ /dev/null
@@ -1,126 +0,0 @@
-/*
- * admin_server.c:
- *
- * Copyright (C) 2014-2015 Red Hat, Inc.
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation; either
- * version 2.1 of the License, or (at your option) any later version.
- *
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this library. If not, see
- * <
http://www.gnu.org/licenses/>.
- *
- * Author: Martin Kletzander <mkletzan(a)redhat.com>
- */
-
-#include <config.h>
-
-#include "internal.h"
-#include "libvirtd.h"
-#include "libvirt_internal.h"
-
-#include "admin_protocol.h"
-#include "admin_server.h"
-#include "datatypes.h"
-#include "viralloc.h"
-#include "virerror.h"
-#include "virlog.h"
-#include "virnetdaemon.h"
-#include "virnetserver.h"
-#include "virstring.h"
-#include "virthreadjob.h"
-
-#define VIR_FROM_THIS VIR_FROM_ADMIN
-
-VIR_LOG_INIT("daemon.admin");
-
-
-void
-remoteAdmClientFreeFunc(void *data)
-{
- struct daemonAdmClientPrivate *priv = data;
-
- virMutexDestroy(&priv->lock);
- virObjectUnref(priv->dmn);
- VIR_FREE(priv);
-}
-
-void *
-remoteAdmClientInitHook(virNetServerClientPtr client ATTRIBUTE_UNUSED,
- void *opaque)
-{
- struct daemonAdmClientPrivate *priv;
-
- if (VIR_ALLOC(priv) < 0)
- return NULL;
-
- if (virMutexInit(&priv->lock) < 0) {
- VIR_FREE(priv);
- virReportSystemError(errno, "%s", _("unable to init
mutex"));
- return NULL;
- }
-
- /*
- * We don't necessarily need to ref this object right now as there
- * must be one ref being held throughout the life of the daemon,
- * but let's just be safe for future.
- */
- priv->dmn = virObjectRef(opaque);
-
- return priv;
-}
-
-/* Functions */
-static int
-adminDispatchConnectOpen(virNetServerPtr server ATTRIBUTE_UNUSED,
- virNetServerClientPtr client,
- virNetMessagePtr msg ATTRIBUTE_UNUSED,
- virNetMessageErrorPtr rerr,
- struct admin_connect_open_args *args)
-{
- unsigned int flags;
- struct daemonAdmClientPrivate *priv =
- virNetServerClientGetPrivateData(client);
- int ret = -1;
-
- VIR_DEBUG("priv=%p dmn=%p", priv, priv->dmn);
- virMutexLock(&priv->lock);
-
- flags = args->flags;
- virCheckFlagsGoto(0, cleanup);
-
- ret = 0;
- cleanup:
- if (ret < 0)
- virNetMessageSaveError(rerr);
- virMutexUnlock(&priv->lock);
- return ret;
-}
-
-static int
-adminDispatchConnectClose(virNetServerPtr server ATTRIBUTE_UNUSED,
- virNetServerClientPtr client,
- virNetMessagePtr msg ATTRIBUTE_UNUSED,
- virNetMessageErrorPtr rerr ATTRIBUTE_UNUSED)
-{
- virNetServerClientDelayedClose(client);
- return 0;
-}
-
-static int
-adminConnectGetLibVersion(virNetDaemonPtr dmn ATTRIBUTE_UNUSED,
- unsigned long long *libVer)
-{
- if (libVer)
- *libVer = LIBVIR_VERSION_NUMBER;
- return 0;
-}
-
-#include "admin_dispatch.h"
diff --git a/daemon/admin_server.h b/daemon/admin_server.h
deleted file mode 100644
index 26721a6..0000000
--- a/daemon/admin_server.h
+++ /dev/null
@@ -1,36 +0,0 @@
-/*
- * admin_server.h
- *
- * Copyright (C) 2014 Red Hat, Inc.
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation; either
- * version 2.1 of the License, or (at your option) any later version.
- *
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this library. If not, see
- * <
http://www.gnu.org/licenses/>.
- *
- * Author: Martin Kletzander <mkletzan(a)redhat.com>
- */
-
-#ifndef __LIBVIRTD_ADMIN_H__
-# define __LIBVIRTD_ADMIN_H__
-
-# include "rpc/virnetserverprogram.h"
-# include "rpc/virnetserverclient.h"
-
-
-extern virNetServerProgramProc adminProcs[];
-extern size_t adminNProcs;
-
-void remoteAdmClientFreeFunc(void *data);
-void *remoteAdmClientInitHook(virNetServerClientPtr client, void *opaque);
-
-#endif /* __ADMIN_REMOTE_H__ */
diff --git a/daemon/libvirtd.c b/daemon/libvirtd.c
index a747553..d1b98c9 100644
--- a/daemon/libvirtd.c
+++ b/daemon/libvirtd.c
@@ -44,7 +44,7 @@
#include "libvirtd.h"
#include "libvirtd-config.h"
-#include "admin_server.h"
+#include "admin.h"
#include "viruuid.h"
#include "remote_driver.h"
#include "viralloc.h"
diff --git a/po/POTFILES.in b/po/POTFILES.in
index 4d82a8f..5fd6402 100644
--- a/po/POTFILES.in
+++ b/po/POTFILES.in
@@ -1,5 +1,5 @@
daemon/admin_dispatch.h
-daemon/admin_server.c
+daemon/admin.c
daemon/libvirtd-config.c
daemon/libvirtd.c
daemon/qemu_dispatch.h
--
2.4.3