Udev and fstab - beginners question

Matias Feliciano feliciano.matias at free.fr
Mon Oct 4 12:54:54 UTC 2004


Le lun 04/10/2004 à 14:07, Harald Hoyer a écrit :
> Matias Feliciano wrote:
> > Example :
> > my rules :
> > BUS="ide", KERNEL="hd*", RESULT="CREATIVE DVD-ROM DVD1243E", NAME="%k", SYMLINK="dvdrom dvd cdrom%e"
> > BUS="ide", KERNEL="hd*", RESULT="SAMSUNG CD-R/RW SW-240B", NAME="%k", SYMLINK="cdrw cdrom%e"
> > 
> 
> BUS="ide", KERNEL="hd*", RESULT="CREATIVE DVD-ROM DVD1243E", SYMLINK="dvdrom"
> BUS="ide", KERNEL="hd*", RESULT="CREATIVE DVD-ROM DVD1243E", SYMLINK="dvd"
> BUS="ide", KERNEL="hd*", RESULT="CREATIVE DVD-ROM DVD1243E", SYMLINK="cdrom%e"
> BUS="ide", KERNEL="hd*", RESULT="SAMSUNG CD-R/RW SW-240B", SYMLINK="cdrw"
> BUS="ide", KERNEL="hd*", RESULT="SAMSUNG CD-R/RW SW-240B", SYMLINK="cdrom%e"
> 
> This should work, instead of your rules... only one SYMLINK per rule please!

man udev :
        SYMLINK
              The name of a symlink targeting the node. Multiple symlinks  may
              be specified by separating the names by the space character.

Also, I go through udev code and udev support multi symlink per rule.
From I vanilla udev-032 :
udev-add.c ;
        static int create_node(struct udevice *dev, int fake)
        {
        ...
                /* create symlink(s) if requested */
                foreach_strpart(dev->symlink, " ", pos, len) {
                        strfieldcpymax(linkname, pos, len+1);
                        strfieldcpy(filename, udev_root);
                        strfieldcat(filename, linkname);

I fix some problem, but consider that SYMLINK="dvdrom dvd cdrom" works
without my patch.
A vanilla udev will create 3 symlinks right now and does not do a single
: ln -s %k "dvdrom dvd cdrom"

So, if udev does not support multi links per rule, then the man page
should be updated (and the code is broken in many other place).

Another point :
form : file:///usr/share/doc/udev-032/writing_udev_rules/index.html
        It is important that your own rules get processed before the
        udev defaults, otherwise your own naming schemes will not take
        effect! I suggest that you keep your own rules in a file at
        /etc/udev/rules.d/10-local.rules (this doesn't exist by default
        - create it). As 10 comes before 50, you know that your rules
        will be looked at first.
        
        As your own rules will effectively mask out the udev defaults
        which create the base /dev layout, it is recommended that you
        also specify devfs-style names/symlinks for the rules you write,
        so that you get the sensible defaults plus your own names.


So, your solution does not works :-)
With your solution and for "CREATIVE DVD-ROM DVD1243E" (hdb), i only
have dvdrom :
$ ll /dev/ | grep hdb
ll /dev  | grep hdb
lrwxrwxrwx   1 root  root        3 oct  4 14:40 dvdrom -> hdb
brw-r-----   1 root  disk   3,  64 oct  4 14:40 hdb

Note that "<cdrom>=/dev/cdrom*" from /etc/security/console.perms is not
apply.

With my "not so broken" rule :
# ll /dev  | grep hdb
lrwxrwxrwx   1 root  root        3 oct  4 14:51 cdrom -> hdb
lrwxrwxrwx   1 root  root        3 oct  4 14:51 dvd -> hdb
lrwxrwxrwx   1 root  root        3 oct  4 14:51 dvdrom -> hdb
brw-------   1 test2 disk   3,  64 oct  4 14:51 hdb

-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 189 bytes
Desc: Ceci est une partie de message
	=?ISO-8859-1?Q?num=E9riquement?= =?ISO-8859-1?Q?_sign=E9e=2E?=
Url : http://lists.fedoraproject.org/pipermail/test/attachments/20041004/64a1cae1/attachment.bin 


More information about the test mailing list