Skip to contentSkip to conversation

additional symlinks

DISCUSSION John L. Fjellstad 2 participants 3 messages Feb 17, 2004

lore
Share & tools
lore
#0 lore raw

Correct me if I'm wrong, but udev currently doesn't let you specifiy additional symlinks, correct?

That is, if you have this in the udev.rules file:
BUS="ide", PROGRAM="/bin/cat /proc/ide/%k/media", RESULT="cdrom", NAME="cdroms/cdrom%m", SYMLINK="cdrom%n"

I can't do something like this later on in the rules file:
UPDATE="cdroms/cdrom%m", SYMLINK="dvd%n"

I have a patch ready to do this, but didn't want to submit until I was clear on this issue (no point in submitting something that already been done)

Signature · 2 lines
John L. Fjellstad
web: http://www.fjellstad.org/          Quis custodiet ipsos custodes
#1 lore raw
Quoted 9 lines

Correct me if I'm wrong, but udev currently doesn't let you specifiy additional symlinks, correct?

That is, if you have this in the udev.rules file:
BUS="ide", PROGRAM="/bin/cat /proc/ide/%k/media", RESULT="cdrom", NAME="cdroms/cdrom%m", SYMLINK="cdrom%n"

Quoted 6 lines

I can't do something like this later on in the rules file:
UPDATE="cdroms/cdrom%m", SYMLINK="dvd%n"

I have a patch ready to do this, but didn't want to submit until I was clear on this issue (no point in submitting something that already been done)

that is what my patch (part of) did and so far it was declared useless.

I would be interested to compare your implementation. You could find mine in this list archives (it is for older version of udev, I still did not have time to catch up).

glad to see I am not alone :) if you could add arguments to convince others it would be just fine.

-------------------------------------------------------
SF.Net is sponsored by: Speed Start Your Linux Apps Now. Build and deploy apps & Web services for Linux with
a free DVD software kit from IBM. Click Now!
http://ads.osdn.com/?ad_id56&alloc_id438&op=click
_______________________________________________
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 John L. Fjellstad
Quoted 1 line · Andrey Borzenkov

that is what my patch (part of) did and so far it was declared useless.

Yup, I saw it on the list. I actually read it, but then forgot about it, and just noticed your email about additional symlinks yesterday (or so). And I been spending the last couple of days playing around with udev and the code, and I just thought about last night (couldn't sleep).

Your solution is probably the more elegant one.

Quoted 2 lines

in this list archives (it is for older version of udev, I still did not have time to catch up).

If you want to, I can do it...

Quoted 2 lines

glad to see I am not alone :) if you could add arguments to convince others it would be just fine.

Well, I thought you made some convincing arguments, but...

What got me thinking about it was trying to get ide-devfs.sh to work as I wanted. Since my cdrom is a combined cdrom/dvd, I wanted an extra symlink from dvd, but right now it's impossible without editing the ide-devfs.sh script.

For instance:
BUS="ide", KERNEL="hd*", PROGRAM="/etc/udev/scripts/ide-devfs.sh %k %b %n", NAME="%1c", SYMLINK="%2c %3c"

This rule will create ide/.../cd, with symlinks to cdroms/cdrom0 and cdrom.

With my patch, I can write an additional rule like this:
UPDATE="ide/host0/bus0/target0/lun0/", SYMLINK="dvd"

which will add the dvd symlink to the name specified in UPDATE.

It's not as elegant as your solution, since the value in UPDATE has to be the same as the value in NAME given in the first rule.

Signature · 5 lines
John
email: [email protected]               Quis custodiet ipsos custodes
Yahoo Messenger: jfjellstad
MSN Messenger: [email protected]
web: http://www.fjellstad.org/
namedev.h renamed from namedev.h.orig +1 -0
@@ -43,6 +43,7 @@ struct sysfs_class_device;
 #define FIELD_RESULT	"RESULT"
 #define FIELD_KERNEL	"KERNEL"
 #define FIELD_NAME	"NAME"
+#define FIELD_UPDATE	"UPDATE"
 #define FIELD_SYMLINK	"SYMLINK"
 
 #define PROGRAM_MAXARG	10
namedev_parse.c renamed from namedev_parse.c.orig +59 -5

104 lines not on this page · raw message