summaryrefslogtreecommitdiff
path: root/udev_lib.c
AgeCommit message (Collapse)Author
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] 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] PATCH udev close on execharald@redhat.com
selinux wants a clean fd set, so better close all open fds
2005-04-26[PATCH] fix handle leak in udev_lib.cfork0@users.sf.net
There is a handle leak in failure path in file_map, and the result of file_map (or the result of the caller of the file_map) is not always checked.
2005-04-26[PATCH] udev default config layout changeskay.sievers@vrfy.org
Here we catch up, after the default config changes. o the man page is updated to reflect the new default config o /etc/udev/rules.d/ + permissions.d/ dirs are created now o udev.rules is installed in /etc/udev/rules.d/50-udev.rules so the user can easily order the files by prepending a number. (RedHat has the same name in the last rpm.) o defined directory names in the Makefile are all without slashes now, not the first half with and the remaining without. o all binaries are uninstalled now o leading slashes in config values are now removed or prepended while the config is parsed, so we are more robust if the usere changes something. o replaced the macros from udev_config.c with real code, cause we can skip if the value matches and not useless iterate over the remaining fields. o config parsing errors are logged with info() now, fixes the bug where we report a error with debug_parse(), even when there isn't one
2005-04-26[PATCH] DEVNODE -> DEVNAME transition fixessjoerd@spring.luon.net
It seems that the transition from DEVNODE to DEVNAME wasn't done everywhere. This broke udev_dbus for me. Attached patch does the transition in the places it wasn't done yet.
2005-04-26[PATCH] udevinfo patchkay.sievers@vrfy.org
On Fri, Mar 26, 2004 at 06:36:32PM +0500, Ananth N Mavinakayanahalli wrote: > On Fri, Mar 26, 2004 at 11:24:39AM +0100, Kay Sievers wrote: > > On Fri, Mar 26, 2004 at 11:21:29AM +0500, Ananth N Mavinakayanahalli wrote: > > > On Fri, Mar 26, 2004 at 04:47:35AM +0100, Kay Sievers wrote: > > > > On Fri, Mar 26, 2004 at 01:26:46AM +0100, Carl-Daniel Hailfinger wrote: > > > > > Greg KH wrote: > > > > > > On Tue, Mar 23, 2004 at 01:51:01PM -0800, Daniel Stekloff wrote: > > > > > > > > No, it breaks the net device handling. I think we should change > > > > libsysfs instead, not to return a class device for '/block', if > > > > we want to fix it. > > > > > > /sys/block is considered a sysfs "class" and not a class_device. So, > > > going by udevinfo's help, -p expects path to a class_device and _not_ > > > a class itself and hence option /sys/block with -p is not a valid query. > > > > > > Kay? > > > > Yes, it's invalid, but we shouldn't print major minor for a invalid > > path. sysfs_open_class_device_path("/block") returns a device. If this is > > the right behavior for libsysfs, I will change the get_device_type("/block") > > not to return a 'b'-type. > > Libsysfs validates the path given to it for opening a class_device to be > a valid directory; it does not however validate if the path is a valid > class_device path. So, in the case of udevinfo, a 'b' type should not > be returned if the path is just /sys/block or /sys/block/ This may prevent it.
2005-04-26[PATCH] dev_d.c file sorting and cleanupkay.sievers@vrfy.org
On Thu, Mar 25, 2004 at 02:52:13AM +0100, Kay Sievers wrote: > Please have look if it still works for you, I only did a very quick > test. Here is a unified version, with all the functions moved to udev_lib.c. We have a generic function now, to call a given fnct(char *) for every file ending with a specific suffix, sorted in lexical order. We use it to execute the dev.d/ files and read our rules.d/ files. The binary should be a bit smaller now. I've also changed it, to not do the dev.d/ exec for net devices.
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] add get_devnode() helper to udev_lib for udev_dbus programgreg@kroah.com
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.