Age | Commit message (Collapse) | Author |
|
Handle all events with rules. If udev is expected to handle hotplug.d/
the exernal helper must be called.
Signed-off-by: Kay Sievers <kay.sievers@suse.de>
|
|
Patch from: Dan Walsh <dwalsh@redhat.com>
|
|
> On Mon, 2005-04-11 at 14:55 +0200, Norbert Preining wrote:
> > On Mon, 11 Apr 2005, Kay Sievers wrote:
> > > > brw-rw---- 1 root root 8, 0 2005-04-10 14:58 /dev/sdcard
> > > > brw-rw---- 1 root root 8, 1 2005-04-10 14:58 /dev/sdcard1
> > > > brw-rw---- 1 root root 8, 1 2005-04-10 14:58 /dev/sdcard2
> > > > brw-rw---- 1 root root 8, 1 2005-04-10 14:58 /dev/sdcard3
> > >
> > > This looks broken.
> >
> > Good to hear.
Yeah, I guess it's broken. In create_node() in udev_add.c there is
always added 1 to the minor number, thus the error. The attached patch
should fix this.
|
|
SUBSYSTEM=="block", RUN="/sbin/program"
will execute the program only for block device events.
ACTION="remove", SUBSYSTEM=="block", RUN"/sbin/program"
will execute the program, if a block device is removed.
|
|
|
|
Thanks to Jim Gifford <maillist@jg555.com> for catching it.
|
|
|
|
|
|
|
|
|
|
|
|
The new libsysfs and klibc don't need that anymore.
Wrap getpwnam(), so we can use the built-in /etc/passwd
parser for statically compiled glibc binaries too.
|
|
|
|
|
|
|
|
Here is a fix for the SELinux part of udev.
Setfscreatecon() overrides the default labeling behavior of SELinux when
creating files, so it should only be used for as short of a time as
possible, around the mknod or symlink calls. Without this, the files in
udev_db get the wrong label because the fscreatecon is reset after the
udev_db file creation instead of before. I'm guessing the Redhat people
missed this because they modify udev_db to be one big file instead of a
directory of small files (at least that's what I'm told). I created
selinux_resetfscreatecon() to reset the fscreatecon asap after the
file/node is created.
Fixed a memory leak in selinux_init. Getfscreatecon() allocates memory
for the context, and the udev code was immediately setting the pointer
(security_context_t is actually a typedef'ed char*) to NULL after the
call regardless of success/failure. If you're wondering about the case
where there's effectively a setfscreatecon(NULL), this is ok, as its
used to tell SELinux to do the default labeling behavior.
Renamed selinux_restore() to selinux_exit() due to the changed behavior.
Fixed a couple of dbg() messages.
|
|
|
|
|
|
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).
|
|
|
|
|
|
%N will create a temporary node for a callout a be sustituted with the
name of the node.
|
|
Move code into a .c-file instead of big inline functions in a header file.
Pass the device name down instead of relying that the node name is equal
to the kernel name.
|
|
|
|
If we take over the hotplug call and manage the events we don't need
to call the event fake script in dev.d/. Just set all expected values
to the new network interface name and call hotplug.d/. This way the
device renaming is completely handled inside of udev and userspace
can't get confused.
|
|
We have only one source of permissions now, so apply the default
permissions at udev init.
|
|
|
|
|
|
Move the logic when and how to call the dev.d/ scripts into the
main processing path.
|
|
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.
|
|
|
|
We once implemented the devfsd feature to set the owner of a device node
to the "local" user. This was before we had the dev.d/ scripts. We discussed
a similar issue with D-BUS recently and this should be better handled depending
on the distributions way to do such a thing.
I'm for removing this here as this can be easily covered by a dev.d/
script.
Here is the patch if nobody objects :)
|
|
Here we supress the dev.d/ execution if we didn't change a network
interface's name with a rule. This should solve the issue of two
running dhclients for the same interface, cause the
/etc/dev.d/net/hotplug.dev script that fakes the hotplug event runs
with every udevstart for every interface and fakes a second identical
hotplug event on bootup.
With this patch netif interfaces are no longer stored in the udevdb.
It is not needed, cause we don't have permissions or symlinks :) and
all information is available in sysfs.
This patch also moves the dev_d execution calls out of the
udev_add/udev_remove. As with the former api-cleanup-patch we have
all processed data in one udev struct and can place the execution
calls where needed.
|
|
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.
|
|
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()
|
|
We should be consistent in our madness...
|