summaryrefslogtreecommitdiff
path: root/src/udev
AgeCommit message (Collapse)AuthorFilesLines
2015-10-05document ability to disable MACAddressPolicyJacob Keller2-1/+4
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 Sievers1-1/+2
Enhance matching of TAG keys
2015-10-01udev: fix format string after conversion to log_*_errno()Michal Schmidt1-1/+1
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 Franciosi1-1/+2
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 Poettering2-5/+4
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 Poettering1-21/+22
2015-09-22udev: ata_id - ATA_ID_SATA_CAPABILITY == 76Kay Sievers1-5/+5
2015-09-21Fixup WWN bytes for big-endian systemsTom Lyon1-0/+4
2015-09-09tree-wide: replace while(1) by for(;;) everywhereLennart Poettering4-4/+4
Another Coccinelle script.
2015-09-09tree-wide: update empty-if coccinelle script to cover empty-while and moreLennart Poettering6-23/+15
Let's also clean up single-line while and for blocks.
2015-09-09Merge pull request #1207 from poettering/coccinelle-fixesDaniel Mack6-44/+17
Coccinelle fixes
2015-09-09tree-wide: drop {} from one-line if blocksLennart Poettering5-12/+6
Patch via coccinelle.
2015-09-09tree-wide: make use of log_error_errno() return valueLennart Poettering2-10/+4
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 Poettering1-12/+4
Replace this: if (fd >= 0) safe_close(fd); by this: safe_close(fd);
2015-09-09tree-wide: make more code use safe_close()Lennart Poettering1-8/+4
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 Poettering1-6/+3
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 Milburn1-12/+34
/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 ENODATAv226David Herrmann1-1/+1
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 Herrmann1-1/+1
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 Gundersen1-0/+8
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 Sievers1-0/+5
2015-08-17Bug #944: Deletion of unnecessary checks before calls of the function "free"Markus Elfring1-8/+4
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 Gundersen1-1/+2
treewide: trivial issues detected by smatch
2015-08-11gpt-auto-generator: apply partition-type flags only to specific partition-typesKay Sievers1-0/+5
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 Zak1-1/+2
2015-08-06Merge pull request #883 from phomes/bool_vs_error_codesDaniel Mack1-2/+2
tree-wide: do not return error codes as bool
2015-08-06tree-wide: do not return error codes as boolThomas Hindoe Paaboel Andersen1-2/+2
2015-08-06tree-wide: fix indentationThomas Hindoe Paaboel Andersen1-1/+1
2015-08-05udev: uaccess - do not log error when device node disappearsKay Sievers1-2/+2
https://github.com/systemd/systemd/issues/875
2015-08-04smack-util: revise smack-util apis and add read smack attr apisWaLyong Cho1-2/+2
- 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 Poettering1-18/+10
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 Herrmann2-10/+5
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 Mack1-2/+1
Use free_and_strdup() where appropriate and replace equivalent, open-coded versions.
2015-07-28udev: Fix udev_builtin_run_once()Daniel Mack1-1/+1
Honour the boolean return value type. This was an oversight in f89d10ae4.
2015-07-28udev: check more builtins[] pointers before dereferencingDaniel Mack1-0/+9
Fix some more locations where pointers from builtins[] are dereferenced before checking. Related to 8cacf69b1.
2015-07-28Merge pull request #756 from ldzhong/fixDaniel Mack1-5/+6
udev: avoid coredump when initializing udev builtins
2015-07-28udev: avoid coredump when initializing udev builtinsLidong Zhong1-5/+6
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 Andersen1-1/+0
The last use of octa was removed in 01f61d331bb5038f0c877ac03c54333328b6ea28
2015-07-24tree-wide: do not use _cleanup_free_ on const pointersDaniel Mack1-1/+1
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 Mack1-1/+1
udev: fix parameter process
2015-07-24udev: fix parameter processLidong Zhong1-1/+1
2015-07-22ata_id: unreverse WWN identifierZbigniew Jędrzejewski-Szmek1-2/+12
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 Schmidt1-10/+11
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 Schmidt1-1/+4
Fixes: https://bugzilla.redhat.com/show_bug.cgi?id=1245293
2015-07-06tree-wide: fix write_string_file() user that should not create filesDaniel Mack1-2/+2
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 Mack1-5/+5
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 Mack1-28/+36
udev: destroy manager before cleaning environment
2015-07-01udev: destroy manager before cleaning environmentDavid Herrmann1-28/+36
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.
2015-07-01udevd: force --debug mode to stderrKay Sievers1-1/+3
https://github.com/systemd/systemd/issues/462
2015-06-30Merge pull request #411 from teg/udev-simplify-exec-envpKay Sievers3-36/+28
udev: event - simplify udev_event_spawn() logic