1 /*-*- Mode: C; c-basic-offset: 8; indent-tabs-mode: nil -*-*/
7 This file is part of systemd.
9 Copyright 2010 Lennart Poettering
11 systemd is free software; you can redistribute it and/or modify it
12 under the terms of the GNU General Public License as published by
13 the Free Software Foundation; either version 2 of the License, or
14 (at your option) any later version.
16 systemd is distributed in the hope that it will be useful, but
17 WITHOUT ANY WARRANTY; without even the implied warranty of
18 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
19 General Public License for more details.
21 You should have received a copy of the GNU General Public License
22 along with systemd; If not, see <http://www.gnu.org/licenses/>.
25 typedef struct Path Path
;
30 typedef enum PathState
{
36 _PATH_STATE_INVALID
= -1
39 typedef enum PathType
{
42 PATH_DIRECTORY_NOT_EMPTY
,
46 _PATH_TYPE_INVALID
= -1
49 typedef struct PathSpec
{
54 LIST_FIELDS(struct PathSpec
, spec
);
63 int path_spec_watch(PathSpec
*s
, Unit
*u
);
64 void path_spec_unwatch(PathSpec
*s
, Unit
*u
);
65 int path_spec_fd_event(PathSpec
*s
, uint32_t events
);
66 void path_spec_done(PathSpec
*s
);
68 static inline bool path_spec_owns_inotify_fd(PathSpec
*s
, int fd
) {
69 return s
->inotify_fd
== fd
;
72 typedef enum PathResult
{
74 PATH_FAILURE_RESOURCES
,
76 _PATH_RESULT_INVALID
= -1
82 LIST_HEAD(PathSpec
, specs
);
86 PathState state
, deserialized_state
;
88 bool inotify_triggered
;
91 mode_t directory_mode
;
96 void path_unit_notify(Unit
*u
, UnitActiveState new_state
);
98 /* Called from the mount code figure out if a mount is a dependency of
99 * any of the paths of this path object */
100 int path_add_one_mount_link(Path
*p
, Mount
*m
);
102 extern const UnitVTable path_vtable
;
104 const char* path_state_to_string(PathState i
);
105 PathState
path_state_from_string(const char *s
);
107 const char* path_type_to_string(PathType i
);
108 PathType
path_type_from_string(const char *s
);
110 const char* path_result_to_string(PathResult i
);
111 PathResult
path_result_from_string(const char *s
);