udev: remove permissions file from udev
As discussed this week, here we remove the explicit permissions file from udev. All permissions should be specified along with the rule now, to have only one source of policy.
This simplifies the whole udev process and removes the need to parse a second file in a different format. The rule file will grow a bit to apply some permissions, but its an overall win.
You may look at the changes at:
http://vrfy.bkbits.net:8080/udev/ChangeSet@-8d?nav=index.html
or pull it from:
bk://vrfy.bkbits.net/udev
or get a tarball including the changes on top of version 050 at:
http://vrfy.org/projects/udev/udev-050plus.tar.gz
To get this working, the current rules file needs to be updated. I started to convert the gentoo and the Fedora file available in the tree. Any help here is appreciated, cause we need to be sure, that it will work before we make a new release. I've tested both distributions versions and I'm able to boot and login, but I'm sure there is something missing.
As an example, the gentoo rules file is attached.
Thanks,
Kay
# /etc/udev/udev.rules: device naming rules for udev
#
# Gentoo specific rules, based a bit on devfs rules, but much simpler. #
# There are a number of modifiers that are allowed to be used in some of the
# fields. See the udev man page for a full description of them.
###########################################################
#
# For devfs similar /dev layout (neater)
#
###########################################################
# cdrom symlinks and other good cdrom naming
BUS="ide", KERNEL="hd[a-z]", PROGRAM="/etc/udev/scripts/cdsymlinks.sh %k", SYMLINK="%c{1} %c{2} %c{3} %c{4} %c{5} %c{6}"
BUS="scsi", KERNEL="sr[0-9]*", PROGRAM="/etc/udev/scripts/cdsymlinks.sh %k", SYMLINK="%c{1} %c{2} %c{3} %c{4} %c{5} %c{6}"
BUS="scsi", KERNEL="scd[a-z]", PROGRAM="/etc/udev/scripts/cdsymlinks.sh %k", SYMLINK="%c{1} %c{2} %c{3} %c{4} %c{5} %c{6}"# devfs-names for ide-devices (uncomment only one)
# /dev/ide/.../{disc,cd} and /dev/{cdroms,discs}/* type names
BUS="ide", KERNEL="hd*", PROGRAM="/etc/udev/scripts/ide-devfs.sh %k %b %n", NAME="%k", SYMLINK="%c{1} %c{2}", GROUP="%c{3}", MODE="0660"# disk devices KERNEL="sd*", NAME="%k", GROUP="disk", MODE="0660" KERNEL="dasd*", NAME="%k", GROUP="disk", MODE="0660" KERNEL="ataraid*", NAME="%k", GROUP="disk", MODE="0660"
# dri devices KERNEL="card*", NAME="dri/card%n", GROUP="video", MODE="0660" KERNEL="nvidia*", NAME="%k", GROUP="video", MODE="0660" KERNEL="3dfx*", NAME="%k", GROUP="video", MODE="0660"
# alsa devices KERNEL="controlC[0-9]*", NAME="snd/%k" KERNEL="hw[CD0-9]*", NAME="snd/%k" KERNEL="pcm[CD0-9cp]*", NAME="snd/%k" KERNEL="midiC[D0-9]*", NAME="snd/%k" KERNEL="timer", NAME="snd/%k" KERNEL="seq", NAME="snd/%k"
# capi devices KERNEL="capi", NAME="capi20", SYMLINK="isdn/capi20" KERNEL="capi*", NAME="capi/%n"
# cpu devices KERNEL="cpu[0-9]*", NAME="cpu/%n/cpuid" KERNEL="msr[0-9]*", NAME="cpu/%n/msr" KERNEL="microcode", NAME="cpu/microcode"
# dm devices (ignore them) KERNEL="dm-[0-9]*", NAME="" # create a symlink named after the device map name # note devmap_name comes with extras/multipath #KERNEL="dm-[0-9]*", PROGRAM="/sbin/devmap_name %M %m", NAME="%k", SYMLINK="%c" KERNEL="device-mapper", NAME="mapper/control"
# fb devices KERNEL="fb[0-9]*", NAME="fb/%n", SYMLINK="%k"
# floppy devices KERNEL="fd[0-9]*", NAME="floppy/%n", SYMLINK="%k", GROUP="floppy", MODE="0660"
# i2c devices KERNEL="i2c-[0-9]*", NAME="i2c/%n", SYMLINK="%k"
# input devices KERNEL="mice", NAME="input/%k", MODE="0644" KERNEL="mouse*", NAME="input/%k", MODE="0644" KERNEL="event*", NAME="input/%k", MODE="0600" KERNEL="js*", NAME="input/%k", MODE="664" KERNEL="ts*", NAME="input/%k", MODE="0600"
# loop devices KERNEL="loop[0-9]*", NAME="loop/%n", SYMLINK="%k", GROUP="disk", MODE="0660"
# md block devices KERNEL="md[0-9]*", NAME="md/%n", SYMLINK="%k", GROUP="disk", MODE="0660"
# misc devices KERNEL="agpgart", NAME="misc/%k", SYMLINK="%k" KERNEL="psaux", NAME="misc/%k", SYMLINK="%k" KERNEL="rtc", NAME="misc/%k", SYMLINK="%k", MODE="0664" KERNEL="uinput", NAME="misc/%k", SYMLINK="%k" KERNEL="inotify", NAME="misc/%k", SYMLINK="%k", MODE="0666"
# netlink devices KERNEL="route", NAME="netlink/%k" KERNEL="skip", NAME="netlink/%k" KERNEL="usersock", NAME="netlink/%k" KERNEL="fwmonitor", NAME="netlink/%k" KERNEL="tcpdiag", NAME="netlink/%k" KERNEL="nflog", NAME="netlink/%k" KERNEL="xfrm", NAME="netlink/%k" KERNEL="arpd", NAME="netlink/%k" KERNEL="route6", NAME="netlink/%k" KERNEL="ip6_fw", NAME="netlink/%k" KERNEL="dnrtmsg", NAME="netlink/%k" KERNEL="tap*", NAME="netlink/%k"
# network devices KERNEL="tun", NAME="net/%k"
# ramdisk devices KERNEL="ram[0-9]*", NAME="rd/%n", SYMLINK="%k"
# raw devices KERNEL="raw[0-9]*", NAME="raw/%k", GROUP="disk", MODE="0660" KERNEL="ram*", NAME="%k", GROUP="disk", MODE="0660"
# sound devices KERNEL="adsp", NAME="sound/%k", SYMLINK="%k", GROUP="audio", MODE="0660" KERNEL="adsp[0-9]*", NAME="sound/%k", SYMLINK="%k", GROUP="audio", MODE="0660" KERNEL="audio", NAME="sound/%k", SYMLINK="%k", GROUP="audio", MODE="0660" KERNEL="audio[0-9]*", NAME="sound/%k", SYMLINK="%k", GROUP="audio", MODE="0660" KERNEL="dsp", NAME="sound/%k", SYMLINK="%k", GROUP="audio", MODE="0660" KERNEL="dsp[0-9]*", NAME="sound/%k", SYMLINK="%k", GROUP="audio", MODE="0660" KERNEL="mixer", NAME="sound/%k", SYMLINK="%k", GROUP="audio", MODE="0660" KERNEL="mixer[0-9]*", NAME="sound/%k", SYMLINK="%k", GROUP="audio", MODE="0660" KERNEL="sequencer", NAME="sound/%k", SYMLINK="%k", GROUP="audio", MODE="0660" KERNEL="sequencer[0-9]*", NAME="sound/%k", SYMLINK="%k", GROUP="audio", MODE="0660"
# tty devices KERNEL="console", NAME="%k", GROUP="tty", MODE="0600" KERNEL="tty", NAME="%k", GROUP="tty", MODE="0666" KERNEL="tty[0-9]*", NAME="vc/%n", SYMLINK="%k", GROUP="tty", MODE="0660" KERNEL="ttyS[0-9]*", NAME="tts/%n", SYMLINK="%k", GROUP="tty", MODE="0660" KERNEL="ttyUSB[0-9]*", NAME="tts/USB%n", GROUP="tty", MODE="0600" KERNEL="ippp0", NAME="%k", GROUP="tty", MODE="0660" KERNEL="isdn*", NAME="%k", GROUP="tty", MODE="0660" KERNEL="dcbri*", NAME="%k", GROUP="tty", MODE="0660" KERNEL="ircomm*", NAME="%k", GROUP="tty", MODE="0660"
# pty devices KERNEL="ptmx", NAME="%k", GROUP="tty", MODE="0666" KERNEL="pty[p-za-e][0-9a-f]*", NAME="pty/m%n", SYMLINK="%k", GROUP="tty", MODE="0660" KERNEL="tty[p-za-e][0-9a-f]*", NAME="pty/s%n", SYMLINK="%k", GROUP="tty", MODE="0660"
# vc devices KERNEL="vcs", NAME="vcc/0", SYMLINK="%k", GROUP="tty", MODE="0660" KERNEL="vcs[0-9]*", NAME="vcc/%n", SYMLINK="%k", GROUP="tty", MODE="0660" KERNEL="vcsa", NAME="vcc/a0", SYMLINK="%k", GROUP="tty", MODE="0660" KERNEL="vcsa[0-9]*", NAME="vcc/a%n", SYMLINK="%k", GROUP="tty", MODE="0660"
# memory devices KERNEL="random", NAME="%k", MODE="0666" KERNEL="urandom", NAME="%k", MODE="0444" KERNEL="mem", NAME="%k", MODE="0640" KERNEL="kmem", NAME="%k", MODE="0640" KERNEL="port", NAME="%k", MODE="0640" KERNEL="full", NAME="%k", MODE="0666" KERNEL="null", NAME="%k", MODE="0666" KERNEL="zero", NAME="%k", MODE="0666"
# usb devices KERNEL="hiddev*", NAME="usb/%k" KERNEL="auer*", NAME="usb/%k" KERNEL="legousbtower*", NAME="usb/%k", GROUP="usb", MODE="0660" KERNEL="dabusb*", NAME="usb/%k" BUS="usb", KERNEL="lp[0-9]*", NAME="usb/%k", GROUP="lp", MODE="0660"
# v4l devices KERNEL="video[0-9]*", NAME="v4l/video%n", SYMLINK="video%n", GROUP="video", MODE="0660" KERNEL="radio[0-9]*", NAME="v4l/radio%n", GROUP="video", MODE="0660" KERNEL="vbi[0-9]*", NAME="v4l/vbi%n", SYMLINK="vbi%n", GROUP="video", MODE="0660" KERNEL="vtx[0-9]*", NAME="v4l/vtx%n", GROUP="video", MODE="0660"
# Asterix Zaptel devices
KERNEL="zapctl", NAME="zap/ctl"
KERNEL="zaptimer", NAME="zap/timer"
KERNEL="zapchannel", NAME="zap/channel"
KERNEL="zappseudo", NAME="zap/pseudo"
KERNEL="zap[0-9]*", NAME="zap/%n"
# pilot/palm devices KERNEL="pilot", NAME="%k", GROUP="uucp", MODE="0660"
# jaz devices KERNEL="jaz*", NAME="%k", GROUP="disk", MODE="0660"
# zip devices KERNEL="pocketzip*", NAME="%k", GROUP="disk", MODE="0660" KERNEL="zip*", NAME="%k", GROUP="disk", MODE="0660"
# ls120 devices KERNEL="ls120", NAME="%k", GROUP="disk", MODE="0660"
# lp devices KERNEL="lp*", NAME="%k", GROUP="lp", MODE="0660" KERNEL="irlpt", NAME="%k", GROUP="lp", MODE="0660" KERNEL="usblp", NAME="%k", GROUP="lp", MODE="0660" KERNEL="lp*", NAME="%k", GROUP="lp", MODE="0660"
# tape devices KERNEL="ht*", NAME="%k", GROUP="tape", MODE="0660" KERNEL="nht*", NAME="%k", GROUP="tape", MODE="0660" KERNEL="pt*", NAME="%k", GROUP="tape", MODE="0660" KERNEL="npt*", NAME="%k", GROUP="tape", MODE="0660" KERNEL="st*", NAME="%k", GROUP="tape", MODE="0660" KERNEL="nst*", NAME="%k", GROUP="tape", MODE="0660"
# diskonkey devices KERNEL="diskonkey*", NAME="%k", GROUP="disk", MODE="0660"
# rem_ide devices KERNEL="microdrive*", NAME="%k", GROUP="disk", MODE="0660"
# kbd devices KERNEL="kbd", NAME="%k", MODE="0664"
# Sony Vaio Jogdial sonypi device
KERNEL="sonypi", NAME="%k", MODE="0666"
# gpm devices KERNEL="gpmctl", NAME="%k", MODE="0700"
Quoted 1 line · Kay Sievers
To get this working, the current rules file needs to be updated. I
It may be better to use default_mode="0660", I do not think that there are any mode 600 devices. This would allow setting only the group for most of them.
(Feature request: would it be possible to extend the rules files parser to support continuation lines? I'd like it to consider lines starting with white space as part of the previous line.)
Quoted 3 lines
started to convert the gentoo and the Fedora file available in the tree. Any help here is appreciated, cause we need to be sure, that it will work before we make a new release. I've tested both distributions
Don't bother with the debian files, I will send updated ones later.
Quoted 3 lines
# pty devices KERNEL="pty[p-za-e][0-9a-f]*", NAME="pty/m%n", SYMLINK="%k", GROUP="tty", MODE="0660" KERNEL="tty[p-za-e][0-9a-f]*", NAME="pty/s%n", SYMLINK="%k", GROUP="tty", MODE="0660"
Do 2.6 kernels really still support BSD pty devices?
Quoted 2 lines
# gpm devices KERNEL="gpmctl", NAME="%k", MODE="0700"
This is a pipe or socket, it has never been a device.
Signature · 2 lines
ciao, | Marco | [9925 inDKIShkUK1Jg]
Quoted 8 lines · Kay Sievers
# tape devices KERNEL="ht*", NAME="%k", GROUP="tape", MODE="0660" KERNEL="nht*", NAME="%k", GROUP="tape", MODE="0660" KERNEL="pt*", NAME="%k", GROUP="tape", MODE="0660" KERNEL="npt*", NAME="%k", GROUP="tape", MODE="0660" KERNEL="st*", NAME="%k", GROUP="tape", MODE="0660" KERNEL="nst*", NAME="%k", GROUP="tape", MODE="0660"
Would you mind adding OnStream tape drives?
KERNEL="osst*", NAME="%k", GROUP="tape", MODE="0660"
KERNEL="nosst*", NAME="%k", GROUP="tape", MODE="0660"
Thanks, Willem Riede.
(osst maintainer)
-------------------------------------------------------
SF email is sponsored by - The IT Product Guide
Read honest & candid reviews on hundreds of IT Products from real users. Discover which products truly live up to the hype. Start reading now.
http://productguide.itmanagersjournal.com/
_______________________________________________
Linux-hotplug-devel mailing list http://linux-hotplug.sourceforge.net
[email protected]
https://lists.sourceforge.net/lists/listinfo/linux-hotplug-devel
Quoted 6 lines · Marco d'Itri
Quoted 1 line · Kay Sievers
To get this working, the current rules file needs to be updated. I
It may be better to use default_mode="0660", I do not think that there are any mode 600 devices. This would allow setting only the group for most of them.
Good point and sounds reasonable as the default group is root anyway.
Quoted 3 lines
(Feature request: would it be possible to extend the rules files parser to support continuation lines? I'd like it to consider lines starting with white space as part of the previous line.)
What about a backslash at the end of the line?
Quoted 4 lines
Quoted 3 lines
started to convert the gentoo and the Fedora file available in the tree. Any help here is appreciated, cause we need to be sure, that it will work before we make a new release. I've tested both distributions
Don't bother with the debian files, I will send updated ones later.
Nice, thanks.
Quoted 4 lines
Quoted 3 lines
# pty devices KERNEL="pty[p-za-e][0-9a-f]*", NAME="pty/m%n", SYMLINK="%k", GROUP="tty", MODE="0660" KERNEL="tty[p-za-e][0-9a-f]*", NAME="pty/s%n", SYMLINK="%k", GROUP="tty", MODE="0660"Do 2.6 kernels really still support BSD pty devices?
I don't know.
Quoted 3 lines
Quoted 2 lines
# gpm devices KERNEL="gpmctl", NAME="%k", MODE="0700"This is a pipe or socket, it has never been a device.
I've just ported it from the permissions file. So this can be removed, yes.
Kay
-------------------------------------------------------
SF email is sponsored by - The IT Product Guide
Read honest & candid reviews on hundreds of IT Products from real users. Discover which products truly live up to the hype. Start reading now.
http://productguide.itmanagersjournal.com/
_______________________________________________
Linux-hotplug-devel mailing list http://linux-hotplug.sourceforge.net
[email protected]
https://lists.sourceforge.net/lists/listinfo/linux-hotplug-devel
Quoted 10 lines · Willem Riede
Quoted 8 lines · Kay Sievers
# tape devices KERNEL="ht*", NAME="%k", GROUP="tape", MODE="0660" KERNEL="nht*", NAME="%k", GROUP="tape", MODE="0660" KERNEL="pt*", NAME="%k", GROUP="tape", MODE="0660" KERNEL="npt*", NAME="%k", GROUP="tape", MODE="0660" KERNEL="st*", NAME="%k", GROUP="tape", MODE="0660" KERNEL="nst*", NAME="%k", GROUP="tape", MODE="0660"
Quoted 4 lines
Would you mind adding OnStream tape drives?
KERNEL="osst*", NAME="%k", GROUP="tape", MODE="0660"
KERNEL="nosst*", NAME="%k", GROUP="tape", MODE="0660"
I've added it to the gentoo rules.
Thanks,
Kay
-------------------------------------------------------
SF email is sponsored by - The IT Product Guide
Read honest & candid reviews on hundreds of IT Products from real users. Discover which products truly live up to the hype. Start reading now.
http://productguide.itmanagersjournal.com/
_______________________________________________
Linux-hotplug-devel mailing list http://linux-hotplug.sourceforge.net
[email protected]
https://lists.sourceforge.net/lists/listinfo/linux-hotplug-devel
Quoted 5 lines · Marco d'Itri
On Dec 19, Kay Sievers <[email protected]> wrote:
(Feature request: would it be possible to extend the rules files parser to support continuation lines? I'd like it to consider lines starting with white space as part of the previous line.)
How about the usual backslash at the end of the line. Here is a simple patch, that just replaces backslashes/newlines with spaces. So it will obviously not work if key values continue at the next line. How does that sound?
Kay
namedev_parse.c +7 -2
@@ -126,14 +126,15 @@ cur =0 ; lineno =0 ;while (cur < bufsize) { +int i; + count =buf_get_line (buf, bufsize, cur); bufline = &buf[cur]; cur += count+1 ; lineno++;if (count >=LINE_SIZE ) { -info ("line too long, rule skipped %s, line %d" , - filename, lineno); +info ("line too long, rule skipped %s, line %d" , filename, lineno);continue ; }
@@ -149,8 +150,12 @@if (bufline[0 ] ==COMMENT_CHARACTER )continue ; +/* remove backslash and newline from multi line rules */ strncpy (line, bufline, count); line[count] ='\0' ; +for (i =0 ; i < count; i++) +if (line[i] =='\\' || line[i] =='\n' ) + line[i] =' ' ;dbg_parse ("read '%s'" , line);/* get all known keys */
test/udev-test.pl +30 -0
@@ -190,6 +190,36 @@ EOF }, { + desc => "Handle backslashed multi lines in config file (and replace kernel name)", + subsys => "tty", + devpath => "/class/tty/ttyUSB0", + exp_name => "visor" , + conf => <<EOF +KERNEL="ttyUSB0", \\ +NAME="visor" + +EOF + }, + { + desc => "Handle stupid backslashed multi lines in config file (and replace kernel name)", + subsys => "tty", + devpath => "/class/tty/ttyUSB0", + exp_name => "visor" , + conf => <<EOF + +# +\\ + +\\\\ + +#\\ + +KERNEL="ttyUSB0", \\ +NAME="visor" + +EOF + }, + { desc => "subdirectory handling", subsys => "tty", devpath => "/class/tty/ttyUSB0",
udev.h +1 -2
@@ -37,7 +37,7 @@#define SUBSYSTEM_SIZE 32#define SEQNUM_SIZE 32 -#define LINE_SIZE 256 +#define LINE_SIZE 512#define DEVD_DIR "/etc/dev.d"#define DEVD_SUFFIX ".dev"
@@ -74,7 +74,6 @@extern int udev_remove_device (struct udevice *udev);extern void udev_init_config (void );extern int udev_start (void ); -extern int parse_get_pair (char **orig_string,char **left,char **right);extern void udev_multiplex_directory (struct udevice *udev,const char *basedir,const char *suffix);extern char sysfs_path[SYSFS_PATH_MAX ];
udev_config.c +6 -48
67 lines not on this page · raw message
udev_utils.c +49 -3
72 lines not on this page · raw message
udev_utils.h +2 -1
@@ -79,9 +79,10 @@extern void udev_init_device (struct udevice *udev,const char * devpath,const char *subsystem);extern int kernel_release_satisfactory (int version,int patchlevel,int sublevel);extern int create_path (const char *path); +extern int parse_get_pair (char **orig_string,char **left,char **right);extern int file_map (const char *filename,char **buf,size_t *bufsize);extern void file_unmap (char *buf,size_t bufsize); -extern size_t buf_get_line (char *buf,size_t buflen,size_t cur); +extern size_t buf_get_line (const char *buf,size_t buflen,size_t cur);extern void no_trailing_slash (char *path);typedef int (*file_fnct_t )(const char *filename,void *data); extern int call_foreach_file(file_fnct_t fnct, const char *dirname,
Quoted 4 lines · Kay Sievers
How about the usual backslash at the end of the line. Here is a simple patch, that just replaces backslashes/newlines with spaces. So it will obviously not work if key values continue at the next line. How does that sound?
I think that continuation on leading blanks is more practical, but since you are the one writing the code I suppose that this will work as well... :-)
Signature · 2 lines
ciao, | Marco | [9930 co3JWpx.tkg..]
Quoted 9 lines · Marco d'Itri
Quoted 4 lines · Kay Sievers
How about the usual backslash at the end of the line. Here is a simple patch, that just replaces backslashes/newlines with spaces. So it will obviously not work if key values continue at the next line. How does that sound?
I think that continuation on leading blanks is more practical, but since you are the one writing the code I suppose that this will work as well... :-)
Hmm, I'm just thought that it's still interpreted as one line and the backslash syntax is more intuitive here, cause it doesn't look like a block of separate instructions.
I've pushed a new version out into my tree. If you want a tarball, let me know.
Kay
-------------------------------------------------------
SF email is sponsored by - The IT Product Guide
Read honest & candid reviews on hundreds of IT Products from real users. Discover which products truly live up to the hype. Start reading now.
http://productguide.itmanagersjournal.com/
_______________________________________________
Linux-hotplug-devel mailing list http://linux-hotplug.sourceforge.net
[email protected]
https://lists.sourceforge.net/lists/listinfo/linux-hotplug-devel
Quoted 11 lines · Kay Sievers
As discussed this week, here we remove the explicit permissions file from udev. All permissions should be specified along with the rule now, to have only one source of policy.
This simplifies the whole udev process and removes the need to parse a second file in a different format. The rule file will grow a bit to apply some permissions, but its an overall win.
You may look at the changes at:
http://vrfy.bkbits.net:8080/udev/ChangeSet@-8d?nav=index.html
Quoted 7 lines
or pull it from:
bk://vrfy.bkbits.net/udevTo get this working, the current rules file needs to be updated. I started to convert the gentoo and the Fedora file available in the tree. Any help here is appreciated, cause we need to be sure, that it will work before we make a new release.
Just an example how nice the permissions application can work now. The following line applies the "disk" group ownership to all block devices not catched by an earlier explicit rule.
There is no longer the need to catch all the different node names of a device class.
etc/udev/gentoo/udev.rules 2004-12-20 14:24:22 +01:00 +3 -0
@@ -207,6 +207,9 @@ # rem_ide devices KERNEL="microdrive*", NAME="%k", GROUP="disk" +# all block devices +SUBSYSTEM="block", NAME="%k", GROUP="disk" + # kbd devices KERNEL="kbd", NAME="%k", MODE="0664"
Thanks,
Kay
-------------------------------------------------------
SF email is sponsored by - The IT Product Guide
Read honest & candid reviews on hundreds of IT Products from real users. Discover which products truly live up to the hype. Start reading now.
http://productguide.itmanagersjournal.com/
_______________________________________________
Linux-hotplug-devel mailing list http://linux-hotplug.sourceforge.net
[email protected]
https://lists.sourceforge.net/lists/listinfo/linux-hotplug-devel
Review
Quoted 3 lines · Kay Sievers
(quoted diff) +3
-0+# all block devices +SUBSYSTEM="block", NAME="%k", GROUP="disk" +
NAME="%k" here and in similar rules does not add any new information, what about making it optional, like it is for SYMLINK-only rules?
Signature · 2 lines
ciao, | Marco | [9945 afTk4TWqM7keE]
Quoted 7 lines · Marco d'Itri
Review
Quoted 3 lines · Kay Sievers
(quoted diff) +3
-0+# all block devices +SUBSYSTEM="block", NAME="%k", GROUP="disk" +NAME="%k" here and in similar rules does not add any new information, what about making it optional, like it is for SYMLINK-only rules?
Yeah, I was already working on this. :) You may get the tarball:
http://vrfy.org/projects/udev/udev-050-plus2.tar.gz
Or look here:
http://vrfy.bkbits.net:8080/udev/ChangeSet@-2d?nav=index.html
Thanks,
Kay
-------------------------------------------------------
SF email is sponsored by - The IT Product Guide
Read honest & candid reviews on hundreds of IT Products from real users. Discover which products truly live up to the hype. Start reading now.
http://productguide.itmanagersjournal.com/
_______________________________________________
Linux-hotplug-devel mailing list http://linux-hotplug.sourceforge.net
[email protected]
https://lists.sourceforge.net/lists/listinfo/linux-hotplug-devel
Thus spake Kay Sievers on Mon, Dec 20, 2004 at 07:36:51AM CST
Quoted 9 lines
Just an example how nice the permissions application can work now. The following line applies the "disk" group ownership to all block devices not catched by an earlier explicit rule.
There is no longer the need to catch all the different node names of a device class.
etc/udev/gentoo/udev.rules 2004-12-20 14:24:22 +01:00 line 214
Quoted 8 lines
etc/udev/gentoo/udev.rules 2004-12-20 14:24:22 +01:00 +3
-0@@ -207,6 +207,9 @@ # rem_ide devices KERNEL="microdrive*", NAME="%k", GROUP="disk" +# all block devices +SUBSYSTEM="block", NAME="%k", GROUP="disk" + # kbd devices KERNEL="kbd", NAME="%k", MODE="0664"
If it hasn't been done, I'm going to lobby once again for the inclusion in udev of a utility which will will parse the sysfs tree for acceptable values for KERNEL and spit out copy 'n paste lines which are acceptable in a rules file, much the way udevinfo does for SYSFS{*} terms. I corresponded with Greg KH on this a while back and he suggested a simple shell script for this, which I tweaked a bit and reposted. Such as script could also show acceptable values for SUBSYSTEM. If it hasn't been done, and I get a moment after the 1st of the year, I'll work on something and post it.
Thanks!
Signature · 16 lines
Lindsay Haisley | "Fighting against human | PGP public key
FMP Computer Services | creativity is like | available at
512-259-1190 | trying to eradicate | <http://pubkeys.fmp.com>
http://www.fmp.com | dandelions" |
| (Pamela Jones) |
-------------------------------------------------------
SF email is sponsored by - The IT Product Guide
Read honest & candid reviews on hundreds of IT Products from real users.
Discover which products truly live up to the hype. Start reading now.
http://productguide.itmanagersjournal.com/
_______________________________________________
Linux-hotplug-devel mailing list http://linux-hotplug.sourceforge.net
[email protected]
https://lists.sourceforge.net/lists/listinfo/linux-hotplug-develQuoted 13 lines · Lindsay Haisley
Thus spake Kay Sievers on Mon, Dec 20, 2004 at 07:36:51AM CST
Quoted 12 lines
Just an example how nice the permissions application can work now. The following line applies the "disk" group ownership to all block devices not catched by an earlier explicit rule.
There is no longer the need to catch all the different node names of a device class.etc/udev/gentoo/udev.rules 2004-12-20 14:24:22 +01:00 +0
-0@@ -207,6 +207,9 @@ # rem_ide devices KERNEL="microdrive*", NAME="%k", GROUP="disk"
Quoted 14 lines
etc/udev/gentoo/udev.rules 2004-12-20 14:24:22 +01:00 line 214
Quoted 5 lines
etc/udev/gentoo/udev.rules 2004-12-20 14:24:22 +01:00 +3
-0+# all block devices +SUBSYSTEM="block", NAME="%k", GROUP="disk" + # kbd devices KERNEL="kbd", NAME="%k", MODE="0664"If it hasn't been done, I'm going to lobby once again for the inclusion in udev of a utility which will will parse the sysfs tree for acceptable values for KERNEL and spit out copy 'n paste lines which are acceptable in a rules file, much the way udevinfo does for SYSFS{*} terms. I corresponded with Greg KH on this a while back and he suggested a simple shell script for this, which I tweaked a bit and reposted. Such as script could also show acceptable values for SUBSYSTEM. If it hasn't been done, and I get a moment after the 1st of the year, I'll work on something and post it.
Hmm, I don't know if this is really useful, as sysfs has well defined filenames you can list that with just "ls -1 /sys/class /sys/bus", which will print all possible subsystems (besides block).
It's different from the sysfs _values_ which may be vendor defined and contain odd whitespaces and similar. That's why we have the udevinfo print.
udevinfo already prints BUS= and ID= so you may add the KERNEL=, DRIVER=, SUBSYSTEM= keys there if you think that is useful.
Thanks,
Kay
-------------------------------------------------------
SF email is sponsored by - The IT Product Guide
Read honest & candid reviews on hundreds of IT Products from real users. Discover which products truly live up to the hype. Start reading now.
http://productguide.itmanagersjournal.com/
_______________________________________________
Linux-hotplug-devel mailing list http://linux-hotplug.sourceforge.net
[email protected]
https://lists.sourceforge.net/lists/listinfo/linux-hotplug-devel
Quoted 9 lines · Kay Sievers
Quoted 7 lines · Marco d'Itri
Review
Quoted 3 lines · Kay Sievers
(quoted diff) +3
-0+# all block devices +SUBSYSTEM="block", NAME="%k", GROUP="disk" +NAME="%k" here and in similar rules does not add any new information, what about making it optional, like it is for SYMLINK-only rules?
Quoted 5 lines
Yeah, I was already working on this. :) You may get the tarball:
http://vrfy.org/projects/udev/udev-050-plus2.tar.gzOr look here:
http://vrfy.bkbits.net:8080/udev/ChangeSet@-2d?nav=index.html
We may even remove the definition of the default values from the udev.conf file now, as with the "permissions only rules" we can just place:
MODE="0660", OWNER="root", GROUP="root"
at the beginning of the rules file and get exactly the same behavior. How does that sound?
Thanks,
Kay
-------------------------------------------------------
SF email is sponsored by - The IT Product Guide
Read honest & candid reviews on hundreds of IT Products from real users. Discover which products truly live up to the hype. Start reading now.
http://productguide.itmanagersjournal.com/
_______________________________________________
Linux-hotplug-devel mailing list http://linux-hotplug.sourceforge.net
[email protected]
https://lists.sourceforge.net/lists/listinfo/linux-hotplug-devel
Quoted 8 lines · Kay Sievers
We may even remove the definition of the default values from the udev.conf file now, as with the "permissions only rules" we can just place:
MODE="0660", OWNER="root", GROUP="root"
at the beginning of the rules file and get exactly the same behavior. How does that sound?
This looks like a very good idea.
But now I think it's needed to clearly document which statements cause end of processing of the rules file. Only NAME or are there any others?
Signature · 2 lines
ciao, | Marco | [9954 slSVeAV9ThM2o]
Quoted 6 lines · Marco d'Itri
Quoted 4 lines · Kay Sievers
We may even remove the definition of the default values from the udev.conf file now, as with the "permissions only rules" we can just place:
Quoted 7 lines
Quoted 4 lines
MODE="0660", OWNER="root", GROUP="root"
at the beginning of the rules file and get exactly the same behavior. How does that sound?
This looks like a very good idea.
But now I think it's needed to clearly document which statements cause end of processing of the rules file. Only NAME or are there any others?
Right, only NAME stops the processing. The default kernel name will be used possibly along with the permissions and SYMLINKS from the "only rules".
Kay
-------------------------------------------------------
SF email is sponsored by - The IT Product Guide
Read honest & candid reviews on hundreds of IT Products from real users. Discover which products truly live up to the hype. Start reading now.
http://productguide.itmanagersjournal.com/
_______________________________________________
Linux-hotplug-devel mailing list http://linux-hotplug.sourceforge.net
[email protected]
https://lists.sourceforge.net/lists/listinfo/linux-hotplug-devel
Quoted 8 lines · Kay Sievers
We may even remove the definition of the default values from the udev.conf file now, as with the "permissions only rules" we can just place:
MODE="0660", OWNER="root", GROUP="root"
at the beginning of the rules file and get exactly the same behavior. How does that sound?
That would be great. It really doesn't make sense to keep the directives in udev.conf now with the new rules file.
Cheers, Tobias
-------------------------------------------------------
SF email is sponsored by - The IT Product Guide
Read honest & candid reviews on hundreds of IT Products from real users. Discover which products truly live up to the hype. Start reading now.
http://productguide.itmanagersjournal.com/
_______________________________________________
Linux-hotplug-devel mailing list http://linux-hotplug.sourceforge.net
[email protected]
https://lists.sourceforge.net/lists/listinfo/linux-hotplug-devel
Thus spake Kay Sievers on Mon, Dec 20, 2004 at 02:30:22PM CST
Quoted 9 lines
Quoted 8 lines
If it hasn't been done, I'm going to lobby once again for the inclusion in udev of a utility which will will parse the sysfs tree for acceptable values for KERNEL and spit out copy 'n paste lines which are acceptable in a rules file, much the way udevinfo does for SYSFS{*} terms. I corresponded with Greg KH on this a while back and he suggested a simple shell script for this, which I tweaked a bit and reposted. Such as script could also show acceptable values for SUBSYSTEM. If it hasn't been done, and I get a moment after the 1st of the year, I'll work on something and post it.
Quoted 3 lines
Hmm, I don't know if this is really useful, as sysfs has well defined filenames you can list that with just "ls -1
/sys/class/sys/bus", which will print all possible subsystems (besides block).
I figured this out, but had to go exploring in /sys to get a clue. Even a better doc on this would help.
Quoted 3 lines
It's different from the sysfs _values_ which may be vendor defined and contain odd whitespaces and similar. That's why we have the udevinfo print.
Yeah, this is really needed for sure for SYSFS terms in a rules file, and you're quite right about getting this information from /sys being relatively trivial, assuming one understands something about the structure of the sysfs file system.
Quoted 2 lines
udevinfo already prints BUS= and ID= so you may add the KERNEL=, DRIVER=, SUBSYSTEM= keys there if you think that is useful.
It's simply a matter of convenience. It wasn't very long ago that I started using devfs and had to learn devfs rules files. Now we've moved on to udev/sysfs, and it's new tech - different data structurs, different config files. Being able to get everything one needs to compose working udev rules from a single utility, without having to learn the structure of and explore /sys, is majorly convenient. It's just polish, but people do wax and polish their cars ;-)
Signature · 16 lines
Lindsay Haisley | "Fighting against human | PGP public key
FMP Computer Services | creativity is like | available at
512-259-1190 | trying to eradicate | <http://pubkeys.fmp.com>
http://www.fmp.com | dandelions" |
| (Pamela Jones) |
-------------------------------------------------------
SF email is sponsored by - The IT Product Guide
Read honest & candid reviews on hundreds of IT Products from real users.
Discover which products truly live up to the hype. Start reading now.
http://productguide.itmanagersjournal.com/
_______________________________________________
Linux-hotplug-devel mailing list http://linux-hotplug.sourceforge.net
[email protected]
https://lists.sourceforge.net/lists/listinfo/linux-hotplug-develQuoted 6 lines · Lindsay Haisley
Thus spake Kay Sievers on Mon, Dec 20, 2004 at 02:30:22PM CST
Quoted 4 lines
Quoted 4 lines
If it hasn't been done, I'm going to lobby once again for the inclusion in udev of a utility which will will parse the sysfs tree for acceptable values for KERNEL and spit out copy 'n paste lines which are acceptable in a rules file, much the way udevinfo does for SYSFS{*} terms.
Quoted 7 lines
Quoted 2 lines
udevinfo already prints BUS= and ID= so you may add the KERNEL=, DRIVER=, SUBSYSTEM= keys there if you think that is useful.
Being able to get everything one needs to compose working udev rules from a single utility, without having to learn the structure of and explore /sys, is majorly convenient. It's just polish, but people do wax and polish their cars ;-)
That's what udevinfo is for. You may look at the output of:
udevinfo -a -p <DEVPATH>
and
udevinfo -s
to get an idea. I've added the -s option while I was working on wait_for_sysfs. It's not generally useful and it may be nice to move some of that functionality into the -a option to provide the user with the full list of possible keys to paste into a rule.
Thanks,
Kay
-------------------------------------------------------
SF email is sponsored by - The IT Product Guide
Read honest & candid reviews on hundreds of IT Products from real users. Discover which products truly live up to the hype. Start reading now.
http://productguide.itmanagersjournal.com/
_______________________________________________
Linux-hotplug-devel mailing list http://linux-hotplug.sourceforge.net
[email protected]
https://lists.sourceforge.net/lists/listinfo/linux-hotplug-devel
Quoted 11 lines · Kay Sievers
Quoted 10 lines · Willem Riede
Quoted 8 lines · Kay Sievers
# tape devices KERNEL="ht*", NAME="%k", GROUP="tape", MODE="0660" KERNEL="nht*", NAME="%k", GROUP="tape", MODE="0660" KERNEL="pt*", NAME="%k", GROUP="tape", MODE="0660" KERNEL="npt*", NAME="%k", GROUP="tape", MODE="0660" KERNEL="st*", NAME="%k", GROUP="tape", MODE="0660" KERNEL="nst*", NAME="%k", GROUP="tape", MODE="0660"
Quoted 6 lines
Quoted 4 lines
Would you mind adding OnStream tape drives?
KERNEL="osst*", NAME="%k", GROUP="tape", MODE="0660"
KERNEL="nosst*", NAME="%k", GROUP="tape", MODE="0660"I've added it to the gentoo rules.
What about the redhat rules?
Thanks, Willem Riede.
-------------------------------------------------------
SF email is sponsored by - The IT Product Guide
Read honest & candid reviews on hundreds of IT Products from real users. Discover which products truly live up to the hype. Start reading now.
http://productguide.itmanagersjournal.com/
_______________________________________________
Linux-hotplug-devel mailing list http://linux-hotplug.sourceforge.net
[email protected]
https://lists.sourceforge.net/lists/listinfo/linux-hotplug-devel
Quoted 12 lines · Willem Riede
Quoted 11 lines · Kay Sievers
Quoted 10 lines · Willem Riede
Quoted 8 lines · Kay Sievers
# tape devices KERNEL="ht*", NAME="%k", GROUP="tape", MODE="0660" KERNEL="nht*", NAME="%k", GROUP="tape", MODE="0660" KERNEL="pt*", NAME="%k", GROUP="tape", MODE="0660" KERNEL="npt*", NAME="%k", GROUP="tape", MODE="0660" KERNEL="st*", NAME="%k", GROUP="tape", MODE="0660" KERNEL="nst*", NAME="%k", GROUP="tape", MODE="0660"
Quoted 8 lines
Quoted 6 lines
Quoted 4 lines
Would you mind adding OnStream tape drives?
KERNEL="osst*", NAME="%k", GROUP="tape", MODE="0660"
KERNEL="nosst*", NAME="%k", GROUP="tape", MODE="0660"I've added it to the gentoo rules.
What about the redhat rules?
Red Hat's rules are in their rpm package, and we every once in a while, sync up the udev tarball with it. Gentoo's rules, on the other hand, live in the udev tarball, as it's easier for me to maintain them over time that way :)
So in short, we can guess as to what Red Hat's rule files should look like, but Red Hat doesn't pull them from us, it's the other way around.
Hope this helps,
greg k-h
-------------------------------------------------------
SF email is sponsored by - The IT Product Guide
Read honest & candid reviews on hundreds of IT Products from real users. Discover which products truly live up to the hype. Start reading now.
http://productguide.itmanagersjournal.com/
_______________________________________________
Linux-hotplug-devel mailing list http://linux-hotplug.sourceforge.net
[email protected]
https://lists.sourceforge.net/lists/listinfo/linux-hotplug-devel
Quoted 18 lines · Greg KH
Quoted 11 lines · Willem Riede
Quoted 8 lines · Kay Sievers
Quoted 5 lines · Willem Riede
Would you mind adding OnStream tape drives?
KERNEL="osst*", NAME="%k", GROUP="tape", MODE="0660"
KERNEL="nosst*", NAME="%k", GROUP="tape", MODE="0660"I've added it to the gentoo rules.
What about the redhat rules?
Red Hat's rules are in their rpm package, and we every once in a while, sync up the udev tarball with it. Gentoo's rules, on the other hand, live in the udev tarball, as it's easier for me to maintain them over time that way :)
Quoted 4 lines
So in short, we can guess as to what Red Hat's rule files should look like, but Red Hat doesn't pull them from us, it's the other way around.
Hope this helps,
Yes, it does. Thanks. Redhat-Fedora now gained
https://bugzilla.redhat.com/beta/show_bug.cgi?id3568
Not that that's the only thing needed, there's this hotplug patch I sent to this list a while ago - who owns making that change?
scsi.agent renamed from etc/hotplug/scsi.agent +10 -2
@@ -41,8 +41,16 @@ case "$TYPE" in # 2.5.51 style attributes; <scsi/scsi.h> TYPE_* constants 0) TYPE=disk ; MODULE=sd_mod ;; - # FIXME some tapes use 'osst' not 'st' - 1) TYPE=tape ; MODULE=st ;; + # Some tapes use 'osst' not 'st' + 1) TYPE=tape ; + VENDOR=$(cat /sys/$DEVPATH/vendor) ; + MODEL=$(cat /sys/$DEVPATH/model) ; + if [ $VENDOR = "OnStream" -a ${MODEL:0:3} != "ADR" ] + then + MODULE=osst ; + else + MODULE=st ; + fi ;; 2) TYPE=printer ; MODULE=sg ;; 3) TYPE=processor ; MODULE=sg ;; 4) TYPE=worm ; MODULE=sr_mod ;;
Thanks, Willem Riede.
-------------------------------------------------------
SF email is sponsored by - The IT Product Guide
Read honest & candid reviews on hundreds of IT Products from real users. Discover which products truly live up to the hype. Start reading now.
http://productguide.itmanagersjournal.com/
_______________________________________________
Linux-hotplug-devel mailing list http://linux-hotplug.sourceforge.net
[email protected]
https://lists.sourceforge.net/lists/listinfo/linux-hotplug-devel