1 /* SPDX-License-Identifier: LGPL-2.1+ */
5 This file is part of systemd.
7 Copyright 2010 Lennart Poettering
10 typedef struct Path Path
;
11 typedef struct PathSpec PathSpec
;
15 typedef enum PathType
{
18 PATH_DIRECTORY_NOT_EMPTY
,
22 _PATH_TYPE_INVALID
= -1
25 typedef struct PathSpec
{
30 sd_event_source
*event_source
;
32 LIST_FIELDS(struct PathSpec
, spec
);
41 int path_spec_watch(PathSpec
*s
, sd_event_io_handler_t handler
);
42 void path_spec_unwatch(PathSpec
*s
);
43 int path_spec_fd_event(PathSpec
*s
, uint32_t events
);
44 void path_spec_done(PathSpec
*s
);
46 static inline bool path_spec_owns_inotify_fd(PathSpec
*s
, int fd
) {
47 return s
->inotify_fd
== fd
;
50 typedef enum PathResult
{
52 PATH_FAILURE_RESOURCES
,
53 PATH_FAILURE_START_LIMIT_HIT
,
55 _PATH_RESULT_INVALID
= -1
61 LIST_HEAD(PathSpec
, specs
);
63 PathState state
, deserialized_state
;
65 bool inotify_triggered
;
68 mode_t directory_mode
;
73 void path_free_specs(Path
*p
);
75 extern const UnitVTable path_vtable
;
77 const char* path_type_to_string(PathType i
) _const_
;
78 PathType
path_type_from_string(const char *s
) _pure_
;
80 const char* path_result_to_string(PathResult i
) _const_
;
81 PathResult
path_result_from_string(const char *s
) _pure_
;