Commit Graph

78 Commits

Author SHA1 Message Date
Yu Watanabe 8aae9a66fa sd-device,libudev: make an argument for *_set_sysattr_value() const 2018-09-11 12:45:21 +09:00
Yu Watanabe 02e7ae2fdc libudev-device: create sd_device at first in udev_device_new_from_*() 2018-09-11 12:45:21 +09:00
Yu Watanabe 76387b9abb libudev-device: coding style fixes 2018-09-11 12:45:21 +09:00
Yu Watanabe 33a03e6eff libudev-device: fix return value of udev_device_has_tag() 2018-09-11 12:45:21 +09:00
Yu Watanabe 1b6374d285 libudev-device: use original negative errno 2018-09-11 12:45:21 +09:00
Yu Watanabe 71074e3a10 libudev-device: use structured initializer 2018-09-11 12:45:21 +09:00
Yu Watanabe 3c6ac21929 libudev: use DEFINE_PUBLIC_TRIVIAL_REF_UNREF_FUNC() macro where applicable 2018-09-11 12:45:21 +09:00
Yu Watanabe 3938f568a2 libudev: accept NULL as the argument 'struct udev*' for udev_monitor_new() or friends
As udev_monitor struct or friends are now almost independent of udev
struct. So, generating these objects without udev struct is reasonable.
2018-08-23 04:57:39 +09:00
Zbigniew Jędrzejewski-Szmek d9b02e1697 tree-wide: drop copyright headers from frequent contributors
Fixes #9320.

for p in Shapovalov Chevalier Rozhkov Sievers Mack Herrmann Schmidt Rudenberg Sahani Landden Andersen Watanabe; do
  git grep -e 'Copyright.*'$p -l|xargs perl -i -0pe 's|/([*][*])?[*]\s+([*#]\s+)?Copyright[^\n]*'$p'[^\n]*\s*[*]([*][*])?/\n*|\n|gms; s|\s+([*#]\s+)?Copyright[^\n]*'$p'[^\n]*\n*|\n|gms'
done
2018-06-20 11:58:53 +02:00
Lennart Poettering 96b2fb93c5 tree-wide: beautify remaining copyright statements
Let's unify an beautify our remaining copyright statements, with a
unicode ©. This means our copyright statements are now always formatted
the same way. Yay.
2018-06-14 10:20:21 +02:00
Lennart Poettering 818bf54632 tree-wide: drop 'This file is part of systemd' blurb
This part of the copyright blurb stems from the GPL use recommendations:

https://www.gnu.org/licenses/gpl-howto.en.html

The concept appears to originate in times where version control was per
file, instead of per tree, and was a way to glue the files together.
Ultimately, we nowadays don't live in that world anymore, and this
information is entirely useless anyway, as people are very welcome to
copy these files into any projects they like, and they shouldn't have to
change bits that are part of our copyright header for that.

hence, let's just get rid of this old cruft, and shorten our codebase a
bit.
2018-06-14 10:20:20 +02:00
Zbigniew Jędrzejewski-Szmek 11a1589223 tree-wide: drop license boilerplate
Files which are installed as-is (any .service and other unit files, .conf
files, .policy files, etc), are left as is. My assumption is that SPDX
identifiers are not yet that well known, so it's better to retain the
extended header to avoid any doubt.

I also kept any copyright lines. We can probably remove them, but it'd nice to
obtain explicit acks from all involved authors before doing that.
2018-04-06 18:58:55 +02:00
Zbigniew Jędrzejewski-Szmek 87ac8d998f tree-wide: use "cannot" instead of "can not"
This is the usual spelling, and a bit shorter.
2018-02-08 10:34:52 +01:00
Zbigniew Jędrzejewski-Szmek 53e1b68390 Add SPDX license identifiers to source files under the LGPL
This follows what the kernel is doing, c.f.
https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/commit/?id=5fd54ace4721fc5ce2bb5aef6318fcf17f421460.
2017-11-19 19:08:15 +01:00
Peter Hutterer bbb040884d libudev: fix typo in comment 2016-08-19 11:43:58 +10:00
Torstein Husebø 61233823aa treewide: fix typos and remove accidental repetition of words 2016-07-11 16:18:43 +02:00
Thomas Hindoe Paaboel Andersen b4bbcaa9c4 tree-wide: group include of libudev.h with sd-* 2015-11-17 07:06:08 +01:00
Thomas Hindoe Paaboel Andersen cf0fbc49e6 tree-wide: sort includes
Sort the includes accoding to the new coding style.
2015-11-16 22:09:36 +01:00
Lennart Poettering b5efdb8af4 util-lib: split out allocation calls into alloc-util.[ch] 2015-10-27 13:45:53 +01:00
Lennart Poettering 6bedfcbb29 util-lib: split string parsing related calls from util.[ch] into parse-util.[ch] 2015-10-27 13:25:55 +01:00
Lennart Poettering 07630cea1f util-lib: split our string related calls from util.[ch] into its own file string-util.[ch]
There are more than enough calls doing string manipulations to deserve
its own files, hence do something about it.

This patch also sorts the #include blocks of all files that needed to be
updated, according to the sorting suggestions from CODING_STYLE. Since
pretty much every file needs our string manipulation functions this
effectively means that most files have sorted #include blocks now.

Also touches a few unrelated include files.
2015-10-24 23:05:02 +02:00
Tom Gundersen 7bb092142e libudev: device - fix typo in udev_device_get_sysattr_list_entry()
We were adding the attributes to the wrong list.
2015-06-17 22:03:34 +02:00
Tom Gundersen 4189708ad0 sd-device: get_subsystem - don't complain if a device does not have a subsystem 2015-06-02 18:12:47 +02:00
Tom Gundersen 378f61ebef libudev-device: fix lazy loading of devlinks, properties and tags
If the underlying device has not read in the properties yet, the generation will be 0, so
make sure we trigger the reading at least once.
2015-04-23 22:31:25 +02:00
Tom Gundersen f4ac4d1a82 libudev: device - replace by a thin wrapper around sd-device 2015-04-02 00:18:27 +02:00
Tom Gundersen bf0e00ec58 libudev: private - introduce udev_device_new_from_synthetic_event()
This allows set_action(), read_uevent_file() and read_db() to be made internal to libudev.
2015-03-18 14:49:20 +01:00
Zbigniew Jędrzejewski-Szmek cdd45c1ffb udev: downgrade "has devpath" and "filled with db file" messages
Udev debug messages have to be significantly overhauled... For now
just downgrade those two. They are responsible for approximately 25%
of debug output during boot and are rather useless.
2015-03-14 23:03:22 -04:00
Tom Gundersen 1b14c3cfbe udev: make set_usec_initialized() internal to libudev
Instead introduce ensure_usec_initialized(), which copies the timestamp if possible otherwise
sets it to now(CLOCK_MONOTONIC).
2015-03-13 18:47:07 +01:00
Tom Gundersen 8f0f13f045 libudev: introduce clone_with_db()
This allows us to move the db reading from udevd to libudev.
2015-03-12 12:03:50 +01:00
Tom Gundersen 1cd0a77022 libudev: introduce udev_device_properties_copy()
To copy properties from one device to another. Drop the equivalent functionality from udevd.
2015-03-12 11:59:04 +01:00
Tom Gundersen 570b83cc62 libudev: udev_device_read_db - drop unused argument 2015-03-09 23:27:12 +01:00
Tom Gundersen df546eb56a libudev: udev_device_add_property - implicitly mark properties for saving to db
Properties should only be saved to the db when added to the udev_device by udevd, and only if
the property does not start with a '.'. Make this implicit rather than expose the marking of
properties.
2015-03-09 22:50:44 +01:00
Tom Gundersen 3738cc858d udev/libudev: event - move {OLD_,}INTERFACE handling from udevd to libudev
This should be internal to the library as it is only about reflecting the sysfs state in the udev_device.
2015-03-09 22:50:44 +01:00
Tom Gundersen bd57b6de74 libudev: private - make property_from_string_parse* static 2015-03-09 22:50:44 +01:00
Lennart Poettering 63c372cb9d util: rework strappenda(), and rename it strjoina()
After all it is now much more like strjoin() than strappend(). At the
same time, add support for NULL sentinels, even if they are normally not
necessary.
2015-02-03 02:05:59 +01:00
Tom Gundersen 71ef8b3ac4 libudev: private - drop some functions from the internal API 2015-01-26 14:48:04 +01:00
Tom Gundersen 2df959ec3b libudev: monitor - move nulstr parsing to libudev-device
Hide the details a bit.
2015-01-26 14:45:12 +01:00
Tom Gundersen fa639f3ae7 udev: event - introduce and use internal udev_device_shallow_clone() 2015-01-26 14:12:45 +01:00
Tom Gundersen 243d182543 udev: event - move renaming of udev_device to libudev
This is not exposed in the public API. We want to simplify the internal libudev-device API as much as possible
so that it will be simpler to rip the whole thing out in the future.
2015-01-26 13:33:00 +01:00
Zbigniew Jędrzejewski-Szmek 1fa2f38f0f Assorted format fixes
Types used for pids and uids in various interfaces are unpredictable.
Too bad.
2015-01-22 01:14:52 -05:00
Thomas Hindoe Paaboel Andersen c4ef05484d use correct format types 2014-12-11 21:47:06 +01:00
Lennart Poettering 154e6f233a libudev: set errno properly in all error conditions of udev_device_new_from_syspath() 2014-12-03 02:04:55 +01:00
Michal Schmidt 4a62c710b6 treewide: another round of simplifications
Using the same scripts as in f647962d64 "treewide: yet more log_*_errno
+ return simplifications".
2014-11-28 19:57:32 +01:00
Michal Schmidt 56f64d9576 treewide: use log_*_errno whenever %m is in the format string
If the format string contains %m, clearly errno must have a meaningful
value, so we might as well use log_*_errno to have ERRNO= logged.

Using:
find . -name '*.[ch]' | xargs sed -r -i -e \
's/log_(debug|info|notice|warning|error|emergency)\((".*%m.*")/log_\1_errno(errno, \2/'

Plus some whitespace, linewrap, and indent adjustments.
2014-11-28 19:49:27 +01:00
Michal Schmidt ff49bc3212 treewide: drop unnecessary trailing \n in log_*() calls 2014-11-28 14:26:31 +01:00
Kay Sievers 41b848b0ea udev: move global property handling from libudev to udevd 2014-11-13 13:50:01 +01:00
Kay Sievers 25e773eeb4 udev: switch to systemd logging functions 2014-11-13 13:12:57 +01:00
Robert Milasan 572016d1c2 udev: fix path for database names on 'change' event
If a device does not have a major/minor number attached, we use different
database names than if it does. On "change" events, we didn't copy the
devnum over, therefore, we used different paths than on 'add' or 'remove'
events (where devnum was properly copied).

Fix this by always copying the devnum into the udev-device.

(David: added commit-log from email)
2014-09-18 15:28:07 +02:00
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 aa0e72ea54 libudev: set errno when udev_device_new_from_* or udev_device_get_parent_* fail 2014-08-01 11:56:13 +02:00