image-dbus.c revision 10f9c75519671e7c7ab8993b54fe22da7c2d0c38
/*-*- Mode: C; c-basic-offset: 8; indent-tabs-mode: nil -*-*/
/***
This file is part of systemd.
Copyright 2014 Lennart Poettering
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.
systemd 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 systemd; If not, see <http://www.gnu.org/licenses/>.
***/
#include "bus-label.h"
#include "bus-common-errors.h"
#include "strv.h"
#include "image.h"
_cleanup_free_ char *e = NULL;
const char *p;
if (!p)
return 0;
e = bus_label_unescape(p);
if (!e)
return -ENOMEM;
return image_find(e, ret);
}
int r;
if (r == 0)
return r;
}
static int property_get_name(
const char *path,
const char *interface,
const char *property,
void *userdata,
sd_bus_error *error) {
int r;
if (r < 0)
return r;
if (r < 0)
return r;
return 1;
}
static int property_get_path(
const char *path,
const char *interface,
const char *property,
void *userdata,
sd_bus_error *error) {
int r;
if (r < 0)
return r;
if (r < 0)
return r;
return 1;
}
static int property_get_type(
const char *path,
const char *interface,
const char *property,
void *userdata,
sd_bus_error *error) {
int r;
if (r < 0)
return r;
if (r < 0)
return r;
return 1;
}
static int property_get_read_only(
const char *path,
const char *interface,
const char *property,
void *userdata,
sd_bus_error *error) {
int r;
if (r < 0)
return r;
if (r < 0)
return r;
return 1;
}
static int property_get_crtime(
const char *path,
const char *interface,
const char *property,
void *userdata,
sd_bus_error *error) {
int r;
if (r < 0)
return r;
if (r < 0)
return r;
return 1;
}
static int property_get_mtime(
const char *path,
const char *interface,
const char *property,
void *userdata,
sd_bus_error *error) {
int r;
if (r < 0)
return r;
if (r < 0)
return r;
return 1;
}
const sd_bus_vtable image_vtable[] = {
};
int image_object_find(sd_bus *bus, const char *path, const char *interface, void *userdata, void **found, sd_bus_error *error) {
int r;
if (r <= 0)
return r;
return 1;
}
char *image_bus_path(const char *name) {
_cleanup_free_ char *e = NULL;
e = bus_label_escape(name);
if (!e)
return NULL;
return strappend("/org/freedesktop/machine1/image/", e);
}
int image_node_enumerator(sd_bus *bus, const char *path, void *userdata, char ***nodes, sd_bus_error *error) {
_cleanup_strv_free_ char **l = NULL;
Iterator i;
int r;
if (!images)
return -ENOMEM;
r = image_discover(images);
if (r < 0)
return r;
char *p;
if (!p)
return -ENOMEM;
r = strv_consume(&l, p);
if (r < 0)
return r;
}
*nodes = l;
l = NULL;
return 1;
}