uevent helper

mdev使用uevent_helper机制,即调用kobject_uevent_env就会触发uevent_helper所指定的用户程序(mdev)

echo "/sbin/mdev" > /proc/sys/kernel/hotplug

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
static ssize_t (struct kobject *kobj,
struct kobj_attribute *attr, char *buf)
{
return sprintf(buf, "%sn", uevent_helper);
}

static ssize_t uevent_helper_store(struct kobject *kobj,
struct kobj_attribute *attr,
const char *buf, size_t count)
{
if (count+1 > UEVENT_HELPER_PATH_LEN)
return -ENOENT;
memcpy(uevent_helper, buf, count);
uevent_helper[count] = '