chiark / gitweb /
machined: add a full bus object for images
[elogind.git] / src / machine / image.c
index 8f577adb59c36044aedc29c945c6cf2d5b0e38b2..c81c5f628179a6e8e7e7c02c4647aa72f3b19023 100644 (file)
@@ -24,8 +24,8 @@
 #include "strv.h"
 #include "utf8.h"
 #include "btrfs-util.h"
+#include "path-util.h"
 #include "image.h"
-#include "bus-label.h"
 
 static const char image_search_path[] =
         "/var/lib/container\0"
@@ -71,9 +71,11 @@ static int image_new(
                 return -ENOMEM;
 
         if (path) {
-                i->path = strdup(path);
+                i->path = strjoin(path, "/", name, NULL);
                 if (!i->path)
                         return -ENOMEM;
+
+                path_kill_slashes(i->path);
         }
 
         *ret = i;
@@ -264,18 +266,6 @@ void image_hashmap_free(Hashmap *map) {
         hashmap_free(map);
 }
 
-char *image_bus_path(const char *name) {
-        _cleanup_free_ char *e = NULL;
-
-        assert(name);
-
-        e = bus_label_escape(name);
-        if (!e)
-                return NULL;
-
-        return strappend("/org/freedesktop/machine1/image/", e);
-}
-
 static const char* const image_type_table[_IMAGE_TYPE_MAX] = {
         [IMAGE_DIRECTORY] = "directory",
         [IMAGE_SUBVOLUME] = "subvolume",