summaryrefslogtreecommitdiff
path: root/udevstart.c
AgeCommit message (Collapse)Author
2006-01-09replace libsysfsKay Sievers
We never used any of the libsysfs convenience features. Here we replace it completely with 300 lines of code, which are much simpler and a bit faster cause udev(d) does not open any syfs file for a simple event which does not need any parent device information. Signed-off-by: Kay Sievers <kay.sievers@suse.de>
2005-12-17add DEVLINKS to the event environmentKay Sievers
Multiple symlinks are separated by a space character. Signed-off-by: Kay Sievers <kay.sievers@suse.de>
2005-11-12remove all built-in wait_for_sysfs logicKay Sievers
Most of the issues are fixed with the kernel we depend on, for the remaing ones see the RELEASE-NOTES for a special rule to add. Signed-off-by: Kay Sievers <kay.sievers@suse.de>
2005-11-05remove precompiled rules optionKay Sievers
It was a workaround for speed up udev "coldplug", where ~800 events happened a second time during bootup. No need for it with the rules aleady parsed in the daemon. Signed-off-by: Kay Sievers <kay.sievers@suse.de>
2005-11-02use libsysfs to translate the class linke to the device pathKay Sievers
Signed-off-by: Kay Sievers <kay.sievers@suse.de>
2005-08-15cleanup some debug output and move to info level + unify select() loopsKay Sievers
Signed-off-by: Kay Sievers <kay.sievers@suse.de>
2005-08-13fix udevstart event ordering, we want /dev/null very earlyKay Sievers
2005-08-11allow logging of all output from executed toolsKay Sievers
If USE_DEBUG=true and udev_log="debug", all output of the forked programs to stdout and stderr is send to syslog. Signed-off-by: Kay Sievers <kay.sievers@suse.de>
2005-08-11update SUSE rulesKay Sievers
Signed-off-by: Kay Sievers <kay.sievers@suse.de>
2005-08-08add flag for reading of precompiled rulesKay Sievers
Rules can be precompiled and stored on disk for initramfs, to avoid parsing the rules with every event again and again. Also the OWNER and GROUP names are already resolved to numerical values in the compiled rules. This flag is used for the upcoming move of the rules parsing into udevd: If the real root is mounted udevd is started and parses the rules only once. The event processes will inherit the already parsed rules from the daemon, so we want to ignore any precompiled rules and use the real rules files and watch the filesystem for changes to reload the rules automatically. Signed-off-by: Kay Sievers <kay.sievers@suse.de>
2005-08-01allow RUN to send the environment to a local socketKay Sievers
RUN="socket:<name>" will send the environment in the kernel uevent format to the named destination. Using the socket instead of the program to pass the hotplug events to the HAL daemon, cuts down the running time of udevstart from 0.8 to 0.4 seconds on my box. env -i ACTION=add DEVPATH=/block/hda/hda1 strace -s10000 ./udev block sendto(3, "add@/block/hda/hda1\0 ACTION=add\0DEVPATH=/block/hda/hda1\0UDEV_LOG=3\0 ID_TYPE=disk\0ID_MODEL=HTS726060M9AT00\0ID_SERIAL=MRH401M4G6UM9B\0 ID_REVISION=MH4OA6BA\0ID_BUS=ata\0ID_PATH=pci-0000:00:1f.1-ide-0:0\0 ID_FS_USAGE=other\0ID_FS_TYPE=swap\0ID_FS_VERSION=2\0 ID_FS_UUID=9352cfef-7687-47bc-a2a3-34cf136f72e1\0 ID_FS_LABEL=ThisIsSwap\0ID_FS_LABEL_SAFE=ThisIsSwap\0 DEVNAME=/dev/hda1\0" Signed-off-by: Kay Sievers <kay.sievers@suse.de>
2005-07-22move code to its own filesKay Sievers
Signed-off-by: Kay Sievers <kay.sievers@suse.de>
2005-07-06rename ALARM_TIMEOUT to UDEV_ALARM_TIMEOUTKay Sievers
Signed-off-by: Kay Sievers <kay.sievers@suse.de>
2005-07-05pack parsed rules listKay Sievers
This cuts down our 600 rules file to 98 kb instead of 1.9 Mb memory or file-size with precompiled rules. Signed-off-by: Kay Sievers <kay.sievers@suse.de>
2005-07-02[PATCH] Keep udevstart from skipping devices without a 'dev' fileKay Sievers
2005-06-26store the imported device information in the udevdbKay Sievers
Any program can query with udevinfo for persistent device attributes evaluated on device discovery now. Signed-off-by: Kay Sievers <kay.sievers@suse.de>
2005-06-25unify execute_command() and execute_program()Kay Sievers
Signed-off-by: Kay Sievers <kay.sievers@suse.de>
2005-06-08udevd: allow starting of udevd with stopped exec-queueKay Sievers
Signed-off-by: Kay Sievers <kay.sievers@suse.de>
2005-06-05udev: handle all events - not only class and block devicesKay Sievers
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>
2005-06-05udev: move dev.d/ handling to external helperKay Sievers
Modern rules are expected to call notification and postprocessing with the RUN key. For compatibility the current behavior can be emulated with an external helper. Signed-off-by: Kay Sievers <kay.sievers@suse.de>
2005-04-26[PATCH] export DEVNAME to RUN-key executed programskay.sievers@vrfy.org
2005-04-26[PATCH] add RUN key to be able to run rule based notificationkay.sievers@vrfy.org
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.
2005-04-26[PATCH] move execute_program to utils + add action to init_devicekay.sievers@vrfy.org
2005-04-26[PATCH] support log-priority levels in udev.confkay.sievers@vrfy.org
2005-04-26[PATCH] rename namedev_dev to udev_rulekay.sievers@vrfy.org
2005-04-26[PATCH] rename device_list->list to device_list->nodekay.sievers@vrfy.org
2005-04-26[PATCH] replace strncpy()/strncat() by strlcpy()/strlcat()kay.sievers@vrfy.org
2005-04-26[PATCH] split udev and udevstartkay.sievers@vrfy.org
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] 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] 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] fix problems using scsi_id with udevstartkay.sievers@vrfy.org
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.
2005-04-26[PATCH] PATCH some cleanups and security fixesharald@redhat.com
posted by Steve Grubb on https://bugzilla.redhat.com/bugzilla/show_bug.cgi?id=130351
2005-04-26[PATCH] add a "first" list to udevstart and make it contain the class/mem/ ↵greg@kroah.com
devices Seems some programs really want /dev/null to work properly :)
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] fix stupid off-by-one bug that caused udevstart to die on x86-64 boxes.greg@kroah.com
2005-04-26[PATCH] fix dumb bug I added to udevstartgreg@kroah.com
2005-04-26[PATCH] make a "last list" of devices for udevstart to operate on last.greg@kroah.com
Should fix the dm startup issues, hopefully...
2005-04-26[PATCH] reverse order of scanning of udevstart to look at class before block.greg@kroah.com
this should fix the startup issue for lvm, hopefully...
2005-04-26[PATCH] udevstart: close open directories.greg@kroah.com
Based on a munged patch from Olaf Hering <olh@suse.de>
2005-04-26[PATCH] udevstart fixkay.sievers@vrfy.org
Sorry, udevstart needs a small cleanup after my recent copy/pastes.
2005-04-26[PATCH] DEVPATH for netdevkay.sievers@vrfy.org
Here we change the DEVPATH for netdev's in the environment of the dev.d/ scripts to the name the device is renamed to. The original name doesn't exist in the kernel after rename.
2005-04-26[PATCH] udevd race conditions and performance, assorted cleanupschris_friesen@sympatico.ca
This patch covers a number of areas: 1) sysfs.h is fixed up to use the common dbg() macro. This fixes the case where DEBUG is defined but USE_LOG isn't. 2) udevstart.c is modified to include the proper headers, rather than getting them indirectly which can break depending on Makefile flags 3) udevd.c gets some major changes: a) I added a pipe from the signal handler. This fixes the race conditions that I mentioned earlier. Basically, the point of the pipe is to force the select() call to return immediately if a signal handler fired before we actually started the select() call. This then lets us run the appropriate code based on flags set in the signal handler proper. b) I added a number of flags to coalesce calls to common routines. This should make things slightly more efficient. c) since most calls will tend to come in with a sequence number larger than what has been received, I switched msg_queue_insert() to scan the msg_list backwards to improve performance. filename="udevd.diff"
2005-04-26[PATCH] udevstart fixesmd@Linux.IT
udevstart_no_retval: currently udevstart will always return rc=22 because of the error handling code. I completely removed it because it is not used, and returning a generic error to the init script is not much useful anyway.
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.