summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorZbigniew Jędrzejewski-Szmek <zbyszek@in.waw.pl>2013-09-25 13:26:08 +0200
committerZbigniew Jędrzejewski-Szmek <zbyszek@in.waw.pl>2013-09-26 11:12:04 +0200
commitbd16acf35e13a19cd2ded0a0c2ef774a98f73808 (patch)
tree4a80ae45c2335d63096f632c085ab28f1566d509
parent732bfe09aeffc3cd78b80ee9e20c9c3babd944d6 (diff)
Move functions around to fix underlinking in test-machine-tables
-rw-r--r--src/machine/machined-dbus.c46
-rw-r--r--src/machine/machined.c46
2 files changed, 46 insertions, 46 deletions
diff --git a/src/machine/machined-dbus.c b/src/machine/machined-dbus.c
index a526a5243e..22caadfceb 100644
--- a/src/machine/machined-dbus.c
+++ b/src/machine/machined-dbus.c
@@ -40,6 +40,7 @@
#include "unit-name.h"
#include "bus-errors.h"
#include "virt.h"
+#include "cgroup-util.h"
#define BUS_MANAGER_INTERFACE \
" <interface name=\"org.freedesktop.machine1.Manager\">\n" \
@@ -994,3 +995,48 @@ int manager_unit_is_active(Manager *manager, const char *unit) {
return !streq(state, "inactive") && !streq(state, "failed");
}
+
+int manager_add_machine(Manager *m, const char *name, Machine **_machine) {
+ Machine *machine;
+
+ assert(m);
+ assert(name);
+
+ machine = hashmap_get(m->machines, name);
+ if (machine) {
+ if (_machine)
+ *_machine = machine;
+
+ return 0;
+ }
+
+ machine = machine_new(m, name);
+ if (!machine)
+ return -ENOMEM;
+
+ if (_machine)
+ *_machine = machine;
+
+ return 0;
+}
+
+int manager_get_machine_by_pid(Manager *m, pid_t pid, Machine **machine) {
+ _cleanup_free_ char *unit = NULL;
+ Machine *mm;
+ int r;
+
+ assert(m);
+ assert(pid >= 1);
+ assert(machine);
+
+ r = cg_pid_get_unit(pid, &unit);
+ if (r < 0)
+ return r;
+
+ mm = hashmap_get(m->machine_units, unit);
+ if (!mm)
+ return 0;
+
+ *machine = mm;
+ return 1;
+}
diff --git a/src/machine/machined.c b/src/machine/machined.c
index 3ce51da90d..ad804a1e14 100644
--- a/src/machine/machined.c
+++ b/src/machine/machined.c
@@ -34,7 +34,6 @@
#include "strv.h"
#include "conf-parser.h"
#include "mkdir.h"
-#include "cgroup-util.h"
Manager *manager_new(void) {
Manager *m;
@@ -83,30 +82,6 @@ void manager_free(Manager *m) {
free(m);
}
-int manager_add_machine(Manager *m, const char *name, Machine **_machine) {
- Machine *machine;
-
- assert(m);
- assert(name);
-
- machine = hashmap_get(m->machines, name);
- if (machine) {
- if (_machine)
- *_machine = machine;
-
- return 0;
- }
-
- machine = machine_new(m, name);
- if (!machine)
- return -ENOMEM;
-
- if (_machine)
- *_machine = machine;
-
- return 0;
-}
-
int manager_enumerate_machines(Manager *m) {
_cleanup_closedir_ DIR *d = NULL;
struct dirent *de;
@@ -149,27 +124,6 @@ int manager_enumerate_machines(Manager *m) {
return r;
}
-int manager_get_machine_by_pid(Manager *m, pid_t pid, Machine **machine) {
- _cleanup_free_ char *unit = NULL;
- Machine *mm;
- int r;
-
- assert(m);
- assert(pid >= 1);
- assert(machine);
-
- r = cg_pid_get_unit(pid, &unit);
- if (r < 0)
- return r;
-
- mm = hashmap_get(m->machine_units, unit);
- if (!mm)
- return 0;
-
- *machine = mm;
- return 1;
-}
-
static int manager_connect_bus(Manager *m) {
DBusError error;
int r;