diff options
author | Yu Watanabe <watanabe.yu+github@gmail.com> | 2018-10-08 22:45:52 +0900 |
---|---|---|
committer | Yu Watanabe <watanabe.yu+github@gmail.com> | 2018-10-17 03:30:54 +0900 |
commit | b1c097af8df58a94cba031a347061b7cb9b62d9b (patch) | |
tree | b78cf5d7de00122c68c21dcb7ca0a56b78773614 /src/systemd/sd-device.h | |
parent | 8da2f9e80741ea3dd5058dc3440c0ca80c6436e0 (diff) | |
download | systemd-b1c097af8df58a94cba031a347061b7cb9b62d9b.tar.gz |
sd-device: introduce sd_device_monitor
Diffstat (limited to 'src/systemd/sd-device.h')
-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; |