Commit Graph

264 Commits

Author SHA1 Message Date
David Herrmann 8e3ba3772c 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.
2014-09-11 15:22:16 +02:00
Tom Gundersen ec3281d3b6 udev: fix copy-paste error in log message 2014-09-10 18:09:32 +02:00
Tom Gundersen ac9c87dbc4 Revert "libudev: use get_*_creds from shared rather than util_lookup_*"
This reverts commit a56ba6158b.

The commit was pushed in error.
2014-08-01 22:33:20 +02:00
Tom Gundersen a56ba6158b libudev: use get_*_creds from shared rather than util_lookup_* 2014-08-01 16:34:50 +02:00
Hannes Reinecke 9f20a8a376 udev: fixup commit dd5eddd28a
Commit dd5eddd28a accidentally
removed one line too many.
2014-07-30 11:40:13 +02:00
Kay Sievers 9ec6e95b04 udev: place opening { at the same line as the function declaration 2014-07-29 15:49:25 +02:00
Kay Sievers dd5eddd28a udev: unify event timeout handling 2014-07-29 15:18:27 +02:00
Zbigniew Jędrzejewski-Szmek ed88bcfb7c Be more careful when checking for empty files
If we want to avoid reading a totally empty file, it seems better
to check after we have opened the file, not before.
2014-07-16 19:00:03 -04:00
Robert Milasan 209b031e4f udev: increase the size of RESULT buffer
Under some conditions, in udev_rules_apply_to_event the fact that
result is 1024 bytes, creates problems if the output of the running
command/app is bigger then 1024 bytes.
2014-04-24 11:26:26 +02:00
Kay Sievers ca2bb1606a udev: do not export "static node" tags for non-existing devices 2014-04-02 15:47:09 +02:00
Josh Triplett f8294e4175 Use strlen even for constant strings
GCC optimizes strlen("string constant") to a constant, even with -O0.
Thus, replace patterns like sizeof("string constant")-1 with
strlen("string constant") where possible, for clarity.  In particular,
for expressions intended to add up the lengths of components going into
a string, this often makes it clearer that the expression counts the
trailing '\0' exactly once, by putting the +1 for the '\0' at the end of
the expression, rather than hidden in a sizeof in the middle of the
expression.
2014-03-16 09:52:56 -04:00
Zbigniew Jędrzejewski-Szmek 06beed6dc6 Remove unused variable and two function stubs 2014-02-17 22:35:35 -05:00
Lennart Poettering 955d98c9c1 everywhere: make use of new0() and macro() macros, and stop using perror() 2014-02-13 14:45:51 +01:00
Greg KH 29804cc1e0 use memzero(foo, length); for all memset(foo, 0, length); calls
In trying to track down a stupid linker bug, I noticed a bunch of
memset() calls that should be using memzero() to make it more "obvious"
that the options are correct (i.e. 0 is not the length, but the data to
set).  So fix up all current calls to memset(foo, 0, length) to
memzero(foo, length).
2014-01-31 11:55:01 +01:00
Kay Sievers d6f116a7b1 udev: static_node - do not exit rule after first static_node item
The nodes usually do not exist, so handle the next item instead of
skipping the entire rule.
2014-01-22 10:47:48 +01:00
Zbigniew Jędrzejewski-Szmek 2ad8416dd0 No need to canonicalize fixed paths 2014-01-08 22:15:27 -05:00
Zbigniew Jędrzejewski-Szmek e3e0314b56 systemctl: allow globbing in commands which take multiple unit names 2013-12-26 13:24:36 -05:00
Lennart Poettering 9f6445e34a log: log_error() and friends add a newline after each line anyway, so avoid including it in the log strings 2013-12-24 16:39:37 +01:00
Thomas Hindoe Paaboel Andersen f168c27313 trivial coding style clean ups
- Add space between if/for and the opening parentheses
- Place the opening brace on same line as the function (not for  udev)

From the CODING_STYLE
Try to use this:
    void foo() {
    }
instead of this:
    void foo()
    {
    }
2013-12-03 22:27:45 +01:00
Daniel Buch f5f6d0e255 tree-wide usage of %m specifier instead of strerror(errno)
Also for log_error() except where a specific error is specified

e.g. errno ? strerror(errno) : "Some user specified message"
2013-11-26 21:07:46 +10:00
Kay Sievers 5c11fbe3a7 udev: udevd - rules can be NULL when reloading 2013-11-04 15:54:33 +01:00
Kay Sievers 75716dd8ea udev: rules - move parsing error to log_error() 2013-10-30 15:49:46 +01:00
Kay Sievers 0aa5b4d1f7 udev: do not allow to change the DEVPATH of a device 2013-10-30 01:58:26 +01:00
Tom Gundersen 97f2d76d4f path_check_timestamp: only keep the most recent timestamp
There is no point in keeping one timestamp for each directory, as we only
ever care about the most recent one.
2013-10-29 16:12:11 +01:00
Tom Gundersen 8e18485284 udev: move udev_rules_check_timestamp to shared
I want to use this from a bulitin in a subsequent patch.
2013-10-26 14:34:31 +02:00
Kay Sievers c26547d612 udev: support custom Linux Security Module labels for device nodes 2013-10-08 02:23:24 +02:00
Dave Reisner 3cf0f8f7e0 udev-rules: avoid erroring on trailing whitespace
https://bugs.archlinux.org/task/36950
2013-09-16 11:46:05 -04:00
Shawn Landden 7c902b1468 udev: fix printf(3) type specifier
src/udev/udev-rules.c: In function 'add_rule':
src/udev/udev-rules.c:1078:33: warning: format '%lu' expects argument of type 'long unsigned int', but argument 8 has type 'int' [-Wformat=]
                                 log_error("invalid key/value pair in file %s on line %u,"
                                 ^
2013-08-23 12:48:14 -04:00
Zbigniew Jędrzejewski-Szmek 1291bc895b udev: when complaining about invalid characters, print them out
systemd-udevd[6260]: invalid key/value pair in file /usr/lib/udev/rules.d/60-ffado.rules on line 46,starting at character 84 ('#')
2013-08-20 21:18:43 -04:00
Dave Reisner e736cf3582 udev-rules: report rule parsing errors from get_key 2013-07-29 21:51:58 -04:00
Tom Gundersen 15a722007d udev: static_node - don't touch permissions uneccessarily
Don't set default permissions if only TAGS were specified in a rule.
2013-07-24 15:13:00 +02:00
Tom Gundersen 490f008762 udev: log error if chmod/chown of static dev nodes fails 2013-07-24 15:13:00 +02:00
Tom Gundersen 84b6ad702e udev: export tags of "dead" device nodes to /run/udev/static_node-tags/
Based on a patch by Kay Sievers.

A tag is exported at boot as a symlinks to the device node in the folder
/run/udev/static_node-tags/<tagname>/, if the device node exists.

These tags are cleaned up by udevadm info --cleanup-db, but are otherwise
never removed.
2013-07-16 20:07:57 +02:00
Jan Janssen 9c3fd04e7d libudev: Use correct type for sizeof 2013-06-24 12:41:01 +02:00
Anatol Pomozov ab06eef810 Fix spelling errors using 'codespell' tool 2013-04-15 08:40:05 -04:00
Thomas Hindoe Paaboel Andersen 641906e936 use strneq instead of strncmp 2013-02-13 00:56:13 +01:00
Kay Sievers 7850b3b837 shared: conf-files - add root parameter 2013-02-08 10:23:04 +01:00
Kay Sievers d5a89d7dc1 udev: move string copy functions to shared/ 2013-01-09 19:06:46 +01:00
Kay Sievers 1edefa4f1d udev: in addition to DEVMODE, honor DEVUID, DEVGID from the uevent 2012-12-31 04:48:44 +01:00
Kay Sievers 1298001ec5 use the same email address everywhere 2012-11-12 19:47:43 +01:00
Kay Sievers 40fe8b11be udev: use usec_t and now() 2012-11-12 01:03:14 +01:00
Kay Sievers ff944daa01 udev: get rid of SYSCONFDIR 2012-10-28 04:04:22 +01:00
Kay Sievers 915bf0f60f udev: use strbuf to store rules strings 2012-10-22 16:28:04 +02:00
Kay Sievers 07845c142b udev: support multiple entries for ENV{SYSTEMD_ALIAS} and ENV{SYSTEM_WANTS} 2012-10-09 00:16:50 +02:00
Kay Sievers 8a1733871f udev: remove SYMLINK "unique" option 2012-10-08 21:54:39 +02:00
Václav Pavlín 0820a4f0f6 udev: free rule structure on error 2012-09-23 14:24:43 +02:00
Kay Sievers 238b53a024 udev: fix typo in copyright 2012-08-08 18:24:50 +02:00
Kay Sievers 3b8c1cb01f udev: initialize rules dir timestamps when reading rules
On Wed, Aug 8, 2012 at 11:48 AM, Michael Schroeder <mls@suse.de> wrote:
> if rules are installed in the first 3 seconds after the udev start,
> the stamps will all be zero, so the [first] call to check_rules_timestamp()
> will just copy the current mtime [and not cause a rules re-load].
2012-08-08 14:45:16 +02:00
Kay Sievers 4cb72937d3 udev: get rid of TEST_PREFIX and use unshare() to fake /sys, /dev, /run 2012-07-15 22:10:46 +02:00
Kay Sievers 47ef94ac5f udev: add some O_CLOEXEC 2012-07-05 17:33:24 +02:00
Kay Sievers da5d4bf64f udev: skip timestamp check if rules are already free()d during reload 2012-05-31 01:17:59 +02:00
Kay Sievers 9eb977db5b util: split-out path-util.[ch] 2012-05-08 02:33:10 +02:00
Kay Sievers 2c21044f05 util: split-out conf-file.[ch] 2012-05-07 19:01:24 +02:00
Kay Sievers 775f8b3c74 udev: use conf_files_list() to search rules files 2012-05-07 13:21:05 +02:00
Kay Sievers 395ea97815 udev: fix the ENV{} blacklist logic 2012-05-04 02:29:36 +02:00
Kay Sievers 33502ffe2e udev: use startswith() and streq() 2012-04-16 20:54:17 +02:00
Kay Sievers 6ada823a9a udev: remove configuration options for /dev, /sys, /run directories 2012-04-16 19:20:57 +02:00
Kay Sievers 8fef0ff25c udev: replace ARRAY_SIZE() with ELEMENTSOF() 2012-04-16 19:20:57 +02:00
Kay Sievers 4590cfe455 udev: fix RUN+= logic regarding builtin vs. program 2012-04-11 22:34:25 +02:00
Kay Sievers 04a9d3a00a udev: fix gcc warnings showing up after adding $(AM_CFLAGS) 2012-04-10 17:27:46 +02:00
Kay Sievers 2d13da8821 udev: remove RUN+="socket:.." and udev_monitor_new_from_netlink() 2012-04-09 21:18:30 +02:00
Kay Sievers 83cd6b754b udev: convert 'uaccess' to a builtin 2012-04-09 19:25:41 +02:00
Kay Sievers baa30fbc2c udev: switch to systemd logging functions 2012-04-08 16:06:20 +02:00
Kay Sievers 3e2147858f move imported udev into place 2012-04-04 05:05:07 +02:00
Renamed from src/udev/src/udev-rules.c (Browse further)