summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--TODO2
-rw-r--r--udev/lib/exported_symbols2
-rw-r--r--udev/lib/libudev.c15
-rw-r--r--udev/lib/libudev.h13
4 files changed, 30 insertions, 2 deletions
diff --git a/TODO b/TODO
index 86f9daddf2..ef73fbd218 100644
--- a/TODO
+++ b/TODO
@@ -2,6 +2,8 @@
o enumerate() - add buses and drivers
o increase ressize buffer
+ o add DVB variables to kernel, and drop shell script rule
+ o add watershed extra
o lazy init of selinux
o replace list.h with ccan list.h which is gpl-v2-or-later version
o get all distros to agree on a default set of rules
diff --git a/udev/lib/exported_symbols b/udev/lib/exported_symbols
index 8efd2914e2..6b034d4594 100644
--- a/udev/lib/exported_symbols
+++ b/udev/lib/exported_symbols
@@ -5,6 +5,8 @@ udev_log
udev_set_log_fn
udev_get_log_priority
udev_set_log_priority
+udev_get_userdata
+udev_set_userdata
udev_get_sys_path
udev_get_dev_path
udev_device_new_from_syspath
diff --git a/udev/lib/libudev.c b/udev/lib/libudev.c
index 2d34925912..3ff6cabbb0 100644
--- a/udev/lib/libudev.c
+++ b/udev/lib/libudev.c
@@ -37,6 +37,7 @@ struct udev {
void (*log_fn)(struct udev *udev,
int priority, const char *file, int line, const char *fn,
const char *format, va_list args);
+ void *userdata;
char *sys_path;
char *dev_path;
char *rules_path;
@@ -89,6 +90,20 @@ static void selinux_init(struct udev *udev)
#endif
}
+void *udev_get_userdata(struct udev *udev)
+{
+ if (udev == NULL)
+ return NULL;
+ return udev->userdata;
+}
+
+void udev_set_userdata(struct udev *udev, void *userdata)
+{
+ if (udev == NULL)
+ return;
+ udev->userdata = userdata;
+}
+
static void selinux_exit(struct udev *udev)
{
#ifdef USE_SELINUX
diff --git a/udev/lib/libudev.h b/udev/lib/libudev.h
index 4d5fd93efc..e71f6b217a 100644
--- a/udev/lib/libudev.h
+++ b/udev/lib/libudev.h
@@ -29,6 +29,10 @@
#endif
struct udev;
+struct udev_device;
+struct udev_monitor;
+
+/* library context */
extern struct udev *udev_new(void);
extern struct udev *udev_ref(struct udev *udev);
extern void udev_unref(struct udev *udev);
@@ -40,11 +44,15 @@ extern int udev_get_log_priority(struct udev *udev);
extern void udev_set_log_priority(struct udev *udev, int priority);
extern const char *udev_get_sys_path(struct udev *udev);
extern const char *udev_get_dev_path(struct udev *udev);
+extern void *udev_get_userdata(struct udev *udev);
+extern void udev_set_userdata(struct udev *udev, void *userdata);
+
+/* selinux glue */
extern void udev_selinux_resetfscreatecon(struct udev *udev);
extern void udev_selinux_setfscreatecon(struct udev *udev, const char *file, unsigned int mode);
extern void udev_selinux_lsetfilecon(struct udev *udev, const char *file, unsigned int mode);
-struct udev_device;
+/* sys devices */
extern struct udev_device *udev_device_new_from_syspath(struct udev *udev, const char *syspath);
extern struct udev_device *udev_device_new_from_devnum(struct udev *udev, char type, dev_t devnum);
extern struct udev_device *udev_device_get_parent(struct udev_device *udev_device);
@@ -70,11 +78,12 @@ extern const char *udev_device_get_action(struct udev_device *udev_device);
extern unsigned long long int udev_device_get_seqnum(struct udev_device *udev_device);
extern const char *udev_device_get_attr_value(struct udev_device *udev_device, const char *attr);
+/* sys enumeration */
extern int udev_enumerate_devices(struct udev *udev, const char *subsystem,
int (*cb)(struct udev_device *udev_device, void *data),
void *data);
-struct udev_monitor;
+/* udev and kernel device events */
extern struct udev_monitor *udev_monitor_new_from_socket(struct udev *udev, const char *socket_path);
extern struct udev_monitor *udev_monitor_new_from_netlink(struct udev *udev);
extern int udev_monitor_enable_receiving(struct udev_monitor *udev_monitor);