1 /*-*- Mode: C; c-basic-offset: 8; indent-tabs-mode: nil -*-*/
6 This file is part of systemd.
8 Copyright 2010 Lennart Poettering
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.
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.
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/>.
24 typedef struct Path Path;
29 typedef enum PathState {
35 _PATH_STATE_INVALID = -1
38 typedef enum PathType {
41 PATH_DIRECTORY_NOT_EMPTY,
45 _PATH_TYPE_INVALID = -1
48 typedef struct PathSpec {
53 LIST_FIELDS(struct PathSpec, spec);
62 int path_spec_watch(PathSpec *s, Unit *u);
63 void path_spec_unwatch(PathSpec *s, Unit *u);
64 int path_spec_fd_event(PathSpec *s, uint32_t events);
65 void path_spec_done(PathSpec *s);
67 static inline bool path_spec_owns_inotify_fd(PathSpec *s, int fd) {
68 return s->inotify_fd == fd;
71 typedef enum PathResult {
73 PATH_FAILURE_RESOURCES,
75 _PATH_RESULT_INVALID = -1
81 LIST_HEAD(PathSpec, specs);
85 PathState state, deserialized_state;
87 bool inotify_triggered;
90 mode_t directory_mode;
95 void path_unit_notify(Unit *u, UnitActiveState new_state);
97 /* Called from the mount code figure out if a mount is a dependency of
98 * any of the paths of this path object */
99 int path_add_one_mount_link(Path *p, Mount *m);
101 void path_free_specs(Path *p);
103 extern const UnitVTable path_vtable;
105 const char* path_state_to_string(PathState i);
106 PathState path_state_from_string(const char *s);
108 const char* path_type_to_string(PathType i);
109 PathType path_type_from_string(const char *s);
111 const char* path_result_to_string(PathResult i);
112 PathResult path_result_from_string(const char *s);