Commit Graph

63 Commits

Author SHA1 Message Date
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
Zbigniew Jędrzejewski-Szmek de0671ee7f Remove unnecessary casts in printfs
No functional change expected :)
2014-05-15 15:29:58 +02: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 f6613dd959 libudev: devices received from udev are always initialized 2013-12-18 17:34:22 +01:00
Zbigniew Jędrzejewski-Szmek 572ce4f783 docs: remove unneeded the's in gudev docs
https://bugs.freedesktop.org/show_bug.cgi?id=72164
2013-11-30 20:27:54 -05:00
Lennart Poettering 725d7e6ceb libudev: always return NULL in _unref() APIs
Returning anything else but NULL would suggest the caller's reference
might still be valid, but it isn't, because the caller just invoked
_unref() after all.

This turns the return value into a typesafe shortcut that allows
unreffing and resetting a reference in one line. In contrast to
solutions for this which take a pointer to a pointer to accomplish the
same this solution is just syntactic sugar the developer can make use of
but doesn't have to, and this is particularly useful when immediately
unreffing objects returned by function calls.
2013-11-20 19:36:14 +01:00
Lennart Poettering 994e023433 libudev: always return valid negative error codes on API functions 2013-11-20 19:36:14 +01:00
Kay Sievers b26618399e udev: declare some symbols static 2013-11-13 03:34:24 +01:00
Thomas Hindoe Paaboel Andersen 5eec7de6ad typo fixes in man and comments 2013-08-15 23:38:09 +02:00
Kay Sievers 67410e9f73 hwdb: add --device=<device-id> and --filter=<key name glob> 2013-07-01 22:34:43 +02:00
Kay Sievers 53726349e1 libude: remove special handling of "device" link, it should not be used 2013-03-20 16:11:25 +01:00
Hannes Reinecke 946f182575 libudev: implement udev_device_set_attribute_value() 2013-03-13 17:44:45 +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 5ae18ddc0d libudev: do not resolve $attr{device} symlinks 2012-11-20 18:07:57 +01:00