LCOV - code coverage report
Current view: top level - core - dbus-path.c (source / functions) Hit Total Coverage
Test: systemd test coverage Lines: 0 21 0.0 %
Date: 2015-07-29 18:47:03 Functions: 0 3 0.0 %

          Line data    Source code
       1             : /*-*- Mode: C; c-basic-offset: 8; indent-tabs-mode: nil -*-*/
       2             : 
       3             : /***
       4             :   This file is part of systemd.
       5             : 
       6             :   Copyright 2010 Lennart Poettering
       7             : 
       8             :   systemd is free software; you can redistribute it and/or modify it
       9             :   under the terms of the GNU Lesser General Public License as published by
      10             :   the Free Software Foundation; either version 2.1 of the License, or
      11             :   (at your option) any later version.
      12             : 
      13             :   systemd is distributed in the hope that it will be useful, but
      14             :   WITHOUT ANY WARRANTY; without even the implied warranty of
      15             :   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
      16             :   Lesser General Public License for more details.
      17             : 
      18             :   You should have received a copy of the GNU Lesser General Public License
      19             :   along with systemd; If not, see <http://www.gnu.org/licenses/>.
      20             : ***/
      21             : 
      22             : #include "unit.h"
      23             : #include "path.h"
      24             : #include "dbus-path.h"
      25             : #include "bus-util.h"
      26             : 
      27           0 : static BUS_DEFINE_PROPERTY_GET_ENUM(property_get_result, path_result, PathResult);
      28             : 
      29           0 : static int property_get_paths(
      30             :                 sd_bus *bus,
      31             :                 const char *path,
      32             :                 const char *interface,
      33             :                 const char *property,
      34             :                 sd_bus_message *reply,
      35             :                 void *userdata,
      36             :                 sd_bus_error *error) {
      37             : 
      38           0 :         Path *p = userdata;
      39             :         PathSpec *k;
      40             :         int r;
      41             : 
      42           0 :         assert(bus);
      43           0 :         assert(reply);
      44           0 :         assert(p);
      45             : 
      46           0 :         r = sd_bus_message_open_container(reply, 'a', "(ss)");
      47           0 :         if (r < 0)
      48           0 :                 return r;
      49             : 
      50           0 :         LIST_FOREACH(spec, k, p->specs) {
      51           0 :                 r = sd_bus_message_append(reply, "(ss)", path_type_to_string(k->type), k->path);
      52           0 :                 if (r < 0)
      53           0 :                         return r;
      54             :         }
      55             : 
      56           0 :         return sd_bus_message_close_container(reply);
      57             : }
      58             : 
      59           0 : static int property_get_unit(
      60             :                 sd_bus *bus,
      61             :                 const char *path,
      62             :                 const char *interface,
      63             :                 const char *property,
      64             :                 sd_bus_message *reply,
      65             :                 void *userdata,
      66             :                 sd_bus_error *error) {
      67             : 
      68           0 :         Unit *p = userdata, *trigger;
      69             : 
      70           0 :         assert(bus);
      71           0 :         assert(reply);
      72           0 :         assert(p);
      73             : 
      74           0 :         trigger = UNIT_TRIGGER(p);
      75             : 
      76           0 :         return sd_bus_message_append(reply, "s", trigger ? trigger->id : "");
      77             : }
      78             : 
      79             : const sd_bus_vtable bus_path_vtable[] = {
      80             :         SD_BUS_VTABLE_START(0),
      81             :         SD_BUS_PROPERTY("Unit", "s", property_get_unit, 0, SD_BUS_VTABLE_PROPERTY_CONST),
      82             :         SD_BUS_PROPERTY("Paths", "a(ss)", property_get_paths, 0, SD_BUS_VTABLE_PROPERTY_CONST),
      83             :         SD_BUS_PROPERTY("MakeDirectory", "b", bus_property_get_bool, offsetof(Path, make_directory), SD_BUS_VTABLE_PROPERTY_CONST),
      84             :         SD_BUS_PROPERTY("DirectoryMode", "u", bus_property_get_mode, offsetof(Path, directory_mode), SD_BUS_VTABLE_PROPERTY_CONST),
      85             :         SD_BUS_PROPERTY("Result", "s", property_get_result, offsetof(Path, result), SD_BUS_VTABLE_PROPERTY_EMITS_CHANGE),
      86             :         SD_BUS_VTABLE_END
      87             : };

Generated by: LCOV version 1.11