#include "alloc-util.h"
#include "btrfs-util.h"
#include "bus-common-errors.h"
+#include "bus-object.h"
#include "bus-polkit.h"
#include "discover-image.h"
#include "fd-util.h"
SD_BUS_VTABLE_END
};
+const BusObjectImplementation manager_object = {
+ "/org/freedesktop/portable1",
+ "org.freedesktop.portable1.Manager",
+ .vtables = BUS_VTABLES(manager_vtable),
+ .children = BUS_IMPLEMENTATIONS(&image_object),
+};
+
static int reply_portable_compose_message(sd_bus_message *reply, const PortableChange *changes, size_t n_changes) {
size_t i;
int r;
#include "bus-common-errors.h"
#include "bus-get-properties.h"
#include "bus-label.h"
+#include "bus-object.h"
#include "bus-polkit.h"
#include "bus-util.h"
#include "discover-image.h"
return 1;
}
+
+const BusObjectImplementation image_object = {
+ "/org/freedesktop/portable1/image",
+ "org.freedesktop.portable1.Image",
+ .fallback_vtables = BUS_FALLBACK_VTABLES({image_vtable, bus_image_object_find}),
+ .node_enumerator = bus_image_node_enumerator,
+};
int bus_image_common_set_limit(Manager *m, sd_bus_message *message, const char *name_or_path, Image *image, sd_bus_error *error);
extern const sd_bus_vtable image_vtable[];
+extern const BusObjectImplementation image_object;
int bus_image_path(Image *image, char **ret);
#include "portabled-image-bus.h"
#include "portabled.h"
#include "process-util.h"
+#include "service-util.h"
#include "signal-util.h"
static Manager* manager_unref(Manager *m);
if (r < 0)
return log_error_errno(r, "Failed to connect to system bus: %m");
- r = sd_bus_add_object_vtable(m->bus, NULL, "/org/freedesktop/portable1", "org.freedesktop.portable1.Manager", manager_vtable, m);
+ r = bus_add_implementation(m->bus, &manager_object, m);
if (r < 0)
- return log_error_errno(r, "Failed to add manager object vtable: %m");
-
- r = sd_bus_add_fallback_vtable(m->bus, NULL, "/org/freedesktop/portable1/image", "org.freedesktop.portable1.Image", image_vtable, bus_image_object_find, m);
- if (r < 0)
- return log_error_errno(r, "Failed to add image object vtable: %m");
-
- r = sd_bus_add_node_enumerator(m->bus, NULL, "/org/freedesktop/portable1/image", bus_image_node_enumerator, m);
- if (r < 0)
- return log_error_errno(r, "Failed to add image enumerator: %m");
+ return r;
r = bus_log_control_api_register(m->bus);
if (r < 0)
log_setup();
+ r = service_parse_argv("systemd-portabled.service",
+ "Manage registrations of portable images.",
+ BUS_IMPLEMENTATIONS(&manager_object,
+ &log_control_object),
+ argc, argv);
+ if (r <= 0)
+ return r;
+
umask(0022);
if (argc != 1)