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
;
25 typedef struct PathSpec PathSpec
;
29 typedef enum PathType
{
32 PATH_DIRECTORY_NOT_EMPTY
,
36 _PATH_TYPE_INVALID
= -1
39 typedef struct PathSpec
{
44 sd_event_source
*event_source
;
46 LIST_FIELDS(struct PathSpec
, spec
);
55 int path_spec_watch(PathSpec
*s
, sd_event_io_handler_t handler
);
56 void path_spec_unwatch(PathSpec
*s
);
57 int path_spec_fd_event(PathSpec
*s
, uint32_t events
);
58 void path_spec_done(PathSpec
*s
);
60 static inline bool path_spec_owns_inotify_fd(PathSpec
*s
, int fd
) {
61 return s
->inotify_fd
== fd
;
64 typedef enum PathResult
{
66 PATH_FAILURE_RESOURCES
,
68 _PATH_RESULT_INVALID
= -1
74 LIST_HEAD(PathSpec
, specs
);
76 PathState state
, deserialized_state
;
78 bool inotify_triggered
;
81 mode_t directory_mode
;
86 void path_free_specs(Path
*p
);
88 extern const UnitVTable path_vtable
;
90 const char* path_type_to_string(PathType i
) _const_
;
91 PathType
path_type_from_string(const char *s
) _pure_
;
93 const char* path_result_to_string(PathResult i
) _const_
;
94 PathResult
path_result_from_string(const char *s
) _pure_
;