1
0
mirror of https://github.com/systemd/systemd.git synced 2024-11-06 08:26:52 +03:00
Commit Graph

2952 Commits

Author SHA1 Message Date
Alan Jenkins
1449a55ded udevd: de-duplicate strings in rules
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-11 22:19:11 +01:00
Kay Sievers
bfa9938c03 release 132 2008-11-07 16:08:58 +01:00
Kay Sievers
5d6a1fa6e9 convert debug string arrays to functions
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-07 15:59:58 +01:00
Kay Sievers
e230e966f4 fix size_t compiler warning on 32 bit platforms 2008-11-07 02:58:54 +01:00
Kay Sievers
acae628f52 release 131 2008-11-07 02:36:20 +01:00
Kay Sievers
11d5eec2cb udevadm: settle - exit if udevd exits 2008-11-06 19:41:58 +01:00
Kay Sievers
78230c0dbe cleanup /dev/.udev/queue on startup and exit 2008-11-06 17:43:12 +01:00
Kay Sievers
e32135825f rules: md - add mdadm 3 device naming 2008-11-06 08:17:33 +01:00
Kay Sievers
90024521e7 fix indentation 2008-11-06 02:56:45 +01:00
Alan Jenkins
3f3aa9f57c udevd: shrink struct token to 12 bytes 2008-11-05 22:28:52 +01:00
Kay Sievers
adea2cc22b $links should be relative 2008-11-05 22:13:49 +01:00
Kay Sievers
92f4313665 unify string replacement 2008-11-05 21:49:52 +01:00
Kay Sievers
b467444884 usb_id: MassStorage SubClass 6 is "scsi" not "disk" 2008-11-05 19:02:56 +01:00
Kay Sievers
77b852f333 do not import the "uevent" file when we only read the db to get old symlinks 2008-11-05 12:23:06 +01:00
Kay Sievers
6e0cb78c9d fix cleanup of possible left-over symlinks 2008-11-05 04:45:23 +01:00
Kay Sievers
7c4573e46d fix $links substitution 2008-11-05 04:08:44 +01:00
Kay Sievers
08e7f22913 info() PROGRAM and IMPORT execution 2008-11-05 04:05:17 +01:00
Kay Sievers
0d5076dd92 volume_id: btrfs update 2008-11-05 02:22:07 +01:00
Kay Sievers
1e78dcbe51 fix list handling in enumerate and rules file sorting 2008-11-04 20:19:01 +01:00
Kay Sievers
a0e17034ee firmware.sh: record missing files in /dev/.udev/firmware-missing/ 2008-11-04 18:38:06 +01:00
Kay Sievers
4052400fa0 move debugging strings inside #ifdef DEBUG 2008-11-01 21:05:25 +01:00
Kay Sievers
b929e83acc add "devel" and "install" switches to autogen.sh 2008-11-01 20:57:22 +01:00
Kay Sievers
86b5778857 move some info() to dbg() 2008-11-01 20:16:24 +01:00
Kay Sievers
5755d586e1 fix udev_node_update_old_links() logic
No need to check if links that still belong to us, need to be updated.
2008-11-01 20:05:41 +01:00
Kay Sievers
00f98bd2b3 skip entire rule containing device naming keys, if no device can be named
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-01 19:12:20 +01:00
Kay Sievers
0ef254d580 log rules file and line number when NAME, SYMLINK, OWNER, GROUP, MODE, RUN is applied 2008-11-01 18:34:54 +01:00
Alan Jenkins
d15fcce4b3 udevd: be more careful when matching against parents
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-01 17:32:16 +01:00
Alan Jenkins
11ae757850 udevd: fix termination of rule execution
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-11-01 17:29:26 +01:00
Kay Sievers
27691aa3ae write trace log to stderr 2008-10-31 16:22:55 +01:00
Kay Sievers
bf18270222 fstab_import: add "change" event match 2008-10-30 16:41:47 +01:00
Kay Sievers
11ddcbf7b4 edd_id: add "change" event match 2008-10-30 16:41:27 +01:00
Kay Sievers
87fb336f39 rules: remove "add" match from usb device node rule 2008-10-30 16:11:49 +01:00
Kay Sievers
ba6e84fe6a rules: remove SCSI timeouts
On Thu, Oct 30, 2008 at 03:55, Tejun Heo <tj@kernel.org> wrote:
The appropriate default timeout differs depending on the transport and
the type of the attached device, so the above two rules harm more than
help.  The affect of the above two rules weren't visible for some
reason but with recent block layer timeout update, they actually work
and cause problems.
2008-10-30 09:20:03 +01:00
Kay Sievers
aeb53ca3d6 ATTR{}== always fails if the attribute does not exist 2008-10-29 22:22:12 +01:00
Kay Sievers
0bc74ea79f udevd: merge exec and run queue to minimize devpath string compares 2008-10-29 17:32:13 +01:00
Alan Jenkins
6270756cdc udevd: simplify rules execution loop
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-28 10:02:43 +01:00
Kay Sievers
65807d09ec update NEWS 2008-10-28 02:26:35 +01:00
Alan Jenkins
be7de4097a kerneldoc comment fixes
s/ressources/resources/

Also reduce commas per sentence and add a possessive apostrophe.
2008-10-26 15:55:47 +01:00
Kay Sievers
427e20b261 libudev: device - allocate envp array only once 2008-10-26 14:31:46 +01:00
Kay Sievers
c6243a414e test: add RUN+="socket: ..." to a test to run monitor code 2008-10-26 04:35:32 +01:00
Kay Sievers
6493e655f7 libudev: device - fill envp array while composing monitor buffer
Thanks to Alan Jenkins, for the idea.
2008-10-26 03:39:41 +01:00
Kay Sievers
dc4c7e463d fix $attr{[<subsystem>/<sysname>]<attribute>} substitution 2008-10-26 02:48:14 +01:00
Kay Sievers
1822e9b033 do not init string arrays, just clear first byte 2008-10-26 02:31:54 +01:00
Kay Sievers
21cfb0436c match_attr() - copy attr value only when needed 2008-10-26 02:16:54 +01:00
Alan Jenkins
cd94c04c51 udevd: avoid implicit memset in match_attr()
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-26 02:11:56 +01:00
Alan Jenkins
e25fa4faf5 udevd: use a tighter loop for compare_devpath()
This crops up in my threaded udevd profiles from time to time.
It's not consistent - probably due to variations in the number
of concurrent events - but it can hit 4% user time and higher.

The change halves the user time spent in compare_devpath().

Signed-off-by: Alan Jenkins <alan-jenkins@tuffmail.co.uk>
2008-10-25 19:41:52 +02:00
Alan Jenkins
3e5c759543 fix handling of string_escape option 2008-10-25 15:19:48 +02:00
Kay Sievers
91a75e4ad4 match KEY="A|B" without temporary string copy 2008-10-25 03:00:03 +02:00
Kay Sievers
b62557daff remove debug printf 2008-10-24 18:09:13 +02:00
Kay Sievers
39a08013a2 fix "unused" warnings 2008-10-24 17:42:31 +02:00