summaryrefslogtreecommitdiff
path: root/src/udev
AgeCommit message (Collapse)Author
2015-10-24util: split out escaping code into escape.[ch]Lennart Poettering
This really deserves its own file, given how much code this is now.
2015-10-14keymap: Drop keyboard-keys-to-name.hMartin Pitt
We don't use that anywhere any more. With the introduction of alias names it also is not a proper mapping any more as several keys (e. g. KEY_COFFEE and KEY_SCREENLOCK) have the same numerical mapping.
2015-10-05document ability to disable MACAddressPolicyJacob Keller
While it is currently possible to either not set MACAddressPolicy or set it to a value different from "persistent" or "random", it is not obvious that a user can do so. Add a policy, "none", which simply retains kernel MAC addresses (same as not filling in the policy at all) and document it so that users are aware of this setting. Signed-off-by: Jacob Keller <jacob.keller@gmail.com>
2015-10-01Merge pull request #1428 from franciozzy/tagenhanceKay Sievers
Enhance matching of TAG keys
2015-10-01udev: fix format string after conversion to log_*_errno()Michal Schmidt
Use %m where previously %s was used together with strerrno(). Fixes: e53fc357a9b "tree-wide: remove a number of invocations of strerror() and replace by %m"
2015-09-30Support OP_NOMATCH for TAG keyFelipe Franciosi
The TAG key can be used in rules for event matching. At the moment, it does not support inequality tests. This patch enhances the key test to validate the rule if it does not contain a given TAG (by TAG!="value"). Signed-off-by: Felipe Franciosi <felipe@paradoxo.org>
2015-09-30tree-wide: remove a number of invocations of strerror() and replace by %mLennart Poettering
Let's clean up our tree a bit, and reduce invocations of the thread-unsafe strerror() by replacing it with printf()'s %m specifier.
2015-09-30basic: split out cpu set specific APIs into cpu-set-util.[ch]Lennart Poettering
2015-09-22udev: ata_id - ATA_ID_SATA_CAPABILITY == 76Kay Sievers
2015-09-21Fixup WWN bytes for big-endian systemsTom Lyon
2015-09-09tree-wide: replace while(1) by for(;;) everywhereLennart Poettering
Another Coccinelle script.
2015-09-09tree-wide: update empty-if coccinelle script to cover empty-while and moreLennart Poettering
Let's also clean up single-line while and for blocks.
2015-09-09Merge pull request #1207 from poettering/coccinelle-fixesDaniel Mack
Coccinelle fixes
2015-09-09tree-wide: drop {} from one-line if blocksLennart Poettering
Patch via coccinelle.
2015-09-09tree-wide: make use of log_error_errno() return valueLennart Poettering
Turns this: r = -errno; log_error_errno(errno, "foo"); into this: r = log_error_errno(errno, "foo"); and this: r = log_error_errno(errno, "foo"); return r; into this: return log_error_errno(errno, "foo");
2015-09-09tree-wide: drop redundant if checks before safe_close()Lennart Poettering
Replace this: if (fd >= 0) safe_close(fd); by this: safe_close(fd);
2015-09-09tree-wide: make more code use safe_close()Lennart Poettering
Replace this: close(fd); fd = -1; write this: fd = safe_close(fd);
2015-09-09tree-wide: use coccinelle to patch a lot of code to use mfree()Lennart Poettering
This replaces this: free(p); p = NULL; by this: p = mfree(p); Change generated using coccinelle. Semantic patch is added to the sources.
2015-09-08udev: build by-path identifiers for ATA devices.David Milburn
/dev/disk/by-path total 0 lrwxrwxrwx. 1 root root 9 Sep 4 10:02 pci-0000:00:1f.2-ata-2 -> ../../sr0 lrwxrwxrwx. 1 root root 9 Sep 4 10:02 pci-0000:00:1f.2-ata-3 -> ../../sdd lrwxrwxrwx. 1 root root 10 Sep 4 10:02 pci-0000:00:1f.2-ata-3-part1 -> ../../sdd1 lrwxrwxrwx. 1 root root 10 Sep 4 10:02 pci-0000:00:1f.2-ata-3-part2 -> ../../sdd2 lrwxrwxrwx. 1 root root 10 Sep 4 10:02 pci-0000:00:1f.2-ata-3-part3 -> ../../sdd3 lrwxrwxrwx. 1 root root 9 Sep 4 10:02 pci-0000:03:00.0-ata-4 -> ../../sda lrwxrwxrwx. 1 root root 10 Sep 4 10:02 pci-0000:03:00.0-ata-4-part1 -> ../../sda1 lrwxrwxrwx. 1 root root 10 Sep 4 10:02 pci-0000:03:00.0-ata-4-part2 -> ../../sda2 lrwxrwxrwx. 1 root root 9 Sep 4 10:02 pci-0000:08:00.0-ata-1 -> ../../sdc lrwxrwxrwx. 1 root root 10 Sep 4 10:02 pci-0000:08:00.0-ata-1-part1 -> ../../sdc1 lrwxrwxrwx. 1 root root 10 Sep 4 10:02 pci-0000:08:00.0-ata-1-part2 -> ../../sdc2
2015-09-08sd-login: fix sd_seat_get_active() to return ENODATAsystemd/v226David Herrmann
This seems to be an oversight from: 707b66c66381c899d7ef640e158ffdd5bcff4deb We have to return ENODATA instead of ENOENT if a requested entry is non-present. Also fix the call-site in udev to check for these errors.
2015-09-03udev: ignore ENOEXEC from cgroup lookupDavid Herrmann
The recent cgroup-rework changed the error code for un-mounted cgroupfs to ENOEXEC. Make sure udev ignores it just like ENOENT and does not spill warnings on the screen.
2015-09-02udev: net_id - support predictable ifnames on virtio busesTom Gundersen
Virtio buses are undeterministically enumerated, so we cannot use them as a basis for deterministic naming (see bf81e792f3c0). However, we are guaranteed that there is only ever one virtio bus for every parent device, so we can simply skip over the virtio buses when naming the devices.
2015-08-27udev: control - add FIXME comment to remove work-aroundKay Sievers
2015-08-17Bug #944: Deletion of unnecessary checks before calls of the function "free"Markus Elfring
The function "free" is documented in the way that no action shall occur for a passed null pointer. It is therefore not needed that a function caller repeats a corresponding check. http://stackoverflow.com/questions/18775608/free-a-null-pointer-anyway-or-check-first This issue was fixed by using the software Coccinelle 1.0.1.
2015-08-12Merge pull request #939 from karelzak/smatchTom Gundersen
treewide: trivial issues detected by smatch
2015-08-11gpt-auto-generator: apply partition-type flags only to specific partition-typesKay Sievers
The partition-type flags are defined independently for every partition-type. Apply them only to the types where they are defined, and not to the ESP, which does not appear to share the same set of flags. https://github.com/systemd/systemd/issues/920
2015-08-06udev: variable dereferenced before check 'cmsg'Karel Zak
2015-08-06Merge pull request #883 from phomes/bool_vs_error_codesDaniel Mack
tree-wide: do not return error codes as bool
2015-08-06tree-wide: do not return error codes as boolThomas Hindoe Paaboel Andersen
2015-08-06tree-wide: fix indentationThomas Hindoe Paaboel Andersen
2015-08-05udev: uaccess - do not log error when device node disappearsKay Sievers
https://github.com/systemd/systemd/issues/875
2015-08-04smack-util: revise smack-util apis and add read smack attr apisWaLyong Cho
- Add smack xattr lookup table - Unify all of mac_smack_apply_xxx{_fd}() to mac_smack_apply() and mac_smack_apply_fd(). - Add smack xattr read apis similar with apply apis as mac_smack_read{_fd}().
2015-08-03sd-event: make sure sd_event_now() cannot failLennart Poettering
Previously, if the event loop never ran before sd_event_now() would fail. With this change it will instead fall back to invoking now(). This way, the function cannot fail anymore, except for programming error when invoking it with wrong parameters. This takes into account the fact that many callers did not handle the error condition correctly, and if the callers did, then they kept simply invoking now() as fall back on their own. Hence let's shorten the code using this call, and make things more robust, and let's just fall back to now() internally. Whether now() is used or the cache timestamp may still be detected via the return value of sd_event_now(). If > 0 is returned, then the fall back to now() was used, if == 0 is returned, then the cached value was returned. This patch also simplifies many of the invocations of sd_event_now(): the manual fall back to now() can be removed. Also, in cases where the call is invoked withing void functions we can now protect the invocation via assert_se(), acknowledging the fact that the call cannot fail anymore except for programming errors with the parameters. This change is inspired by #841.
2015-07-31tree-wide: introduce mfree()David Herrmann
Pretty trivial helper which wraps free() but returns NULL, so we can simplify this: free(foobar); foobar = NULL; to this: foobar = mfree(foobar);
2015-07-30tree-wide: use free_and_strdup()Daniel Mack
Use free_and_strdup() where appropriate and replace equivalent, open-coded versions.
2015-07-28udev: Fix udev_builtin_run_once()Daniel Mack
Honour the boolean return value type. This was an oversight in f89d10ae4.
2015-07-28udev: check more builtins[] pointers before dereferencingDaniel Mack
Fix some more locations where pointers from builtins[] are dereferenced before checking. Related to 8cacf69b1.
2015-07-28Merge pull request #756 from ldzhong/fixDaniel Mack
udev: avoid coredump when initializing udev builtins
2015-07-28udev: avoid coredump when initializing udev builtinsLidong Zhong
If one of the macros(HAVE_BLKID/HAVE_KMOD/HAVE_ACL) is not defined, there will be a coredump
2015-07-25ata_id: remove unused union memberThomas Hindoe Paaboel Andersen
The last use of octa was removed in 01f61d331bb5038f0c877ac03c54333328b6ea28
2015-07-24tree-wide: do not use _cleanup_free_ on const pointersDaniel Mack
free() cannot be used with const pointers. However, our _cleanup_free_ handler features cast logic that hides that qualifier, so we don't get a warning.
2015-07-24Merge pull request #702 from ldzhong/fixDaniel Mack
udev: fix parameter process
2015-07-24udev: fix parameter processLidong Zhong
2015-07-22ata_id: unreverse WWN identifierZbigniew Jędrzejewski-Szmek
An endianness conversion was lost in 6024a6e302bad6bcf073fa84a41a6123305dc845. Restore it. Now ata_id and scsi_id output match. https://bugzilla.redhat.com/show_bug.cgi?id=1227503
2015-07-21udev: unify reporting of invalid cmdline keysMichal Schmidt
This way it does not need distinct string literals and it also preserves the "rd." prefix.
2015-07-21udev: fix crash with invalid udev.log-priorityMichal Schmidt
Fixes: https://bugzilla.redhat.com/show_bug.cgi?id=1245293
2015-07-06tree-wide: fix write_string_file() user that should not create filesDaniel Mack
The latest consolidation cleanup of write_string_file() revealed some users of that helper which should have used write_string_file_no_create() in the past but didn't. Basically, all existing users that write to files in /sys and /proc should not expect to write to a file which is not yet existant.
2015-07-06fileio: consolidate write_string_file*()Daniel Mack
Merge write_string_file(), write_string_file_no_create() and write_string_file_atomic() into write_string_file() and provide a flags mask that allows combinations of atomic writing, newline appending and automatic file creation. Change all users accordingly.
2015-07-01Merge pull request #463 from dvdhrm/udev-runDaniel Mack
udev: destroy manager before cleaning environment
2015-07-01udev: destroy manager before cleaning environmentDavid Herrmann
Due to our _cleanup_ usage for the udev manager, it will be destroyed after the "exit:" label has finished. Therefore, it is the last destruction done in main(). This has two side-effects: - mac_selinux is destroyed before the udev manager is, possible causing use-after-free if the manager-cleanup accesses selinux data - log_close() is called *before* the manager is destroyed, possibly re-opening the log if you use --debug (and thus not re-applying the --debug option) Avoid this by moving the manager-handling into a new function called run(). This function will be left before we enter the "exit:" label in main(), hence, the manager object will be destroyed early.