summaryrefslogtreecommitdiff
path: root/udev/udev-rules.c
AgeCommit message (Collapse)Author
2009-01-30fix NAME="" logicKay Sievers
Reported-By: Soh Kam Yung <sohkamyung@gmail.com>
2009-01-20Allow user and group lookup to be disabled.Scott James Remnant
In certain cut-down situations such as an installer or inside the initramfs, we simply don't have any kind of name service. While we could use rules without OWNER or GROUP, it's better to have the same rules as a full system and have udevd ignore those parts of the rules. Adds a --resolve-names=never switch to udevd that has this effect.
2009-01-15udevadm: test - remove --force optionKay Sievers
Since a while we change the database with a "test" run, but do not update the node and symlinks. We need to "force" all the time, to keep things in sync.
2009-01-15do not complain about a missing /etc/udev/rules.d/Kay Sievers
Scott mentioned that initramfs does not neccessarily have that directory, so do not log an error.
2009-01-06libudev: device - add udev_device_get_property_value()Kay Sievers
2009-01-05enable skipping of "naming-only" rulesKay Sievers
2008-11-24silence PHYSDEV* warning for WAIT_FOR* rulesKay Sievers
2008-11-13remove len == 0 check, the index root is always '\0'Kay Sievers
2008-11-13merge trie nodes, childs and root into a single arrayKay Sievers
2008-11-12reserve child slot 0Kay Sievers
2008-11-12string index - split nodes and childs to allow and unlimited number of childsKay Sievers
2008-11-11silence "comparison between signed and unsigned"Kay Sievers
2008-11-11udevd: de-duplicate strings in rulesAlan Jenkins
On my Ubuntu installation this removes 15k of duplicate strings, using a temporary index of about 25k. Signed-off-by: Alan Jenkins <alan-jenkins@tuffmail.co.uk>
2008-11-07convert debug string arrays to functionsKay Sievers
On Fri, Nov 7, 2008 at 13:07, Matthias Schwarzott <zzam@gentoo.org> wrote: > I managed to let udev-131 segfault at startup. > > I configured it like this: > CFLAGS="-Wall -ggdb" ./configure --prefix=/usr --sysconfdir=/etc --exec-prefix= > > Running it in gdb shows it segfaults at udev-rules.c:831 > > (gdb) run > Starting program: /tmp/udev-131/udev/udevd > > Program received signal SIGSEGV, Segmentation fault. > 0x0804ea06 in get_key (udev=0x9175008, line=0xafcdc8f0, key=0xafcdc5d8, > op=0xafcdc5d0, value=0xafcdc5d4) > at udev-rules.c:831 > 831 dbg(udev, "%s '%s'-'%s'\n", operation_str[*op], *key, *value); If compiled without optimization, the dbg() macro dereferences variables which are not available. Convert the string array to a function, which just returns NULL if compiled without DEBUG.
2008-11-07fix size_t compiler warning on 32 bit platformsKay Sievers
2008-11-06cleanup /dev/.udev/queue on startup and exitKay Sievers
2008-11-05udevd: shrink struct token to 12 bytesAlan Jenkins
2008-11-05unify string replacementKay Sievers
2008-11-05info() PROGRAM and IMPORT executionKay Sievers
2008-11-04fix list handling in enumerate and rules file sortingKay Sievers
2008-11-01move debugging strings inside #ifdef DEBUGKay Sievers
2008-11-01move some info() to dbg()Kay Sievers
2008-11-01skip entire rule containing device naming keys, if no device can be namedKay Sievers
If rules set NAME, SYMLINK, OWNER, GROUP, MODE, events without a device node and remove events will skip the entire rule. The old parser did the same.
2008-11-01log rules file and line number when NAME, SYMLINK, OWNER, GROUP, MODE, RUN ↵Kay Sievers
is applied
2008-11-01udevd: be more careful when matching against parentsAlan Jenkins
I'm worried about what will happen with things like KERNELS=="*" # pointless rule KERNELS=="doesnt-match" # another pointless rule Since TK_RULE < TK_M_PARENTS_MAX, we will try to match all three tokens against parents of the current device. I can't think of a bad case, but it's not exactly good either. Signed-off-by: Alan Jenkins <alan-jenkins@tuffmail.co.uk>
2008-11-01udevd: fix termination of rule executionAlan Jenkins
LAST_RULE was broken, and I broke TK_END by making it do the same. It used a "break" which exited the switch statement, but not the loop! ==2953== Invalid read of size 4 ==2953== at 0x4081EE: dump_token (udev-rules.c:859) ==2953== by 0x40BADB: udev_rules_apply_to_event (udev-rules.c:1849) ==2953== by 0x403F17: udev_event_execute_rules (udev-event.c:554) ==2953== by 0x418626: main (test-udev.c:100) ==2953== Address 0x55ab1f8 is 0 bytes after a block of size 80 alloc'd ==2953== at 0x4C23082: realloc (vg_replace_malloc.c:429) ==2953== by 0x40B13B: udev_rules_new (udev-rules.c:1670) ==2953== by 0x418536: main (test-udev.c:84) ... Signed-off-by: Alan Jenkins <alan-jenkins@tuffmail.co.uk>
2008-10-29ATTR{}== always fails if the attribute does not existKay Sievers
2008-10-28udevd: simplify rules execution loopAlan Jenkins
cur can't become NULL, and the check for TK_END can be folded into the switch statement. Signed-off-by: Alan Jenkins <alan-jenkins@tuffmail.co.uk>
2008-10-26do not init string arrays, just clear first byteKay Sievers
2008-10-26match_attr() - copy attr value only when neededKay Sievers
2008-10-26udevd: avoid implicit memset in match_attr()Alan Jenkins
Initializing a char array to "" is equivalent to a memset() call - which is exactly what it gets compiled to. Fixing this one callsite reduced memset() _user_ cpu cycles from 2-4% to 0.05% on the EeePC. Signed-off-by: Alan Jenkins <alan-jenkins@tuffmail.co.uk>
2008-10-25fix handling of string_escape optionAlan Jenkins
2008-10-25match KEY="A|B" without temporary string copyKay Sievers
2008-10-24fix "unused" warningsKay Sievers
2008-10-24special-case "?*" match to skip fnmatch()Kay Sievers
2008-10-24determine at rule parse time if we need to call fnmatch()Kay Sievers
This cuts down the large rule set's 120.000 calls to fnmatch() to 51.000, and we can just call strcmp for the simple matches.
2008-10-24distinguish "match" from "assign" by (op < OP_MATCH_MAX)Kay Sievers
2008-10-24cache uid/gid during rule parsingKay Sievers
This cuts down the number of parsing /etc/group from ~700 to 11, with some large rule files installed.
2008-10-24rules: let empty strings added to buffer always return offset 0Kay Sievers
2008-10-23skip SYMLINK rules for devices without a device nodeKay Sievers
2008-10-23udevd: fix WAIT_FOR_SYSFS execution orderAlan Jenkins
The wait should be ordered after matching KERNEL, ENV, etc. but before ATTR. Without this, WAIT_FOR_SYSFS rules will be applied unconditionally to all events. Signed-off-by: Alan Jenkins <alan-jenkins@tuffmail.co.uk>
2008-10-23udevd: fix memory leakAlan Jenkins
Re: b99028c96307e729303be8f6750418979a7488b9 shrink struct udev_event TEST 136: test multi matches 2 device '/devices/pci0000:00/0000:00:1d.7/usb5/5-2/5-2:1.0/tty/ttyACM0' expecting node 'right' ==15011== ==15011== 7 bytes in 1 blocks are definitely lost in loss record 1 of 1 ==15011== at 0x47F9AB8: malloc (vg_replace_malloc.c:207) ==15011== by 0x489CB5F: strdup (in /lib32/libc-2.7.so) ==15011== by 0x8050F40: udev_rules_apply_to_event (udev-rules.c:1973) ==15011== by 0x804A658: udev_event_execute_rules (udev-event.c:549) ==15011== by 0x805A636: main (test-udev.c:100) add: ok ==15012== ==15012== 7 bytes in 1 blocks are definitely lost in loss record 1 of 1 ==15012== at 0x47F1AB8: malloc (vg_replace_malloc.c:207) ==15012== by 0x4898B5F: strdup (in /lib32/libc-2.7.so) ==15012== by 0x8050F40: udev_rules_apply_to_event (udev-rules.c:1973) ==15012== by 0x804A9DF: udev_event_execute_rules (udev-event.c:658) ==15012== by 0x805A636: main (test-udev.c:100) remove: ok Signed-off-by: Alan Jenkins <alan-jenkins@tuffmail.co.uk>
2008-10-23shrink struct udev_eventKay Sievers
2008-10-23shrink struct udev_eventKay Sievers
2008-10-23replace in-memory rules array with match/action token listKay Sievers
The in-memory rule array of a common desktop distro install took: 1151088 bytes with the token list: 109232 bytes tokens (6827 * 16 bytes), 71302 bytes buffer
2008-10-21use more appropriate alternatives to malloc()Alan Jenkins
Use calloc to request cleared memory instead. Kernel and libc conspire to make this more efficient. Also, replace one malloc() + strcpy() with strdup(). Signed-off-by: Alan Jenkins <alan-jenkins@tuffmail.co.uk>
2008-10-21replace missing get_attr_value() -> get_sysattr_value()Kay Sievers
2008-10-18prefix udev-util.c functions with util_*Kay Sievers
2008-10-18udev_list_cleanup() -> udev_list_cleanup_entries()Kay Sievers
2008-10-18move udev_rules_apply_format() to udev-event.cKay Sievers