1 /* SPDX-License-Identifier: LGPL-2.1-or-later */
4 typedef struct Path Path
;
5 typedef struct PathSpec PathSpec
;
9 typedef enum PathType
{
12 PATH_DIRECTORY_NOT_EMPTY
,
16 _PATH_TYPE_INVALID
= -EINVAL
,
19 typedef struct PathSpec
{
24 sd_event_source
*event_source
;
26 LIST_FIELDS(struct PathSpec
, spec
);
35 int path_spec_watch(PathSpec
*s
, sd_event_io_handler_t handler
);
36 void path_spec_unwatch(PathSpec
*s
);
37 int path_spec_fd_event(PathSpec
*s
, uint32_t events
);
38 void path_spec_done(PathSpec
*s
);
40 static inline bool path_spec_owns_inotify_fd(PathSpec
*s
, int fd
) {
41 return s
->inotify_fd
== fd
;
44 typedef enum PathResult
{
46 PATH_FAILURE_RESOURCES
,
47 PATH_FAILURE_START_LIMIT_HIT
,
48 PATH_FAILURE_UNIT_START_LIMIT_HIT
,
50 _PATH_RESULT_INVALID
= -EINVAL
,
56 LIST_HEAD(PathSpec
, specs
);
58 PathState state
, deserialized_state
;
61 mode_t directory_mode
;
66 void path_free_specs(Path
*p
);
68 extern const UnitVTable path_vtable
;
70 const char* path_type_to_string(PathType i
) _const_
;
71 PathType
path_type_from_string(const char *s
) _pure_
;
73 const char* path_result_to_string(PathResult i
) _const_
;
74 PathResult
path_result_from_string(const char *s
) _pure_
;
76 DEFINE_CAST(PATH
, Path
);