Skip to contentSkip to conversation

udev.rules.devfs patch

PATCH John L. Fjellstad 4 participants 5 messages Jan 15, 2004

lore
Share & tools
lore
#0 lore raw

-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Here is a patch for udev.rules.devfs to make it closer to devfs layout. Basically, added discs/disc? directories, and the cdrom directory

- --
John L. Fjellstad
web: http://www.fjellstad.org/ Quis custodiet ipsos custodes
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.2.3 (GNU/Linux)

iEYEARECAAYFAkAGon4ACgkQkz0vhQtHHRhGlACgyGxHvvwnhlHsmTl11C32NHkB 1WwAoMBdiMwkWmtg7FKkDTOc+QYRGltt
=mOcE
-----END PGP SIGNATURE-----

udev.rules.devfs renamed from udev.rules.devfs.orig +15 -7
@@ -16,11 +16,19 @@
 #      If this is not a partition, it will result in 'disc'
 #
 
+# if this is an ide cdrom, put it in the cdroms directory and create symlinks
+# first matching rule decides the name
+BUS="ide", PROGRAM="/bin/cat /proc/ide/%k/media", RESULT="cdrom", NAME="cdroms/cdrom%m", SYMLINK="cdrom dvd"
+
 # ide block devices
-BUS="ide", id="0.0", NAME="ide/host0/bus0/target0/lun0/%D"
-BUS="ide", id="0.1", NAME="ide/host0/bus0/target1/lun0/%D"
-BUS="ide", id="1.0", NAME="ide/host0/bus1/target0/lun0/%D"
-BUS="ide", id="1.1", NAME="ide/host0/bus1/target1/lun0/%D"
+BUS="ide", id="0.0", NAME="ide/host0/bus0/target0/lun0/%D", SYMLINK="discs/disc0/%D"
+BUS="ide", id="0.1", NAME="ide/host0/bus0/target1/lun0/%D", SYMLINK="discs/disc1/%D"
+BUS="ide", id="1.0", NAME="ide/host0/bus1/target0/lun0/%D", SYMLINK="discs/disc2/%D"
+BUS="ide", id="1.1", NAME="ide/host0/bus1/target1/lun0/%D", SYMLINK="discs/disc3/%D"
+
+# scsi block devices
+BUS="scsi", id="0:0:0:0", NAME="scsi/host0/bus0/target0/lun0/%D", SYMLINK="discs/disc4/%D"
+BUS="scsi", id="0:0:0:1", NAME="scsi/host0/bus0/target0/lun0/%D", SYMLINK="discs/disc5/%D"
 
 # md block devices
 KERNEL="md[0-9]*", NAME="md/%n"
@@ -49,13 +57,13 @@
 KERNEL="i2c-[0-9]*", NAME="i2c/%n", SYMLINK="%k"
 
 # loop devices
-KERNEL="loop[0-9]*", NAME="loop/%n", SYMLINK="%k"
+KERNEL="loop[0-9]*", NAME="loop/%n"
 
 # ramdisks
-KERNEL="ram[0-9]*", NAME="rd/%n", SYMLINK="%k"
+KERNEL="ram[0-9]*", NAME="rd/%n"
 
 # framebuffer devices
-KERNEL="fb[0-9]*", NAME="fb/%n", SYMLINK="%k"
+KERNEL="fb[0-9]*", NAME="fb/%n"
 
 # misc
 KERNEL="rtc",   NAME="misc/%k", SYMLINK="%k"
#1 lore raw

On Thu, Jan 15, 2004 at 03:23:55PM +0100, John L. Fjellstad wrote:
Content-Description: clearsigned data

udev.rules.devfs line 24

Quoted 5 lines

Here is a patch for udev.rules.devfs to make it closer to devfs layout. Basically, added discs/disc? directories, and the cdrom directory

udev.rules.devfs renamed from udev.rules.devfs.orig +1 -1
-BUS="ide", id="1.1", NAME="ide/host0/bus1/target1/lun0/%D"
+BUS="ide", id="0.0", NAME="ide/host0/bus0/target0/lun0/%D", SYMLINK="discs/disc0/%D"

How do you know, that the disc number you use is free? Did you try the ide-devfs.sh? We take care of it with the script.

Greg, I would be happy to remove the ugly %D at all.
It's unable to handle cdroms, an the 'dis[ck]'/'partition' thing is easy done by two rules. Then the dis[ck] decision is also up to the user :)

Kay

-------------------------------------------------------
This SF.net email is sponsored by: Perforce Software. Perforce is the Fast Software Configuration Management System offering advanced branching capabilities and atomic changes on 50+ platforms. Free Eval! http://www.perforce.com/perforce/loadprog.html
_______________________________________________
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 11 lines · Kay Sievers

On Thu, Jan 15, 2004 at 03:23:55PM +0100, John L. Fjellstad wrote:
Content-Description: clearsigned data

udev.rules.devfs line 24

Quoted 5 lines

Here is a patch for udev.rules.devfs to make it closer to devfs layout. Basically, added discs/disc? directories, and the cdrom directory

udev.rules.devfs renamed from udev.rules.devfs.orig +1 -1
-BUS="ide", id="1.1", NAME="ide/host0/bus1/target1/lun0/%D"
+BUS="ide", id="0.0", NAME="ide/host0/bus0/target0/lun0/%D", SYMLINK="discs/disc0/%D"

How do you know, that the disc number you use is free? Did you try the ide-devfs.sh? We take care of it with the script.

Quoted 3 lines

Greg, I would be happy to remove the ugly %D at all.
It's unable to handle cdroms, an the 'dis[ck]'/'partition' thing is easy done by two rules. Then the dis[ck] decision is also up to the user :)

Please don't get rid of %D. I just started using it. The problem that I'm dealing with is that the directory where the devfs names are created are unpredictable so my callout returns the directory that I'm to create the devfs names in and I do something like:

BUS="scsi", CALLOUT="blah", ID="*", NAME="%c/%D", SYMLINK="%c/theAlias"

thanks
mh

Signature · 13 lines
Martin Hicks                Wild Open Source Inc.
[email protected]     613-266-2296


-------------------------------------------------------
This SF.net email is sponsored by: Perforce Software.
Perforce is the Fast Software Configuration Management System offering
advanced branching capabilities and atomic changes on 50+ platforms.
Free Eval! http://www.perforce.com/perforce/loadprog.html
_______________________________________________
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 John L. Fjellstad
Quoted 11 lines · Martin Hicks
Quoted 3 lines · Kay Sievers

Greg, I would be happy to remove the ugly %D at all.
It's unable to handle cdroms, an the 'dis[ck]'/'partition' thing is easy done by two rules. Then the dis[ck] decision is also up to the user :)

Please don't get rid of %D. I just started using it. The problem that I'm dealing with is that the directory where the devfs names are created are unpredictable so my callout returns the directory that I'm to create the devfs names in and I do something like:

BUS="scsi", CALLOUT="blah", ID="*", NAME="%c/%D", SYMLINK="%c/theAlias"

I don't see your need.
Just use two rules matching with the kernel name, or handle the %D in your script. And ID= is gone now, in udev v013. We are using RESULT= instead.

I vote for killing the %D :)

Kay

-------------------------------------------------------
This SF.net email is sponsored by: Perforce Software. Perforce is the Fast Software Configuration Management System offering advanced branching capabilities and atomic changes on 50+ platforms. Free Eval! http://www.perforce.com/perforce/loadprog.html
_______________________________________________
Linux-hotplug-devel mailing list http://linux-hotplug.sourceforge.net
[email protected]
https://lists.sourceforge.net/lists/listinfo/linux-hotplug-devel

#4 lore raw
In reply to John L. Fjellstad
Quoted 11 lines · Kay Sievers
Quoted 10 lines · Martin Hicks
Quoted 3 lines · Kay Sievers

Greg, I would be happy to remove the ugly %D at all.
It's unable to handle cdroms, an the 'dis[ck]'/'partition' thing is easy done by two rules. Then the dis[ck] decision is also up to the user :)

Please don't get rid of %D. I just started using it. The problem that I'm dealing with is that the directory where the devfs names are created are unpredictable so my callout returns the directory that I'm to create the devfs names in and I do something like:

Quoted 7 lines
Quoted 1 line

BUS="scsi", CALLOUT="blah", ID="*", NAME="%c/%D", SYMLINK="%c/theAlias"

I don't see your need.
Just use two rules matching with the kernel name, or handle the %D in your script. And ID= is gone now, in udev v013. We are using RESULT= instead.

I vote for killing the %D :)

I do to. I'll go remove it now.

Martin, if you _really_ think you still need it, please post your scripts, and let us determine if there's an easier way to do what you are wanting to do.

thanks,

greg k-h

-------------------------------------------------------
The SF.Net email is sponsored by EclipseCon 2004
Premiere Conference on Open Tools Development and Integration See the breadth of Eclipse activity. February 3-5 in Anaheim, CA.
http://www.eclipsecon.org/osdn
_______________________________________________
Linux-hotplug-devel mailing list http://linux-hotplug.sourceforge.net
[email protected]
https://lists.sourceforge.net/lists/listinfo/linux-hotplug-devel