1 /* SPDX-License-Identifier: LGPL-2.1-or-later */
4 typedef struct Path Path
;
5 typedef struct PathSpec PathSpec
;
6 typedef struct ActivationDetailsPath ActivationDetailsPath
;
10 typedef enum PathType
{
13 PATH_DIRECTORY_NOT_EMPTY
,
17 _PATH_TYPE_INVALID
= -EINVAL
,
20 typedef struct PathSpec
{
25 sd_event_source
*event_source
;
27 LIST_FIELDS(struct PathSpec
, spec
);
36 int path_spec_watch(PathSpec
*s
, sd_event_io_handler_t handler
);
37 void path_spec_unwatch(PathSpec
*s
);
38 int path_spec_fd_event(PathSpec
*s
, uint32_t events
);
39 void path_spec_done(PathSpec
*s
);
41 static inline bool path_spec_owns_inotify_fd(PathSpec
*s
, int fd
) {
42 return s
->inotify_fd
== fd
;
45 typedef enum PathResult
{
47 PATH_FAILURE_RESOURCES
,
48 PATH_FAILURE_START_LIMIT_HIT
,
49 PATH_FAILURE_UNIT_START_LIMIT_HIT
,
50 PATH_FAILURE_TRIGGER_LIMIT_HIT
,
52 _PATH_RESULT_INVALID
= -EINVAL
,
58 LIST_HEAD(PathSpec
, specs
);
60 PathState state
, deserialized_state
;
63 mode_t directory_mode
;
67 RateLimit trigger_limit
;
69 sd_event_source
*trigger_notify_event_source
;
72 struct ActivationDetailsPath
{
73 ActivationDetails meta
;
74 char *trigger_path_filename
;
77 void path_free_specs(Path
*p
);
79 extern const UnitVTable path_vtable
;
80 extern const ActivationDetailsVTable activation_details_path_vtable
;
82 const char* path_type_to_string(PathType i
) _const_
;
83 PathType
path_type_from_string(const char *s
) _pure_
;
85 const char* path_result_to_string(PathResult i
) _const_
;
86 PathResult
path_result_from_string(const char *s
) _pure_
;
88 DEFINE_CAST(PATH
, Path
);
89 DEFINE_ACTIVATION_DETAILS_CAST(ACTIVATION_DETAILS_PATH
, ActivationDetailsPath
, PATH
);