summaryrefslogtreecommitdiff
path: root/udev.c
AgeCommit message (Collapse)Author
2005-04-26[PATCH] use blacklist on device "remove" and remove dev.d/ call code duplicationkay.sievers@vrfy.org
2005-04-26[PATCH] don't call the hotplug scripts with a test runkay.sievers@vrfy.org
2005-04-26fixups to get back to proper patch orderGreg KH
Damm, it's hard to merge a multi-line tree into one flat line at times...
2005-04-26[PATCH] don't call dev.d/ scripts twice, if directory = subsystemkay.sievers@vrfy.org
The /etc/dev.d/input/input.dev was called twice for /dev/input/mouse. Skip the execution if we get a directory named after the subsystem. Move UDEV_NO_DEVD where it belongs.
2005-04-26[PATCH] rename udev_lib to udev_utils and dev_d to udev_multiplexkay.sievers@vrfy.org
2005-04-26[PATCH] fix spurious valgrind warning in udev.greg@kroah.com
2005-04-26[PATCH] DEVNAME on device removalsjoerd@spring.luon.net
I just noticed that the DEVNAME enviroment variable isn't being set anymore in udev 0.046 on device removal, while it was being set in 0.042. We're using the property tto do umount -l <devices> when a block device is removed. Afaik there is no other way to associate a device with it's DEVNAME on removal ? Also are there cases where doing umount -l on the removed devices is wrong? I guess the device is gone, so there is no sense in keeping it mounted (it's not like the filesystem is gonna come back in a sane state again).. Attached (trivial) patch brings back the DEVNAME variable on device removal.
2005-04-26[PATCH] handle whole hotplug event with udevd/udevkay.sievers@vrfy.org
If /proc/sys/kernel/hotplug points to /sbin/udevsend we handle the whole hotplug event with multiplexing /etc/hotplug.d/.
2005-04-26[PATCH] integrate wait_for_sysfs in udevkay.sievers@vrfy.org
Move the wait_for_sysfs logic into the udev binary. udev is called for every hotplug event. It also waits for /devices events.
2005-04-26[PATCH] export DEVNAME on remove eventkay.sievers@vrfy.org
Fix from Sjoerd Simons <sjoerd@spring.luon.net>, it got lost on the recent reorganization of the udev processing stages.
2005-04-26[PATCH] export udev_log flag to the environmentkay.sievers@vrfy.org
Forked scripts and callouts may want to follow udev's configured behavior and log only if udev is logging itself.
2005-04-26[PATCH] disable logging for udevstartkay.sievers@vrfy.org
The slow logging facilites on some systems are a reason for the reported slowness of udevstart. On one of my boxes udevstart is down from 9 second to 0.3 seconds.
2005-04-26[PATCH] rename udevdb* to udev_db*kay.sievers@vrfy.org
2005-04-26[PATCH] Make dev.d/ handling a separate processing stagekay.sievers@vrfy.org
Move the logic when and how to call the dev.d/ scripts into the main processing path.
2005-04-26[PATCH] make the udev object available to more processing stageskay.sievers@vrfy.org
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.
2005-04-26[PATCH] add ACTION to udev object to expose it to the whole processkay.sievers@vrfy.org
2005-04-26[PATCH] let udev act as udevstart if argv[1] == "udevstart"kay.sievers@vrfy.org
"udev udevstart" will run udev as udevstart. This makes it easier to run a test in the source tree without the need to create a symlink.
2005-04-26[PATCH] replace tdb database by simple lockless file databasekay.sievers@vrfy.org
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.
2005-04-26[PATCH] Don't use any syslog() in signal handler, cause it may deadlock.kay.sievers@vrfy.org
2005-04-26[PATCH] Remove the last klibc specific line from the main udev codekay.sievers@vrfy.org
2005-04-26[PATCH] expose sysfs functions for sharing itkay.sievers@vrfy.org
This patch exposes the wait_for_sysfs functions to all possible users, so we need to maintain only one list of exceptions. The last list is hereby removed from udev.c.
2005-04-26[PATCH] sparse cleanups on the treegreg@kroah.com
2005-04-26[PATCH] cleanup netif handling and netif-dev.d/ eventskay.sievers@vrfy.org
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.
2005-04-26[PATCH] big cleanup of internal udev apikay.sievers@vrfy.org
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.
2005-04-26[PATCH] close the syslogkay.sievers@vrfy.org
Seems that we never closed the opened syslog. Here is a patch to do this in all our binaries.
2005-04-26[PATCH] move assignments past local variablespatmans@us.ibm.com
I'm using an older C compiler, and it doesn't like assignments mixed with declarations, but this is also a style cleanup.
2005-04-26[PATCH] remove sleeps from udev as it is external nowkay.sievers@vrfy.org
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.
2005-04-26[PATCH] Fix build error with klibc due to recent changes.greg@kroah.com
2005-04-26[PATCH] mergegreg@kroah.com
2005-04-26[PATCH] fix asmlinkagembuesch@freenet.de
This patch fixes the reintroduced bug with the sig_handler(), if we link against a -mregparm=3 compiled klibc on i386. It also fixes some compiler warnings about redefined asmlinkage on some systems. Also some (broken?) compilers on distros throw out warnings if asmlinkage is before "static void". This fixes it, too.
2005-04-26[PATCH] fix incompatible pointer type warningmbuesch@freenet.de
This patch fixes two warning: assignment from incompatible pointer type asmlinkage is the reason for the warning. We can simply cast to avoid it. It also fixes this warning: warning: implicit declaration of function `umask'
2005-04-26[PATCH] prevent deadlocks on an corrupt udev databasekay.sievers@vrfy.org
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()
2005-04-26[PATCH] handle only block and class deviceskay.sievers@vrfy.org
Fix a stupid logic bug, I introduced with the udev.c simplification. We want to look at class and block devices only.
2005-04-26[PATCH] Fix naming ethernet devices in udevstartkay.sievers@vrfy.org
On Tue, Sep 07, 2004 at 12:46:43PM +0200, Kay Sievers wrote: > On Mon, 2004-09-06 at 20:18 -0700, Tom Rini wrote: > > I noticed somewhat recently that my enet devices weren't being renamed > > on boot anymore. I don't quite know when this got broken (or rather, if > > it was supposed to be working. I swear it worked for me once..), but > > the following seems to do it. > > I think it never worked in the udevstart case. It worked only with the > hotplug-event-udev, I expect. > > > In udev_scan_class(), look for not just > > %s/%s/dev (which everything with a dev node has), but %s/%s/dev* (both > > of my enet devices, sis900 & 3c59x only have device) and if that > > exists, pass this along to udev. > > Yeah, network devices don't have a devnode and therefore no "dev", but > they are all in /sys/class/net/. We may just test if we are there > instead of the "device" match. How about something like this. It adds all the net devices without looking at the attributes and keeps the remaining logic like it is. It also removes certain levels of indirection and much simplifies the udevstart process. We surely don't need to open and close the udevdb for every node while iterating over the list. (We are about 5% faster on my box) It's not well tested, so it would be nice if someone can have a look at it, before a broken udevstart renders any system unbootable.
2005-04-26[PATCH] fix UDEV_NO_SLEEPtrini@kernel.crashing.org
Move setting UDEV_NO_SLEEP into main(). I thought about moving udev_init_config() around, but it still must be invoked in both udev and udevstart cases, and before udev_hotplug() is called. An alternative would be to have main() do: if (is_udevstart) { ... current ... } else { udev_init_config(); return udev_hotplug(); } And move setting UDEV_NO_SLEEP into udev_start(). I can redo it that way, if you prefer. Signed-off-by: Tom Rini <trini@kernel.crashing.org> Signed-off-by: Greg Kroah-Hartman <greg@kroah.com>
2005-04-26[PATCH] Make udev/udevstart be one binarytrini@kernel.crashing.org
Hi, The following patch makes udev/udevstart be a common binary. First, doing this grows udev by a total of 1.8kB (ppc32, stripped) whereas udevstart by itself is 6.4kB. I know you mentioned being able to replace udevstart with a script, but at 1.8kB I don't think it'll be easy to beat this with size there. Next, the following are by-eye timings of before, after, and with devfs on a slow, but still usable embedded platform (config stripped down to more-or-less bare for ramdisk): -- Embedded Planet RPX LITE, 64Mhz MPC 823e -- devfs : 15.333s, 15.253s, 14.988s (15.191s avg) udev-pristine : 18.675s, 18.079s, 18.418s (18.390s avg) udev-multi : 14.587s, 14.747s, 14.868s (14.734s avg) The patch ends up being rather large to add this, as in doing so I ended up making all refs (that I hit..) to devpath/subsystem be marked as 'const'. Signed-off-by: Tom Rini <trini@kernel.crashing.org> Signed-off-by: Greg Kroah-Hartman <greg@kroah.com>
2005-04-26[PATCH] Add 'asmlinkage' to udev-030trini@kernel.crashing.org
The following patch adds 'asmlinkage' defines to udev, to kill off 2 warnings on !i386. Signed-off-by: Tom Rini <trini@kernel.crashing.org> Signed-off-by: Greg Kroah-Hartman <greg@kroah.com>
2005-04-26[PATCH] fix udevd zombieskay.sievers@vrfy.org
The recent version of klibc switched to -mregparm=3. This broke the signal handlers parameter, cause it is called directly from the kernel with the parameter on the stack not in a register.
2005-04-26[PATCH] hmm, handle net devices with udev?kay.sievers@vrfy.org
Hmm, Arndt Bergmann sent a patch like this one a few weeks ago and I want to bring the question back, if we want to handle net device naming with udev. With this patch it is actually possible to specify something like this in udev.rules: KERNEL="dummy*", SYSFS{address}="00:00:00:00:00:00", SYSFS{features}="0x0", NAME="blind%n" KERNEL="eth*", SYSFS{address}="00:0d:60:77:30:91", NAME="private" and you will get: [root@pim udev.kay]# cat /proc/net/dev Inter-| Receive | Transmit face |bytes packets errs drop fifo frame compressed multicast|bytes packets errs drop fifo colls carrier compressed lo: 1500 30 0 0 0 0 0 0 1500 30 0 0 0 0 0 0 private: 278393 1114 0 0 0 0 0 0 153204 1468 0 0 0 0 0 0 sit0: 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 blind0: 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 The udevinfo program is also working: [root@pim udev.kay]# ./udevinfo -a -p /sys/class/net/private looking at class device '/sys/class/net/private': SYSFS{addr_len}="6" SYSFS{address}="00:0d:60:77:30:91" SYSFS{broadcast}="ff:ff:ff:ff:ff:ff" SYSFS{features}="0x3a9" SYSFS{flags}="0x1003" SYSFS{ifindex}="2" SYSFS{iflink}="2" SYSFS{mtu}="1500" SYSFS{tx_queue_len}="1000" SYSFS{type}="1" follow the class device's "device" looking at the device chain at '/sys/devices/pci0000:00/0000:00:1e.0/0000:02:01.0': BUS="pci" ID="0000:02:01.0" SYSFS{class}="0x020000" SYSFS{detach_state}="0" SYSFS{device}="0x101e" SYSFS{irq}="11" SYSFS{subsystem_device}="0x0549" SYSFS{subsystem_vendor}="0x1014" SYSFS{vendor}="0x8086" The matching device will be renamed to the given name. The device name will not be put into the udev database, cause the kernel renames the device and the sysfs name disappears. I like it, cause it plugs in nicely. We have all the naming features and sysfs queries and walks inside of udev. The sysfs timing races are already solved and the management tools are working for net devices too. nameif can only match the MAC address now. udev can match any sysfs value of the device tree the net device is connected to. But right, net devices do not have device nodes :)
2005-04-26[PATCH] remove dbus code from core udev code as it's no longer needed to be ↵greg@kroah.com
there.
2005-04-26[PATCH] don't init namedev on removekay.sievers@vrfy.org
Is there any reason to parse the rules for a remove event? Without it, our test script needs only 2.1 seconds instead of 2.5, so we have 19 percent more time for testing now :)
2005-04-26[PATCH] replace fgets() with mmap() and introduce udev_lib.[hc]kay.sievers@vrfy.org
Here we replace the various fgets() with a mmap() call for the config file reading, due to the reported performance problems with klibc. Thanks to Patrick's testing, it makes a very small, close to nothing speed gain for libc users, but a 6 times speed increase for klibc users with a 1000 line config file. I've created a udev_lib.[hc] for this and also moved all the generic stuff from udev.h in there and uninlined the functions.
2005-04-26[PATCH] overall trivial trivial cleanupkay.sievers@vrfy.org
Here I try to make the style a bit more consistant in the different files, so that new patches just copy the 'right' one :) Some "magic" numbers are replaced and udevtest.c is catched up with udev.
2005-04-26[PATCH] blacklist pcmcia_socketkay.sievers@vrfy.org
Is this something for the blacklist? /sys/class/pcmcia_socket/ |-- pcmcia_socket0 | |-- device -> ../../../devices/pci0000:00/0000:00:1e.0/0000:02:00.0 | `-- driver -> ../../../bus/pci/drivers/yenta_cardbus `-- pcmcia_socket1 |-- device -> ../../../devices/pci0000:00/0000:00:1e.0/0000:02:00.1 `-- driver -> ../../../bus/pci/drivers/yenta_cardbus
2005-04-26[PATCH] udev - safer string handling - part fourkay.sievers@vrfy.org
Mainly a cleanup of the earlier patches with a few missing pieces and some cosmetical changes. I've moved the udev_init_config() to very early init, otherwise we don't get any logging for the processing of the input. What would I do without gdb :) Greg, it's the 7th patch in your box to apply. I will stop now and wait for you :)
2005-04-26[PATCH] udev - safer string handling - part threekay.sievers@vrfy.org
Here we truncate our input strings from the environment to our defined limit. It's a bit theroretical but better check for it. It cleans up some magic length definitions and removes the code duplication in udev, udevtest and udevsend. udevd needs to be killed after installation, cause the message size is changed with this patch. Should we do this with the 'make install', like we do with the '.udevdb'?
2005-04-26[PATCH] udev - allow all files in a directory as the configkay.sievers@vrfy.org
I was on the train for 5 hours today and the TODO is almost empty :) So, at least four people wanted this feature, then here is a actual working patch. We may specify now in udev.conf: udev_rules="/etc/udev/" and udev will scan the whole directory for files ending with *.rules, sort it in lexical order and create our rule list from all of the files. A plain given file will still work and the same applies to the *.permissions. I sort the files in our usual linked list, cause klibc has no scandir().
2005-04-26[PATCH] force udev to include the internal version of libsysfs and never the ↵greg@kroah.com
external one. Should fix some more build bugs...
2005-04-26[PATCH] udev use new libsysfs header file locationpatmans@us.ibm.com
Use the new location of libsysfs header files.
2005-04-26[PATCH] add udevtest program to buildgreg@kroah.com
Also fix up some other dependancy issues in the Makefile. Thanks to Olaf Hering <olh@suse.de> for pointing them out.