Commit Graph

10226 Commits

Author SHA1 Message Date
Anthony G. Basile
15f72fb472 src/shared: import upstream code needed for recent commits
Signed-off-by: Anthony G. Basile <blueness@gentoo.org>
2014-09-18 18:46:21 -04:00
Tom Gundersen
1e446d862a udev: util - use log_level_from_string()
Signed-off-by: Anthony G. Basile <blueness@gentoo.org>
2014-09-17 20:30:35 -04:00
Tom Gundersen
be74fc7ab1 udev: event - modernize spawn_exec()
Signed-off-by: Anthony G. Basile <blueness@gentoo.org>
2014-09-17 20:24:50 -04:00
Tom Gundersen
fb510149ad udev: event - explicitly don't read() from invalid fd
This fixes CID #1237641.

Signed-off-by: Anthony G. Basile <blueness@gentoo.org>
2014-09-17 20:24:12 -04:00
Tom Gundersen
5d1b2ef564 udev: event - modernize spawn_read()
Signed-off-by: Anthony G. Basile <blueness@gentoo.org>
2014-09-17 20:23:12 -04:00
Tom Gundersen
dad4b71c8a udev: rules - close empty file
If the file is found to be empty, we exit early without closing the file first.

Found by coverity. Fixes CID #1237759.

Signed-off-by: Anthony G. Basile <blueness@gentoo.org>
2014-09-17 20:23:00 -04:00
Tom Gundersen
744749bd2e udev: rules - add missing whitespace to log message
Signed-off-by: Anthony G. Basile <blueness@gentoo.org>
2014-09-17 20:22:51 -04:00
Tom Gundersen
cb6d2d864c udevd: use safe_ato*() in place of strto*()
Signed-off-by: Anthony G. Basile <blueness@gentoo.org>
2014-09-17 20:12:41 -04:00
Tom Gundersen
39f24db770 libudev: util - drop util_delete_path()
Use rmdir_parents() from src/shared instead.

Signed-off-by: Anthony G. Basile <blueness@gentoo.org>
2014-09-17 20:10:42 -04:00
Tom Gundersen
5216331b7d libudev: drop util_lookup_{user,group}
Use shared versions instead. Difference is with overwriting of repeated user/group
name, and lack of logging.

Signed-off-by: Anthony G. Basile <blueness@gentoo.org>
2014-09-17 20:07:21 -04:00
Tom Gundersen
136e0eef04 udev: apply permissions to static nodes before signallying READY
Processes expecting static nodes to have the right permissions may order themselves after systemd-udevd.service,
make sure that actually guarantees what is expected.

Signed-off-by: Anthony G. Basile <blueness@gentoo.org>
2014-09-17 20:01:42 -04:00
Tom Gundersen
1aa456d4b9 udev: only print after final log level has been determined
This delays label_init(), and drops the (duplicate) printing of version
information.

Signed-off-by: Anthony G. Basile <blueness@gentoo.org>
2014-09-17 19:59:59 -04:00
Tom Gundersen
af353f0f00 udevd: initialize epoll_event structs on allocation
Also move the rest of event initialization next to the event loop (no functional change).

Signed-off-by: Anthony G. Basile <blueness@gentoo.org>
2014-09-17 19:58:09 -04:00
Tom Gundersen
b2399d9b72 udev: don't close std{in,out,err}
Rather than printing debug output to stderr and redirecting this to /dev/null when not wanted,
use the correct log_*() function in the first place.

Signed-off-by: Anthony G. Basile <blueness@gentoo.org>
2014-09-17 19:57:19 -04:00
Tom Gundersen
a3fd1c6811 udev: drop duplicate logging
Once upon a time logging during early boot was unreliable, so extra logging messages were
sent by udev to stderr. That is no longer a concern, so drop all fprintf() calls from udved.

Signed-off-by: Anthony G. Basile <blueness@gentoo.org>
2014-09-17 19:49:26 -04:00
Tom Gundersen
57594ac626 udev: split out parse_argv()
Signed-off-by: Anthony G. Basile <blueness@gentoo.org>
2014-09-17 19:45:47 -04:00
Tom Gundersen
e7c8f81065 udev: split out help and modernise a bit
Signed-off-by: Anthony G. Basile <blueness@gentoo.org>
2014-09-17 19:28:03 -04:00
Anthony G. Basile
54a717b207 src/shared/set.h: remove unnecessary function declaration
Signed-off-by: Anthony G. Basile <blueness@gentoo.org>
2014-09-15 18:45:56 -04:00
Anthony G. Basile
429c3a7f17 configure.ac: require automake 1.13
Signed-off-by: Anthony G. Basile <blueness@gentoo.org>
2014-09-15 17:01:33 -04:00
Michal Schmidt
7398282096 hashmap: introduce hash_ops to make struct Hashmap smaller
It is redundant to store 'hash' and 'compare' function pointers in
struct Hashmap separately. The functions always comprise a pair.
Store a single pointer to struct hash_ops instead.

systemd keeps hundreds of hashmaps, so this saves a little bit of
memory.

Signed-off-by: Anthony G. Basile <blueness@gentoo.org>
2014-09-15 16:43:59 -04:00
Anthony G. Basile
35257b404e configure.ac: bump 2.0 = upstream 216
Branch v2.X breaks from v1.X in that it removes the userland
firmware loading support.

Signed-off-by: Anthony G. Basile <blueness@gentoo.org>
2014-09-13 08:56:10 -04:00
Tom Gundersen
7ac0491cdb udev: timeout - warn after a third of the timeout before killing
Signed-off-by: Anthony G. Basile <blueness@gentoo.org>
2014-09-13 08:52:01 -04:00
David Herrmann
ffdc02f45b udev: allow removing tags via TAG-="foobar"
This extends the udev parser to support OP_REMOVE (-=) and adds support
for TAG-= to remove previously set tags. We don't fail if the tag didn't
exist.

This is pretty handy if we ship default rules for seat-assignments and
users want to exclude specific devices from that. They can easily add
rules that drop any automatically added "seat" tags again.

Signed-off-by: Anthony G. Basile <blueness@gentoo.org>
2014-09-13 08:46:04 -04:00
Anthony G. Basile
0dc6516102 skip udev: event - keep one rtnl per worker, rather than per event
This commit follows upstream's

    4c83d994566718043e61e568cc214bdc4587f869

We adopt their removal of excessive logging, but we do not switch
to one rtnl per worker, rather than per event.  This maintains
code separation between libsystemd and udev code.  The disadvantage
is that we do not get the cost savings of having one rtnl per
worker rather than per event.

Signed-off-by: Anthony G. Basile <blueness@gentoo.org>
2014-09-13 08:31:19 -04:00
Kay Sievers
3b71759460 udev: remove userspace firmware loading support
Signed-off-by: Anthony G. Basile <blueness@gentoo.org>
2014-09-13 08:27:22 -04:00
Tom Gundersen
17bd5427c1 udev: timeout - increase timeout
Some kernel modules still take more than one minute to insmod, we no longer rely on the timeout
killing insmod within a given period of time, so just bump this to a much higher value. Its only
purpose is to make sure that nothing stays aronud forever.

Signed-off-by: Anthony G. Basile <blueness@gentoo.org>
2014-09-10 21:38:36 -04:00
Tom Gundersen
9eef7867a0 udev: fix copy-paste error in log message
Signed-off-by: Anthony G. Basile <blueness@gentoo.org>
2014-09-10 21:37:51 -04:00
Tom Gundersen
405bccb70b udev: import the full db on MOVE events for devices without dev_t
Signed-off-by: Anthony G. Basile <blueness@gentoo.org>
2014-09-10 21:30:25 -04:00
Tom Gundersen
89f2848567 udev - drop print_kmsg
The only remaining user was 'starting version XXX', which is now logged using log_info().

Basile: There were also print_kmsg in udev-event.c which I switched to log_info().

Signed-off-by: Anthony G. Basile <blueness@gentoo.org>
2014-09-10 21:22:46 -04:00
Michael Biebl
876565e4f6 libudev: fix symbol version for udev_queue_flush() and udev_queue_get_fd()
Those symbols were introduced in commit
14cb733684d3c3f50d088a3a370ddf8e8894dfa4 and released in v215.

Signed-off-by: Anthony G. Basile <blueness@gentoo.org>
2014-09-10 21:10:06 -04:00
Mantas Mikulėnas
e950313484 rules: net-setup-link - remove stray linebreak
If not backslash-escaped, it splits the rule in two.

Signed-off-by: Anthony G. Basile <blueness@gentoo.org>
2014-09-10 21:06:17 -04:00
Tom Gundersen
30a0c571a9 rules: net-setup-link - preserve ID_NET_LINK_FILE and ID_NET_NAME after MOVE
Signed-off-by: Anthony G. Basile <blueness@gentoo.org>
2014-09-10 21:05:42 -04:00
Marcel Holtmann
c0bd83237e hwdb: update
Signed-off-by: Anthony G. Basile <blueness@gentoo.org>
2014-09-10 21:01:57 -04:00
Marcel Holtmann
8da8c2123c hwdb: Update database of Bluetooth company identifiers
Signed-off-by: Anthony G. Basile <blueness@gentoo.org>
2014-09-08 07:16:19 -04:00
Amadeusz Sławiński
1e0ad7de19 src/libudev/Makefile.am: link libudev against selinux
Signed-off-by: Amadeusz Sławiński <amade@asmblr.net>
Signed-off-by: Anthony G. Basile <blueness@gentoo.org>
2014-09-03 06:28:16 -04:00
Amadeusz Sławiński
390e0c7ba0 src/shared/label.c: include selinux headers
Signed-off-by: Amadeusz Sławiński <amade@asmblr.net>
2014-09-02 17:31:39 -04:00
Kay Sievers
d8876913e8 udev: bump event timeout to 60 seconds
Signed-off-by: Anthony G. Basile <blueness@gentoo.org>
2014-09-01 09:08:47 -04:00
David Herrmann
820c792432 shared: make container_of() use unique variable names
If you stack container_of() macros, you will get warnings due to shadowing
variables of the parent context. To avoid this, use unique names for
variables.

Two new helpers are added:
  UNIQ: This evaluates to a truly unique value never returned by any
        evaluation of this macro. It's a shortcut for __COUNTER__.
  UNIQ_T: Takes two arguments and concatenates them. It is a shortcut for
          CONCATENATE, but meant to defined typed local variables.

As you usually want to use variables that you just defined, you need to
reference the same unique value at least two times. However, UNIQ returns
a new value on each evaluation, therefore, you have to pass the unique
values into the macro like this:

    #define my_macro(a, b) __max_macro(UNIQ, UNIQ, (a), (b))
    #define __my_macro(uniqa, uniqb, a, b) ({
                typeof(a) UNIQ_T(A, uniqa) = (a);
                typeof(b) UNIQ_T(B, uniqb) = (b);
                MY_UNSAFE_MACRO(UNIQ_T(A, uniqa), UNIQ_T(B, uniqb));
        })

This way, MY_UNSAFE_MACRO() can safely evaluate it's arguments multiple
times as they are local variables. But you can also stack invocations to
the macro my_macro() without clashing names.

This is the same as if you did:

    #define my_macro(a, b) __max_macro(__COUNTER__, __COUNTER__, (a), (b))
    #define __my_macro(prefixa, prefixb, a, b) ({
                typeof(a) CONCATENATE(A, prefixa) = (a);
                typeof(b) CONCATENATE(B, prefixb) = (b);
                MY_UNSAFE_MACRO(CONCATENATE(A, prefixa), CONCATENATE(B, prefixb));
        })

...but in my opinion, the first macro is easier to write and read.

This patch starts by converting container_of() to use this new helper.
Other macros may follow (like MIN, MAX, CLAMP, ...).

Signed-off-by: Anthony G. Basile <blueness@gentoo.org>
2014-08-27 22:13:34 -04:00
David Herrmann
1911ef72db udev: add missing new-line in udevadm error
fprintf() does not add new-lines automatically like log_*() does. Add the
missing \n specified so "udevadm" invoked without arguments adds a newline
to:
    udevadm: missing or unknown command

Signed-off-by: Anthony G. Basile <blueness@gentoo.org>
2014-08-27 21:45:11 -04:00
Kay Sievers
7a2f160498 udev: hwdb - do not look at "usb_device" parents
Based on a patch from Simon McVittie <simon.mcvittie@collabora.co.uk>.

Bug-Debian: https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=758050

Signed-off-by: Anthony G. Basile <blueness@gentoo.org>
2014-08-27 21:44:02 -04:00
Martin Pitt
e7adcb6331 keymap: Adjust for more Samsung 900X4 series
Reportedly also applies to NP900X4B, so relax the match to apply to all models
of this series.

https://launchpad.net/bugs/902332

Signed-off-by: Anthony G. Basile <blueness@gentoo.org>
2014-08-27 21:42:26 -04:00
Andrei Borzenkov
534b690568 Document "...|..." udev match syntax
Signed-off-by: Anthony G. Basile <blueness@gentoo.org>
2014-08-27 21:41:14 -04:00
Lennart Poettering
c1402fc744 util: change return value of startswith() to non-const
This way we can use it on non-const strings, and don't end up with a
const'ified result.

This is similar to libc's strstr() which also takes a const string but
returns a non-const one.

Signed-off-by: Anthony G. Basile <blueness@gentoo.org>
2014-08-22 08:04:30 -04:00
Lennart Poettering
e8011305b2 util: change return value of startswith() to non-const
This way we can use it on non-const strings, and don't end up with a
const'ified result.

This is similar to libc's strstr() which also takes a const string but
returns a non-const one.

Signed-off-by: Anthony G. Basile <blueness@gentoo.org>
2014-08-22 08:04:30 -04:00
Anthony G. Basile
0f90b52d51 configure.ac and src/libudev/Makefile.am: bump to 1.10 = upstream 216
Signed-off-by: Anthony G. Basile <blueness@gentoo.org>
2014-08-22 08:03:24 -04:00
Lennart Poettering
bec26f61fb update hwdb
Signed-off-by: Anthony G. Basile <blueness@gentoo.org>
2014-08-21 06:44:11 -04:00
Anthony G. Basile
bdba4ea0e6 src/scsi_id/Makefile.am,test/Makefile.am: fix build on debian jessie, issue #97
Signed-off-by: Anthony G. Basile <blueness@gentoo.org>
2014-08-18 16:05:43 -04:00
Anthony G. Basile
60753094b3 src/shared/mkdir.h: add missing func prototype
Signed-off-by: Anthony G. Basile <blueness@gentoo.org>
2014-08-17 14:50:46 -04:00
Anthony G. Basile
9ca55798cd src/shared/path-util.c: revert change from realpath to canonicalize_file_name
Signed-off-by: Anthony G. Basile <blueness@gentoo.org>
2014-08-14 18:36:22 -04:00
Anthony G. Basile
6328540098 src/shared: some stylistic changes
Signed-off-by: Anthony G. Basile <blueness@gentoo.org>
2014-08-14 18:36:15 -04:00