LCOV - code coverage report
Current view: top level - core - path.h (source / functions) Hit Total Coverage
Test: systemd test coverage Lines: 2 2 100.0 %
Date: 2015-07-29 18:47:03 Functions: 1 1 100.0 %

          Line data    Source code
       1             : /*-*- Mode: C; c-basic-offset: 8; indent-tabs-mode: nil -*-*/
       2             : 
       3             : #pragma once
       4             : 
       5             : /***
       6             :   This file is part of systemd.
       7             : 
       8             :   Copyright 2010 Lennart Poettering
       9             : 
      10             :   systemd is free software; you can redistribute it and/or modify it
      11             :   under the terms of the GNU Lesser General Public License as published by
      12             :   the Free Software Foundation; either version 2.1 of the License, or
      13             :   (at your option) any later version.
      14             : 
      15             :   systemd is distributed in the hope that it will be useful, but
      16             :   WITHOUT ANY WARRANTY; without even the implied warranty of
      17             :   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
      18             :   Lesser General Public License for more details.
      19             : 
      20             :   You should have received a copy of the GNU Lesser General Public License
      21             :   along with systemd; If not, see <http://www.gnu.org/licenses/>.
      22             : ***/
      23             : 
      24             : typedef struct Path Path;
      25             : typedef struct PathSpec PathSpec;
      26             : 
      27             : #include "unit.h"
      28             : 
      29             : typedef enum PathState {
      30             :         PATH_DEAD,
      31             :         PATH_WAITING,
      32             :         PATH_RUNNING,
      33             :         PATH_FAILED,
      34             :         _PATH_STATE_MAX,
      35             :         _PATH_STATE_INVALID = -1
      36             : } PathState;
      37             : 
      38             : typedef enum PathType {
      39             :         PATH_EXISTS,
      40             :         PATH_EXISTS_GLOB,
      41             :         PATH_DIRECTORY_NOT_EMPTY,
      42             :         PATH_CHANGED,
      43             :         PATH_MODIFIED,
      44             :         _PATH_TYPE_MAX,
      45             :         _PATH_TYPE_INVALID = -1
      46             : } PathType;
      47             : 
      48             : typedef struct PathSpec {
      49             :         Unit *unit;
      50             : 
      51             :         char *path;
      52             : 
      53             :         sd_event_source *event_source;
      54             : 
      55             :         LIST_FIELDS(struct PathSpec, spec);
      56             : 
      57             :         PathType type;
      58             :         int inotify_fd;
      59             :         int primary_wd;
      60             : 
      61             :         bool previous_exists;
      62             : } PathSpec;
      63             : 
      64             : int path_spec_watch(PathSpec *s, sd_event_io_handler_t handler);
      65             : void path_spec_unwatch(PathSpec *s);
      66             : int path_spec_fd_event(PathSpec *s, uint32_t events);
      67             : void path_spec_done(PathSpec *s);
      68             : 
      69           6 : static inline bool path_spec_owns_inotify_fd(PathSpec *s, int fd) {
      70           6 :         return s->inotify_fd == fd;
      71             : }
      72             : 
      73             : typedef enum PathResult {
      74             :         PATH_SUCCESS,
      75             :         PATH_FAILURE_RESOURCES,
      76             :         _PATH_RESULT_MAX,
      77             :         _PATH_RESULT_INVALID = -1
      78             : } PathResult;
      79             : 
      80             : struct Path {
      81             :         Unit meta;
      82             : 
      83             :         LIST_HEAD(PathSpec, specs);
      84             : 
      85             :         PathState state, deserialized_state;
      86             : 
      87             :         bool inotify_triggered;
      88             : 
      89             :         bool make_directory;
      90             :         mode_t directory_mode;
      91             : 
      92             :         PathResult result;
      93             : };
      94             : 
      95             : void path_free_specs(Path *p);
      96             : 
      97             : extern const UnitVTable path_vtable;
      98             : 
      99             : const char* path_state_to_string(PathState i) _const_;
     100             : PathState path_state_from_string(const char *s) _pure_;
     101             : 
     102             : const char* path_type_to_string(PathType i) _const_;
     103             : PathType path_type_from_string(const char *s) _pure_;
     104             : 
     105             : const char* path_result_to_string(PathResult i) _const_;
     106             : PathResult path_result_from_string(const char *s) _pure_;

Generated by: LCOV version 1.11