Page MenuHomeFreeBSD

D37573.id113738.diff
No OneTemporary

D37573.id113738.diff

diff --git a/sys/kern/kern_devctl.c b/sys/kern/kern_devctl.c
--- a/sys/kern/kern_devctl.c
+++ b/sys/kern/kern_devctl.c
@@ -134,6 +134,10 @@
static struct cdev *devctl_dev;
static void devaddq(const char *type, const char *what, device_t dev);
+static struct devctlbridge {
+ send_event_f *send_f;
+} devctl_notify_hook = { .send_f = NULL };
+
static void
devctl_init(void)
{
@@ -435,6 +439,8 @@
if (system == NULL || subsystem == NULL || type == NULL)
return;
+ if (devctl_notify_hook.send_f != NULL)
+ devctl_notify_hook.send_f(system, subsystem, type, data);
dei = devctl_alloc_dei_sb(&sb);
if (dei == NULL)
return;
@@ -569,4 +575,14 @@
}
}
+void
+devctl_set_notify_hook(send_event_f *hook)
+{
+ devctl_notify_hook.send_f = hook;
+}
+void
+devctl_unset_notify_hook(void)
+{
+ devctl_notify_hook.send_f = NULL;
+}
diff --git a/sys/sys/devctl.h b/sys/sys/devctl.h
--- a/sys/sys/devctl.h
+++ b/sys/sys/devctl.h
@@ -17,6 +17,10 @@
const char *__type, const char *__data);
struct sbuf;
void devctl_safe_quote_sb(struct sbuf *__sb, const char *__src);
+typedef void send_event_f(const char *system, const char *subsystem,
+ const char *type, const char *data);
+void devctl_set_notify_hook(send_event_f *hook);
+void devctl_unset_notify_hook(void);
#endif
#endif /* _SYS_DEVCTL_H_ */

File Metadata

Mime Type
text/plain
Expires
Wed, Apr 8, 8:21 AM (20 h, 7 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
31088354
Default Alt Text
D37573.id113738.diff (1 KB)

Event Timeline