Age | Commit message (Collapse) | Author |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
Here we move all possible options into a own key to make it possible
to have options-only rules.
The options on the NAME key are removed from the man page and will
be removed from a future version of udev.
For ignore rules, OPTIONS="ignore" should be used.
The rule:
SUBSYSTEM="block", SYSFS{removable}="1", OPTIONS="all_partitions"
will create all partitions for a block device which is known to have
removable media (a check for cdrom drives would be needed too).
|
|
physical device
|
|
|
|
We don't need to look at the parents in the device chain. There
will never be another kernel name or subsystem.
|
|
Events for partition devies may want to read the main block device
name to compose it's own name or read a disklabel from the main device.
SUBSYSTEM="block", KERNEL="*[1-9]", NAME="%P-p%n"
will append the partition number to the name of the main block device.
|
|
%N will create a temporary node for a callout a be sustituted with the
name of the node.
|
|
First case without the patch:
KERNEL="hd*", GROUP="disk", MODE="0660"
KERNEL="hdc", SYMLINK="cdrecorder", MODE="0666"
brw-rw---- 1 root disk 22, 0 Feb 5 14:08 /dev/hdc
Second case without the patch:
KERNEL="hd*", GROUP="disk", MODE="0660"
KERNEL="hdc", MODE="0666"
brw-rw-rw- 1 root disk 22, 0 Feb 5 14:08 /dev/hdc
|
|
|
|
On Mon, 2004-12-20 at 15:03 +0100, Marco d'Itri wrote:
> +# 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?
|
|
We have only one source of permissions now, so apply the default
permissions at udev init.
|
|
|
|
|
|
|
|
Initialize the defaults in udev_config.c instead of namedev.c.
Replace macro by expanded code. Switch to mode_t instead
of string value. Add and clarify some comments.
|
|
Remove udev.bus, cause it's currently unused and newer kernels will pass
it in the hotplug environment as PHYSDEVBUS.
Remove udev.action, cause it's unused.
Rename udev_set_values() to udev_init_device().
|
|
|
|
|
|
|
|
Some broken ide drivers are generating high event traffic, with
add/remove events. With this attribute, it can be specified,
that the node is always available. It may be used in conjunction
with the new DRIVER= match to catch specific kernel device drivers.
|
|
Match with a rule against a device with a specific kernel driver.
|
|
This should make it easier to catch e.g all block or net devices with
a single rule.
|
|
|
|
Move the logic when and how to call the dev.d/ scripts into the
main processing path.
|
|
Remove the overwriting of main_argv[] hack and use the values
from the udev object.
Pass the udev object to call_foreach_file().
In the udevstart case, export SUBSYSTEM and UDEVSTART to the
environment.
|
|
This makes the udev operation completely lockless by storing a
file for every node in /dev/.udevdb/* This solved the problem
with deadlocking concurrent udev processes waiting for each other
to release the file lock under heavy load.
|
|
|
|
|
|
|
|
Here is the first patch to cleanup the internal processing of the
various stages of an udev event. It should not change any behavior,
but if your system depends on udev, please always test it before reboot :)
We pass only one generic structure around between add, remove,
namedev, db and dev_d handling and make all relevant data available
to all internal stages. All udev structures are renamed to "udev".
We replace the fake parameter by a flag in the udev structure.
We open the class device in the main binaries and not in udev_add, to
make it possible to use libsysfs for udevstart directory crawling.
The last sleep parameters are removed.
|
|
Here we remove all the sysfs sleep loops from udev as wait_for_sysfs
will do this for us and any other hotplug user. We still keep a small
blacklist of subsystems we don't care about but any missing entry here
will no longer lead to a spinning udev waiting for files.
|
|
> > > > That explains the spaces. What about stuff trailing %s, if %s does not
> > > > contain spaces. I.e, in the above example, model is ST336753LC and the
> > > > resulting device file is /dev/scsi_disks/some-proceding-stuff-
> > > > ST336753LC.
> > >
> > > I expect the model value has trailing spaces.
> > >
> > > You may look with:
> > > udevinfo -a -p /block/sdX
> >
> > Yes it does, and it seems for most SCSI devices, vendor and model will
> > have trailing spaces.
>
> It all depends on the vendor and model :)
>
> > I have included a patch to udev-036 to deal with
> > this issue. It trims off trailing whitespace for all sysfs attributes.
> > It might be better to trim off leading whitespace as well.
>
> We already trim it off when matching, but we also allow matching if you
> do put the spaces in there. This patch breaks that, right?
Correct, I have a new patch that trims after the comparison, so it
should work in both cases.
|
|
Here is the patch, that should prevent all of the known deadlocks with
corrupt tdb databases we discovered.
Thanks to Frank Steiner <fsteiner-mail@bio.ifi.lmu.de>, who tested all this
endlessly with a NFS mounted /dev. The conclusion is, that udev will not work
on filesystems without proper record locking, but we should prevent the
endless loops anyway. This patch implements:
o recovery from a corrupted udev database. udev will continue
without database support now, instead of doing nothing. So the node should
be generated in any case, remove will obviously not work for custom names.
o added iteration limits to the tdb-code at the places we discovered endless
loops. In the case tdb tries to find more than 100.000 entries with the
same hash, we better give up :)
o prevent a {all_partitions} loop caused by corrupt db data
o log all tdb errors to syslog
o switch sleep() to usleep() cause we want to use alarm()
|
|
Here is the correction for the dev.d/ scripts too. We should pass
the right argv[0] here too. A script may depend on the right value, as
udev does with udev/udevstart.
Here is the old version:
[pid 4692] execve("/etc/dev.d/default/log.dev", ["./udev", "block"], [/* 41 vars */]) = 0
this the new one:
[pid 9832] execve("/etc/dev.d/default/log.dev", ["/etc/dev.d/default/log.dev", "block"], [/* 41 vars */]) = 0
|
|
when udevstart was running we didn't set the environment and the
subsystem argument for the callouts the dev.d/ scripts.
Here is a fix, that sets that with every udevstart iteration, corrects
argv[0] to be the basename() only not the whole path and adds a test
for invoking callouts without arguments.
|
|
selinux wants a clean fd set, so better close all open fds
|
|
There is a bug parsing PROGRAMs after apostrophes. Try PROGRAM="/bin/echo 'test test".
|
|
On Mon, 2004-09-13 at 01:56 +0200, Marco d'Itri wrote:
> Starting from udev 031, the %-arguments passed to PROGRAMs are not
> correct when the new udevstart code is being used.
>
> KERNEL="event[0-9]*", NAME="input/%k", PROGRAM="/etc/udev/inputdev.sh %k %n %M %m", RESULT="inputdev", MODE="0664", GROUP="video"
>
> generates this log (just echo $*):
>
> event0 0 13 64
> event0 0 13 64
> event0 0 13 64
>
> while the correct log (generated using the old shell script instead of
> udevstart) would be:
>
> event0 0 13 64
> event1 1 13 65
> event2 2 13 66
Yes, I can simulate this, please try the attached patch. I expect, that
it fixes it, cause we better not mangle the parsed config while matching
the rules.
|
|
On Mon, 2004-09-06 at 17:45 +0200, Kay Sievers wrote:
> On Mon, 2004-09-06 at 16:46 +0200, David Zeuthen wrote:
>
> Nice, I like it. It's a easy way to group device nodes of the same type,
> but coming from different kernel subsystems.
>
That's a good way of putting it, yeah.
> > Here's a patch against udev-030 that can help create compatibility
> > symlinks like /dev/cdrom, /dev/cdrom1 etc. The patch introduces a new
> > substitution type %C (for Compatibility) that can be used as follows
>
> I suggest using %e for enumeration here, cause "compatibility" can
> easily be misunderstood.
>
Good point, I've changed that.
> And we need a few lines added to the man page at udev.8.in :)
>
Done. I've also added an example.
Also, Kay pointed out offlist that the rules can be written to not
require a shell script; this actually works
KERNEL="sr*", NAME="%k", SYMLINK="cdrom%e"
KERNEL="scd*", NAME="%k", SYMLINK="cdrom%e"
KERNEL="pcd*", NAME="%k", SYMLINK="cdrom%e"
KERNEL="hd[a-z]", PROGRAM="/bin/cat /proc/ide/%k/media", RESULT="cdrom", NAME="\%k", SYMLINK="cdrom%e"
KERNEL="fd[0-9]", NAME="%k", SYMLINK="floppy%e"
KERNEL="hd[a-z]", PROGRAM="/bin/cat /proc/ide/%k/media", RESULT="floppy", NAME=\"%k", SYMLINK="floppy%e"
New patch is attached.
David
|
|
|
|
I noticed a comment in namedev.c which stated
"Figure out where the device symlink is at. For char devices this will
always be in the class_dev->path. But for block devices, it's
different. The main block device will have the device symlink in it's
path, but all partitions have the symlink in its parent directory. But
we need to watch out for block devices that do not have parents, yet
look like a partition (fd0, loop0, etc.). They all do not have a device
symlink yet. We do a sit and spin on waiting for them right now, we
should possibly have a whitelist for these devices here..."
I went ahead and created a whitelist for the block devices that look
like partitions (mainly by using devices.txt) and tested for any
performance increase that we would see. The whitelist only impacts
udevstart time depending on the state of UDEV_NO_SLEEP. Since the list
was short, I just did a sequential search and ordered the list in such a
way that those block devices which have more /dev entires (ex. loop0,
loop1, loop2, etc) appear sooner in the list and will thus be found
quicker. I've enclosed the patch and some of the performance results I
saw below. Basically, as the number of block devices without device
symlinks increased, the use of the whitelist improved udevstart
performance compared to just sitting and spinning. I just thought it
was interesting and thought I'd share. If you feel the patch is
beneficial please consider for merging. Also, if you'd be interested in
expanding the whitelist for other devices which are missing device
symlinks and seeing if there are added performance increases let me know
and I'll do what I can. Thanks,
Leann
Note: ex. loop represents all the loop devices (i.e. loop0, loop1,
loop2, etc)
block devices present with whitelist time
|
|
Our own implementation of the sysinfo system call is no longer
needed, cause it's merged it into klibc now.
|