mirror of
https://github.com/systemd/systemd-stable.git
synced 2024-12-25 23:21:33 +03:00
export DRIVER for older kernels as a replacement for PHYSDEVDRIVER
This commit is contained in:
parent
775f5e3587
commit
220dac4c5e
10
udevd.c
10
udevd.c
@ -566,6 +566,7 @@ static struct udevd_uevent_msg *get_msg_from_envbuf(const char *buf, int buf_siz
|
|||||||
int bufpos;
|
int bufpos;
|
||||||
int i;
|
int i;
|
||||||
struct udevd_uevent_msg *msg;
|
struct udevd_uevent_msg *msg;
|
||||||
|
char *physdevdriver_key = NULL;
|
||||||
int major = 0;
|
int major = 0;
|
||||||
int minor = 0;
|
int minor = 0;
|
||||||
|
|
||||||
@ -600,6 +601,8 @@ static struct udevd_uevent_msg *get_msg_from_envbuf(const char *buf, int buf_siz
|
|||||||
msg->seqnum = strtoull(&key[7], NULL, 10);
|
msg->seqnum = strtoull(&key[7], NULL, 10);
|
||||||
else if (strncmp(key, "PHYSDEVPATH=", 12) == 0)
|
else if (strncmp(key, "PHYSDEVPATH=", 12) == 0)
|
||||||
msg->physdevpath = &key[12];
|
msg->physdevpath = &key[12];
|
||||||
|
else if (strncmp(key, "PHYSDEVDRIVER=", 14) == 0)
|
||||||
|
physdevdriver_key = key;
|
||||||
else if (strncmp(key, "MAJOR=", 6) == 0)
|
else if (strncmp(key, "MAJOR=", 6) == 0)
|
||||||
major = strtoull(&key[6], NULL, 10);
|
major = strtoull(&key[6], NULL, 10);
|
||||||
else if (strncmp(key, "MINOR=", 6) == 0)
|
else if (strncmp(key, "MINOR=", 6) == 0)
|
||||||
@ -609,6 +612,13 @@ static struct udevd_uevent_msg *get_msg_from_envbuf(const char *buf, int buf_siz
|
|||||||
}
|
}
|
||||||
msg->devt = makedev(major, minor);
|
msg->devt = makedev(major, minor);
|
||||||
msg->envp[i++] = "UDEVD_EVENT=1";
|
msg->envp[i++] = "UDEVD_EVENT=1";
|
||||||
|
|
||||||
|
if (msg->driver == NULL && msg->physdevpath == NULL && physdevdriver_key != NULL) {
|
||||||
|
/* for older kernels DRIVER is empty for a bus device, export PHYSDEVDRIVER as DRIVER */
|
||||||
|
msg->envp[i++] = &physdevdriver_key[7];
|
||||||
|
msg->driver = &physdevdriver_key[14];
|
||||||
|
}
|
||||||
|
|
||||||
msg->envp[i] = NULL;
|
msg->envp[i] = NULL;
|
||||||
|
|
||||||
if (msg->devpath == NULL || msg->action == NULL) {
|
if (msg->devpath == NULL || msg->action == NULL) {
|
||||||
|
Loading…
Reference in New Issue
Block a user