summaryrefslogtreecommitdiff
path: root/udev.h
AgeCommit message (Collapse)Author
2005-04-26[PATCH] remove default_* permissions from udev.conf filekay.sievers@vrfy.org
With the "permissions only rules" we can just place: MODE="0660", OWNER="root", GROUP="root" at the beginning of the rules file and get exactly the same behavior. If no values are given the compiled-in defaults are used.
2005-04-26[PATCH] allow multiline rules by backslash at the end of the linekay.sievers@vrfy.org
On Sun, 2004-12-19 at 18:31 +0100, Marco d'Itri wrote: > > On Dec 19, Kay Sievers <kay.sievers@vrfy.org> wrote: > > > (Feature request: would it be possible to extend the rules files parser > > to support continuation lines? I'd like it to consider lines starting > > with white space as part of the previous line.) > > How about the usual backslash at the end of the line. Here is a simple > patch.
2005-04-26[PATCH] complete removal of explicit udev permissions config filekay.sievers@vrfy.org
2005-04-26[PATCH] remove unused timestamp fieldkay.sievers@vrfy.org
2005-04-26[PATCH] simplify permission handlingkay.sievers@vrfy.org
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.
2005-04-26[PATCH] trivial cleanups and change some commentskay.sievers@vrfy.org
2005-04-26[PATCH] remove unused variableskay.sievers@vrfy.org
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().
2005-04-26[PATCH] don't call the hotplug scripts with a test runkay.sievers@vrfy.org
2005-04-26[PATCH] rename udev_lib to udev_utils and dev_d to udev_multiplexkay.sievers@vrfy.org
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] add NAME{ignore_remove} attributekay.sievers@vrfy.org
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.
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] 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] 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] 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] 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] switch udev's seqnum to u64kay.sievers@vrfy.org
The kernel will use a u64 for the sequence number, so we want the same.
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] udev - read long lines from config files overflow fixarun@codemovers.org
Hi Kay, On 23:12 Sat 04 Sep , Kay Sievers wrote: > Cool, a real bug :) > Thanks, for the patch. I think it would be better to skip lenghth exceeding > lines instead of cutting it and continue. While looking at it I restructured > the buffer reading logic a bit and fixed another stupid bug. Thanks for the cleanup. You may have overlooked the fix for udev_config.c(parsing udev.conf) in your patch. So, I've adapted the fixes you applied to namedev_parse.c to this file also. Also, while 'eating' the whitespace the 'count' doesn't get decremented. This leads strncpy to copy the number of whitespace minus 1 characters from the next line. Minus 1 because it copies '\n' from the current line. while (isspace(bufline[0])) { bufline++; + count--; } . . . strncpy(line, bufline, count); Included patch(against udev-030) contains the above fixes as well as your fixes. Signed-off-by: Arun Bhanu <arun@codemovers.org>
2005-04-26[PATCH] pass SEQNUM trough udevdkay.sievers@vrfy.org
here we change udevd to pass the SEQNUM from the hotplug environment to udev and the dev.d/ scripts. We need this for HAL to match the hotplug event with the dev.d/ events. It also changes the type from int to long to match the kernel.
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] 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] netdev - udevdb+dev.d changeskay.sievers@vrfy.org
Here is a patch to change the netdev handling in the database and for the dev.d/ calls. I applies on top of the udevd.patch, cause klibc has no sysinfo(). o netdev's are also put into our database now. I want this for the udevruler gui to get a list of all handled devices. All devices in the db are stamped with the system uptime value at the creation time. 'udevinfo -d' prints it. o the DEVPATH value is the key for udevdb, but if we rename a netdev, the name is replaced in the kernel, so we add the changed name to the db to match with the remove event. NOTE: The dev.d/ scripts still get the original name from the hotplug call. Should we replace DEVPATH with the new name too? o We now only add a device to the db, if we have successfully created the main node or successfully renamed a netdev. This is the main part of the patch, cause I needed to clean the retval passing trough all the functions used for node creation. o DEVNODE sounds a bit ugly for netdev's so I exported DEVNAME too. Can we change the name? o I've added a UDEV_NO_DEVD to possibly skip the script execution and used it in udev-test.pl. udevstart is the same horror now, if you have scripts with logging statements in dev.d/ it takes minutes to finish, can we skip the scripts here too? o The get_device_type() function is changed to be more strict, cause 'udevinfo -a -p /block/' gets a class device for it and tries to print the major/minor values. o bugfix, the RESULT value has now a working newline removal and a test for this case.
2005-04-26[PATCH] add /etc/dev.d/ support for udev add and remove events.greg@kroah.com
2005-04-26[PATCH] first stupid try for a rule compose guikay.sievers@vrfy.org
On Mon, Mar 15, 2004 at 09:28:17PM +0100, Kay Sievers wrote: > Here is a first simple and pretty stupid try to make a simple tool for > composing of a udev rule. > > It reads the udevdb to get all currently handled devices and presents a > list, where you can choose the device to compose the rule for. > > The composed rule is just printed out in a window, nothing else by now. > > Do we want something like this? > Nevermind, I always wanted to know, how this newt thing works :) Here is the next step, I still can't sleep and there are to many patches pending to make something useful :) Cause nobody wanted to play with me, I've made a screenshot. The device list is sorted in alphabetical order now and if there are only a few recently discovered devices, they are placed on top of the list. For those who want to have a look: http://vrfy.org/projects/udev/udevruler.png The patch applies on top of today's mmap() patch. The db format is changed to have the file and line number of the applied rule. So it should be easy to edit the matching rule with this beast. It compiles with "make all udevruler".
2005-04-26[PATCH] Increase the name size as requested by Richard Gooch ↵greg@kroah.com
<rgooch@ras.ucalgary.ca>
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] rename strn*() macros to strmaxkay.sievers@vrfy.org
Hey, I wrote the strn*() macros just 10 days ago and yesterday this trap caught me with the %c{x} bug. The names are misleading cause we all expect that the from field is limited by the size argument, but we actually limit the overall size of the destination string to prevent a overflow. Here we rename all strn*() macros to str*max(). That should be more self-explanatory.
2005-04-26[PATCH] better fix for NAME="foo-%c{N}" gets a truncated namekay.sievers@vrfy.org
On Wed, Mar 03, 2004 at 04:56:34PM -0800, Greg KH wrote: > On Wed, Mar 03, 2004 at 03:57:04PM -0800, Patrick Mansfield wrote: > > > > Here is a patch for some new tests. > > Applied, thanks. Here is a small improvement, which looks much better. Hey Pat, thanks a lot for finding the recent bug, hope this one will not break it again :)
2005-04-26[PATCH] cleanup mult field string handlingkay.sievers@vrfy.org
Here I try to cleanup our various multifield iteration over the strings. Inspired by our nice list.h we now have a macro to iterate over the string and process the parts of it: It makes the code more readable and we don't change the string while we process it like the former strsep() does. Example: foreach_strpart(dev->symlink, " ", pos, len) { if (strncmp(&dev->symlink[pos], find_name, len) != 0) continue; ... } For the callout part selector %c{2} we separate now not only by space but also newline and return characters, cause some programs may give multiline values back. A possible RESULT match must contain wildcards for these characters. Also a bug in the recent udevinfo symlink query feature is fixed.
2005-04-26[PATCH] udev - safer sprintf() usekay.sievers@vrfy.org
Here is for now my last patch to the string handling for a rather theorethical case, where the node is very very very long. :) We have accordant to strfieldcat(to, from) now a strintcat(to, i) macro, which appends the ascii representation of a integer to a string in a safe way.
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 - safer string handling - part twokay.sievers@vrfy.org
As promised, here is the next round. We provide in addition to the already used macros: strfieldcpy(to, from) strfieldcat(to, from) the corresponding friends, if the size of the target is not known and must be provided by the caller: strnfieldcpy(to, from, maxsize) strnfieldcat(to, from, maxsize) and switch nearly all possibly unsafe users of strcat(), strncat(), strcpy() and strncpy() to these safer macros. The last known remaining issue seems the use of sprintf() and snprintf(). I will take on it later today or tomorrow.
2005-04-26[PATCH] udev - safer string handling all over the placekay.sievers@vrfy.org
On Tue, Feb 24, 2004 at 11:50:52PM +0100, Kay Sievers wrote: > Here is the first step towards a safer string handling. > More will follow, but for now only the easy ones :) > > Thanks to all who pointed this out. strncat() isn't a nice function. We > all should remember that the destination string is not terminated if the > given lenght is shorter than the strlen of the source string. > > And shame on the various implementers of strfieldcat() I found in the > unapplied patches on this list, it's not really better than strncpy() > and hides the real problem. Hmm, bk didn't checked in one file, maybe I edited it again as root. Nevermind, here is the more complete version.
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 support for UDEV_NO_SLEEP env variable so Gentoo people will be ↵greg@kroah.com
happy. Actually, I'm happy to, startup time is much smaller...
2005-04-26[PATCH] udev - create all partitions of blockdevicekay.sievers@vrfy.org
Here is the first try to create all partitons of a blockdevice, since removable media devices may need to acces the expected partition to revalidate the media. It uses the attribute syntax introduced with the last %s{file} patch. I'm using this with my multi-slot-flash-card-reader: SYSFS{model}="USB Storage-SMC ", NAME{all_partitions}="smartmedia" SYSFS{model}="USB Storage-CFC ", NAME{all_partitions}="compactflash" SYSFS{model}="USB Storage-MSC ", NAME{all_partitions}="memorystick" SYSFS{model}="USB Storage-MMC ", NAME{all_partitions}="multimedia" and I get: tree /udev/ /udev/ |-- memorystick |-- memorystick1 |-- memorystick10 |-- memorystick11 |-- memorystick12 |-- memorystick13 |-- memorystick14 |-- memorystick15 |-- memorystick2 |-- memorystick3 |-- memorystick4 |-- memorystick5 |-- memorystick6 |-- memorystick7 |-- memorystick8 |-- memorystick9 |-- multimedia |-- multimedia1 |-- multimedia10 |-- multimedia11 |-- multimedia12 |-- multimedia13 |-- multimedia14 |-- multimedia15 |-- multimedia2 |-- multimedia3 |-- multimedia4 |-- multimedia5 |-- multimedia6 |-- multimedia7 |-- multimedia8 |-- multimedia9 ... If needed, we can make the number of partions to create adjustable with the attribute?
2005-04-26[PATCH] udev - keep private data out of the database?kay.sievers@vrfy.org
Shouldn't we keep the temporary strings out of the database, or is this information useful for something? It cuts the length of the data from 628 to 275 bytes.
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.
2005-04-26[PATCH] stop using mode_t as different libcs define it in different ways :(greg@kroah.com
2005-04-26[PATCH] fix log option code so that it actually works for all udev programs.greg@kroah.com
Also introduce boolean type for config file to use.
2005-04-26[PATCH] make logging a config optionazarah@nosferatu.za.org
Once again, patch to make logging a config option. Reason for this (since you asked for it): - In our setup it is easy (although still annoying) .. just edit the ebuild, add logging support (or remove it) and rebuild. For say a binary distro, having the logging is useful for debugging some times, but its more a once of, or rare thing, as you do not add or change config files every day. Sure, we can have logging by default, but many do not want ~300 lines of extra debugging in their logs is not pleasant, and they will complain. Rebuilding the package for that binary package (given the users it is targeted to) is usually not within most users grasp.
2005-04-26[PATCH] move get_pair to udev_config.c because udevinfo doesn't need all of ↵greg@kroah.com
namedev.o
2005-04-26[PATCH] set default owner/group in db - updatekay.sievers@vrfy.org
I've edited the man page today, so this is alreay included :) Also a few more trivials: o added the defaults to udev.conf.in o removed class_dev from get_default_mode(), to match with Hanna's o changed size of mode_str to MODE_SIZE o changed a few char compares from from 0x00 to '\0'
2005-04-26[PATCH] set default owner/group in db.hannal@us.ibm.com
This patch fixes a bug where the udev database stored empty strings for Owner and Group if they were default. This patch stores the default value into the database if not set otherwise. See example output: crw------- 1 root root 4, 65 Jan 16 11:13 ttyS1 P: /class/tty/ttyS1 N: ttyS1 S: O: root G: root This is a bit of a hack. However, until udev supports setting the o/g values they will be root/root anyway so the database might as well reflect the truth instead of empty strings.