Skip to contentSkip to conversation

Patch to call dev.d scripts also with $SYMLINK

PATCH Harald Hoyer 3 participants 4 messages Sep 20, 2004 – Oct 5, 2004

lore
Share & tools
lore
#0 lore raw

especially useful to set pam_console ownerships for e.g. /dev/cdrom, which is a symlink to the $DEVNAME.

dev_d.c renamed from dev_d.c.symlink +10 -1
@@ -65,22 +84,31 @@
 {
 	char dirname[256];
 	char env_devname[NAME_SIZE];
+	char env_symlink[NAME_SIZE];
 	char *devname;
 	char *temp;
 
 	if (udev_dev_d == 0)
 		return;
 
+	env_devname[0] = 0;
+	env_symlink[0] = 0;
+
 	if (dev->type == 'b' || dev->type == 'c') {
 		strfieldcpy(env_devname, udev_root);
 		strfieldcat(env_devname, dev->name);
+		if (dev->symlink[0]) {
+			strfieldcpy(env_symlink, udev_root);
+			strfieldcat(env_symlink, dev->symlink);
+		} 
 	} else if (dev->type == 'n') {
 		strfieldcpy(env_devname, dev->name);
 		setenv("DEVPATH", devpath, 1);
 	}
-	else env_devname[0] = 0;
 	setenv("DEVNAME", env_devname, 1);
 	dbg("DEVNAME='%s'", env_devname);
+	setenv("SYMLINK", env_symlink, 1);
+	dbg("SYMLINK='%s'", env_symlink);
 
 	devname = strdup(dev->name);
 	if (!devname) {
#1 lore raw
Quoted 2 lines · Harald Hoyer

especially useful to set pam_console ownerships for e.g. /dev/cdrom, which is a symlink to the $DEVNAME.

Hm, this patch doesn't apply anymore. Care to redo it?

thanks,

greg k-h

-------------------------------------------------------
This SF.net email is sponsored by: IT Product Guide on ITManagersJournal Use IT products in your business? Tell us what you think of them. Give us Your Opinions, Get Free ThinkGeek Gift Certificates! Click to find out more
http://productguide.itmanagersjournal.com/guidepromo.tmpl
_______________________________________________
Linux-hotplug-devel mailing list http://linux-hotplug.sourceforge.net
[email protected]
https://lists.sourceforge.net/lists/listinfo/linux-hotplug-devel

#2 lore raw
In reply to Harald Hoyer
Quoted 5 lines · Greg KH
Quoted 2 lines · Harald Hoyer

especially useful to set pam_console ownerships for e.g. /dev/cdrom, which is a symlink to the $DEVNAME.

Hm, this patch doesn't apply anymore. Care to redo it?

Why not just ask udevinfo for the symlinks pointing to the device node? That was the original idea, why we didn't put this in the dev.d/ environment.

[kay@pim ~]$ udevinfo -q symlink -n /dev/hdc
cdrom

Thanks,
Kay

-------------------------------------------------------
This SF.net email is sponsored by: IT Product Guide on ITManagersJournal Use IT products in your business? Tell us what you think of them. Give us Your Opinions, Get Free ThinkGeek Gift Certificates! Click to find out more
http://productguide.itmanagersjournal.com/guidepromo.tmpl
_______________________________________________
Linux-hotplug-devel mailing list http://linux-hotplug.sourceforge.net
[email protected]
https://lists.sourceforge.net/lists/listinfo/linux-hotplug-devel

#3 lore raw
In reply to Harald Hoyer
Quoted 5 lines · Kay Sievers
Quoted 4 lines · Greg KH
Quoted 2 lines · Harald Hoyer

especially useful to set pam_console ownerships for e.g. /dev/cdrom, which is a symlink to the $DEVNAME.

Quoted 8 lines
Quoted 1 line

Hm, this patch doesn't apply anymore. Care to redo it?

Why not just ask udevinfo for the symlinks pointing to the device node? That was the original idea, why we didn't put this in the dev.d/ environment.

[kay@pim ~]$ udevinfo -q symlink -n /dev/hdc
cdrom

Ah, even better. Glad I didn't apply it :)

greg k-h

-------------------------------------------------------
This SF.net email is sponsored by: IT Product Guide on ITManagersJournal Use IT products in your business? Tell us what you think of them. Give us Your Opinions, Get Free ThinkGeek Gift Certificates! Click to find out more
http://productguide.itmanagersjournal.com/guidepromo.tmpl
_______________________________________________
Linux-hotplug-devel mailing list http://linux-hotplug.sourceforge.net
[email protected]
https://lists.sourceforge.net/lists/listinfo/linux-hotplug-devel