Commit graph

2687 commits

Author SHA1 Message Date
Kay Sievers 6880b25d40 replace in-memory rules array with match/action token list
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-23 00:13:59 +02:00
Kay Sievers a391f49d7f handle numerical owner/group string in lookup_user/group() 2008-10-22 23:59:53 +02:00
Alan Jenkins aaff3d023f use re-entrant variants of getpwnam and getgrnam
Signed-off-by: Alan Jenkins <alan-jenkins@tuffmail.co.uk>
2008-10-22 18:05:46 +02:00
Kay Sievers 14f4025607 add util_resolve_subsys_kernel() 2008-10-22 18:03:38 +02:00
Matthias Koenig fcd070d010 volume_id: swap - larger PAGE_SIZE support 2008-10-22 11:45:27 +02:00
Alan Jenkins 111e4f81ff replace strncpy() with strlcpy()
The problem was strncpy() doesn't stop after writing the terminating
NUL; by definition it goes on to zero the entire buffer.

I spy another use of strncpy in udev_device_add_property_from_string(),
which is responsible for another ~1% user cpu time...

Signed-off-by: Alan Jenkins <alan-jenkins@tuffmail.co.uk>
2008-10-21 23:55:13 +02:00
Kay Sievers 9a23e9e775 libudev: device - 128 -> ENVP_SIZE 2008-10-21 13:58:19 +02:00
Alan Jenkins be18918f65 libudev: allocate udev_device->envp[] dynamically
Measured 2% _user_ cpu time reduction on EeePC coldplug.

Signed-off-by: Alan Jenkins <alan-jenkins@tuffmail.co.uk>
2008-10-21 13:56:23 +02:00
Alan Jenkins fa0e955a93 libudev: util - optimize path_encode()
Since we already know the length, use memcpy() instead.
Measured 2% _user_ cpu time reduction on EeePC coldplug.

Signed-off-by: Alan Jenkins <alan-jenkins@tuffmail.co.uk>
2008-10-21 13:09:31 +02:00
Alan Jenkins b29a5e4ab9 use more appropriate alternatives to malloc()
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-21 12:54:57 +02:00
Kay Sievers a8a8930072 do not use the new work-in-progress parser rule matcher 2008-10-21 12:45:54 +02:00
Kay Sievers 20254eb021 add "root" == 0 shortcuts to lookup_user/group() 2008-10-21 12:43:07 +02:00
Kay Sievers 94db05d288 replace missing get_attr_value() -> get_sysattr_value() 2008-10-21 12:42:13 +02:00
Kay Sievers e02d738ee4 cdrom_id: remove ARRAY_SIZE() declaration 2008-10-21 12:40:47 +02:00
Kay Sievers 69239210be libudev: device - get_attr_value() -> get_sysattr_value() 2008-10-20 18:12:36 +02:00
Kay Sievers 2d9a1b1ef2 pass make distcheck 2008-10-18 20:33:06 +02:00
Kay Sievers 54808d77a3 prefix udev-util.c functions with util_* 2008-10-18 20:12:55 +02:00
Kay Sievers c3b1fa66d2 selinux_init(udev) -> udev_selinux_init(udev) 2008-10-18 19:30:42 +02:00
Kay Sievers eb8837e15c udev_list_cleanup() -> udev_list_cleanup_entries() 2008-10-18 19:27:38 +02:00
Kay Sievers f1128767cb move udev_rules_apply_format() to udev-event.c 2008-10-18 19:19:56 +02:00
Kay Sievers 2d73813ebc udev_rules_run() -> udev_event_execute_run(); 2008-10-18 15:50:16 +02:00
Kay Sievers dcdcb8cc06 udev_event_run() -> udev_event_execute_rules() 2008-10-18 15:46:55 +02:00
Alan Jenkins 836dcf951c udevd: avoid overhead of calling rmdir on non-empty directories
Unfortunately the linux rmdir implementation unhashes the dentry
even when the directory is not removed.  This is apparently by
design (for filesystems that don't allow deleting open files).

Results from time(1) and oprofile follow.

Before:

0.35user 0.90system
samples  %        image name               symbol name
608       9.6738  vmlinux                  shrink_dcache_parent
293       4.6619  vmlinux                  copy_page_c
271       4.3119  vmlinux                  copy_page_range
257       4.0891  udevd                    udev_rules_iter_next

After:

0.31user 0.67system
samples  %        image name               symbol name
361       5.0419  vmlinux                  copy_page_range
322       4.4972  udevd                    udev_rules_iter_next
300       4.1899  vmlinux                  copy_page_c

Signed-off-by: Alan Jenkins <alan-jenkins@tuffmail.co.uk>
2008-10-18 15:28:49 +02:00
Kay Sievers d0db192fa5 move run_program to util 2008-10-18 15:25:05 +02:00
Kay Sievers d7ddce186c make struct udev_rules opaque 2008-10-18 15:02:01 +02:00
Kay Sievers c7521974a3 merge udev-rules.c and udev-rules-parse.c 2008-10-18 14:33:37 +02:00
Kay Sievers bec02e3304 delete list.h 2008-10-17 19:29:57 +02:00
Kay Sievers 002a957762 collect: use udev_list 2008-10-17 19:29:02 +02:00
Kay Sievers 7e02792760 udevd: use udev_list_node 2008-10-17 18:59:27 +02:00
Kay Sievers 9dcf7ec8a0 libudev: make list_node functions available 2008-10-17 18:59:08 +02:00
Kay Sievers b692a75089 libudev: ctrl - change magic to integer 2008-10-17 17:32:17 +02:00
Kay Sievers cb25a9585d libudev: monitor - add set_receive_buffer_size() 2008-10-17 16:49:27 +02:00
Kay Sievers d960ad1546 test: fix a few unintentially wrongly written rules which cause parse errors 2008-10-17 13:54:50 +02:00
Kay Sievers bdeab5c7fd libudev: add sysnum to test program 2008-10-17 13:54:14 +02:00
Alan Jenkins babcf3cb22 libudev: fix sysnum logic for digit-only device names 2008-10-17 13:19:54 +02:00
Kay Sievers 3feeb77c97 libudev: list - prepend udev_* to all functions 2008-10-17 01:39:10 +02:00
Kay Sievers d130881d34 delete udev-util-file.c 2008-10-17 00:42:48 +02:00
Kay Sievers fc42bd5d6b update rules file parsing 2008-10-17 00:40:03 +02:00
Kay Sievers bb144ed14d update IMPORT= file/stdout property parsing 2008-10-16 22:41:52 +02:00
Kay Sievers c28c4486af run_program: prevent empty last argv entry 2008-10-16 21:35:11 +02:00
Kay Sievers be7f7f5701 fix sorting of rules files 2008-10-16 21:12:08 +02:00
Kay Sievers a390e6f764 delete name_list, move common file functions 2008-10-16 20:23:56 +02:00
Kay Sievers daa849db6f udev-rules-parse: name_list -> udev_list 2008-10-16 20:12:16 +02:00
Kay Sievers 7db6580f42 udev-node: name_list -> udev_list 2008-10-16 19:23:07 +02:00
Kay Sievers 3361a0f110 libudev: monitor - export MAJOR/MINOR only if available 2008-10-16 18:56:19 +02:00
Kay Sievers 3fb629fd5e libudev: always add UDEV_LOG 2008-10-16 18:51:05 +02:00
Kay Sievers 8460299b57 rename udev source files 2008-10-16 18:13:48 +02:00
Kay Sievers fc233a874b move udev_device_db to libudev 2008-10-16 17:30:06 +02:00
Kay Sievers aa8734ffcb udevd: use libudev 2008-10-16 17:16:58 +02:00
Kay Sievers d56f94d168 volume_id: btrfs - update magic to latest disk format 2008-10-16 17:10:47 +02:00