diff options
author | Lennart Poettering <lennart@poettering.net> | 2018-10-18 18:30:38 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2018-10-18 18:30:38 +0200 |
commit | 849d653a4e4f7d257507dad9fb82cda88a732b78 (patch) | |
tree | def89314176b827b7d6e6c15537cc3ca405cf291 /src/systemd | |
parent | c0815ca93d019fb63ef35e44859a0fb83a5ade34 (diff) | |
parent | 66a948605b54dace6512d56113e75b5107286586 (diff) | |
download | systemd-849d653a4e4f7d257507dad9fb82cda88a732b78.tar.gz |
Merge pull request #10239 from yuwata/sd-device-monitor
sd-device: introduce sd_device_monitor
Diffstat (limited to 'src/systemd')
-rw-r--r-- | src/systemd/sd-device.h | 26 |
1 files changed, 26 insertions, 0 deletions
diff --git a/src/systemd/sd-device.h b/src/systemd/sd-device.h index 406db8866d..43fb4a0c2a 100644 --- a/src/systemd/sd-device.h +++ b/src/systemd/sd-device.h @@ -21,12 +21,19 @@ #include <sys/sysmacros.h> #include <sys/types.h> +#include "sd-event.h" + #include "_sd-common.h" _SD_BEGIN_DECLARATIONS; typedef struct sd_device sd_device; typedef struct sd_device_enumerator sd_device_enumerator; +typedef struct sd_device_monitor sd_device_monitor; + +/* callback */ + +typedef int (*sd_device_monitor_handler_t)(sd_device_monitor *m, sd_device *device, void *userdata); /* device */ @@ -89,8 +96,27 @@ int sd_device_enumerator_add_match_tag(sd_device_enumerator *enumerator, const c int sd_device_enumerator_add_match_parent(sd_device_enumerator *enumerator, sd_device *parent); int sd_device_enumerator_allow_uninitialized(sd_device_enumerator *enumerator); +/* device monitor */ + +int sd_device_monitor_new(sd_device_monitor **ret); +sd_device_monitor *sd_device_monitor_ref(sd_device_monitor *m); +sd_device_monitor *sd_device_monitor_unref(sd_device_monitor *m); + +int sd_device_monitor_set_receive_buffer_size(sd_device_monitor *m, size_t size); +int sd_device_monitor_attach_event(sd_device_monitor *m, sd_event *event, int64_t priority); +int sd_device_monitor_detach_event(sd_device_monitor *m); +sd_event *sd_device_monitor_get_event(sd_device_monitor *m); +int sd_device_monitor_start(sd_device_monitor *m, sd_device_monitor_handler_t callback, void *userdata, const char *description); +int sd_device_monitor_stop(sd_device_monitor *m); + +int sd_device_monitor_filter_add_match_subsystem_devtype(sd_device_monitor *m, const char *subsystem, const char *devtype); +int sd_device_monitor_filter_add_match_tag(sd_device_monitor *m, const char *tag); +int sd_device_monitor_filter_update(sd_device_monitor *m); +int sd_device_monitor_filter_remove(sd_device_monitor *m); + _SD_DEFINE_POINTER_CLEANUP_FUNC(sd_device, sd_device_unref); _SD_DEFINE_POINTER_CLEANUP_FUNC(sd_device_enumerator, sd_device_enumerator_unref); +_SD_DEFINE_POINTER_CLEANUP_FUNC(sd_device_monitor, sd_device_monitor_unref); _SD_END_DECLARATIONS; |