mirror of
https://github.com/systemd/systemd-stable.git
synced 2024-11-01 00:51:08 +03:00
libudev: add userdata pointer
This commit is contained in:
parent
03198b9303
commit
c8e32461cc
2
TODO
2
TODO
@ -2,6 +2,8 @@
|
|||||||
o enumerate() - add buses and drivers
|
o enumerate() - add buses and drivers
|
||||||
o increase ressize buffer
|
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 lazy init of selinux
|
||||||
o replace list.h with ccan list.h which is gpl-v2-or-later version
|
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
|
o get all distros to agree on a default set of rules
|
||||||
|
@ -5,6 +5,8 @@ udev_log
|
|||||||
udev_set_log_fn
|
udev_set_log_fn
|
||||||
udev_get_log_priority
|
udev_get_log_priority
|
||||||
udev_set_log_priority
|
udev_set_log_priority
|
||||||
|
udev_get_userdata
|
||||||
|
udev_set_userdata
|
||||||
udev_get_sys_path
|
udev_get_sys_path
|
||||||
udev_get_dev_path
|
udev_get_dev_path
|
||||||
udev_device_new_from_syspath
|
udev_device_new_from_syspath
|
||||||
|
@ -37,6 +37,7 @@ struct udev {
|
|||||||
void (*log_fn)(struct udev *udev,
|
void (*log_fn)(struct udev *udev,
|
||||||
int priority, const char *file, int line, const char *fn,
|
int priority, const char *file, int line, const char *fn,
|
||||||
const char *format, va_list args);
|
const char *format, va_list args);
|
||||||
|
void *userdata;
|
||||||
char *sys_path;
|
char *sys_path;
|
||||||
char *dev_path;
|
char *dev_path;
|
||||||
char *rules_path;
|
char *rules_path;
|
||||||
@ -89,6 +90,20 @@ static void selinux_init(struct udev *udev)
|
|||||||
#endif
|
#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)
|
static void selinux_exit(struct udev *udev)
|
||||||
{
|
{
|
||||||
#ifdef USE_SELINUX
|
#ifdef USE_SELINUX
|
||||||
|
@ -29,6 +29,10 @@
|
|||||||
#endif
|
#endif
|
||||||
|
|
||||||
struct udev;
|
struct udev;
|
||||||
|
struct udev_device;
|
||||||
|
struct udev_monitor;
|
||||||
|
|
||||||
|
/* library context */
|
||||||
extern struct udev *udev_new(void);
|
extern struct udev *udev_new(void);
|
||||||
extern struct udev *udev_ref(struct udev *udev);
|
extern struct udev *udev_ref(struct udev *udev);
|
||||||
extern void udev_unref(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 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_sys_path(struct udev *udev);
|
||||||
extern const char *udev_get_dev_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_resetfscreatecon(struct udev *udev);
|
||||||
extern void udev_selinux_setfscreatecon(struct udev *udev, const char *file, unsigned int mode);
|
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);
|
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_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_new_from_devnum(struct udev *udev, char type, dev_t devnum);
|
||||||
extern struct udev_device *udev_device_get_parent(struct udev_device *udev_device);
|
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 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);
|
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,
|
extern int udev_enumerate_devices(struct udev *udev, const char *subsystem,
|
||||||
int (*cb)(struct udev_device *udev_device, void *data),
|
int (*cb)(struct udev_device *udev_device, void *data),
|
||||||
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_socket(struct udev *udev, const char *socket_path);
|
||||||
extern struct udev_monitor *udev_monitor_new_from_netlink(struct udev *udev);
|
extern struct udev_monitor *udev_monitor_new_from_netlink(struct udev *udev);
|
||||||
extern int udev_monitor_enable_receiving(struct udev_monitor *udev_monitor);
|
extern int udev_monitor_enable_receiving(struct udev_monitor *udev_monitor);
|
||||||
|
Loading…
Reference in New Issue
Block a user