97c94b9865c239a849cf9870122afd1e9332cf03 |
|
18-Jan-2016 |
Zbigniew Jędrzejewski-Szmek <zbyszek@in.waw.pl> |
sd-device: initialize variables to avoid warning
The code is correct, assuming that the kernel does not feed
us garbled data. Let's initialize those variables to avoid the
warning anyway. |
4afd3348c7506dd1d36305b7bcb9feb8952b9d6b |
|
27-Nov-2015 |
Lennart Poettering <lennart@poettering.net> |
tree-wide: expose "p"-suffix unref calls in public APIs to make gcc cleanup easy
GLIB has recently started to officially support the gcc cleanup
attribute in its public API, hence let's do the same for our APIs.
With this patch we'll define an xyz_unrefp() call for each public
xyz_unref() call, to make it easy to use inside a
__attribute__((cleanup())) expression. Then, all code is ported over to
make use of this.
The new calls are also documented in the man pages, with examples how to
use them (well, I only added docs where the _unref() call itself already
had docs, and the examples, only cover sd_bus_unrefp() and
sd_event_unrefp()).
This also renames sd_lldp_free() to sd_lldp_unref(), since that's how we
tend to call our destructors these days.
Note that this defines no public macro that wraps gcc's attribute and
makes it easier to use. While I think it's our duty in the library to
make our stuff easy to use, I figure it's not our duty to make gcc's own
features easy to use on its own. Most likely, client code which wants to
make use of this should define its own:
#define _cleanup_(function) __attribute__((cleanup(function)))
Or similar, to make the gcc feature easier to use.
Making this logic public has the benefit that we can remove three header
files whose only purpose was to define these functions internally.
See #2008. |
6ad623a3f77e087e308f334525fd4046811f2a9a |
|
03-Nov-2015 |
Lennart Poettering <lennart@poettering.net> |
parse-util: introduce parse_ifindex() and make use of it everywhere
We have enough places where we parse an ifindex, hence introduce a
proper parsing function for it, that verifies all parameters. |
b5efdb8af40ea759a1ea584c1bc44ecc81dd00ce |
|
27-Oct-2015 |
Lennart Poettering <lennart@poettering.net> |
util-lib: split out allocation calls into alloc-util.[ch] |
8fcde01280adcbd07e8205b91ac52b06305b6208 |
|
27-Oct-2015 |
Lennart Poettering <lennart@poettering.net> |
util-lib: split stat()/statfs()/stavfs() related calls into stat-util.[ch] |
f4f15635ec05293ffcc83a5b39f624bbabbd8fd0 |
|
27-Oct-2015 |
Lennart Poettering <lennart@poettering.net> |
util-lib: move a number of fs operations into fs-util.[ch] |
6bedfcbb2970e06a4d3280c8fb62083d252ede73 |
|
27-Oct-2015 |
Lennart Poettering <lennart@poettering.net> |
util-lib: split string parsing related calls from util.[ch] into parse-util.[ch] |
3ffd4af22052963e7a29431721ee204e634bea75 |
|
25-Oct-2015 |
Lennart Poettering <lennart@poettering.net> |
util-lib: split out fd-related operations into fd-util.[ch]
There are more than enough to deserve their own .c file, hence move them
over. |
07630cea1f3a845c09309f197ac7c4f11edd3b62 |
|
24-Oct-2015 |
Lennart Poettering <lennart@poettering.net> |
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. |
a9ec9f29420623133c419ddc8864921a824751fb |
|
06-Oct-2015 |
Kay Sievers <kay@vrfy.org> |
libsystemd: sd-device - translate / vs. ! in sysname
The kernel replaces '/' in device names with '!', we translate that back
to '/' in sysname, when taking sysname as input, we should translate it
back again. |
19c29853804f8806866695d743fd4e3586996dbb |
|
01-Oct-2015 |
Michal Schmidt <mschmidt@redhat.com> |
sd-device: fix format strings after conversion to log_*_errno()
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" |
23446f01480e1d6f72a03d71f9c67cbf34ddaf3b |
|
01-Oct-2015 |
Michal Schmidt <mschmidt@redhat.com> |
tree-wide: add missing errno arguments to log_*_errno()
A few of the recent conversions to log_*_errno() were missing the errno
value arguments.
Fixes: e53fc357a9b "tree-wide: remove a number of invocations of
strerror() and replace by %m" |
e53fc357a9bb9d0a5362ccc4246d598cb0febd5e |
|
30-Sep-2015 |
Lennart Poettering <lennart@poettering.net> |
tree-wide: remove a number of invocations of strerror() and replace by %m
Let's clean up our tree a bit, and reduce invocations of the
thread-unsafe strerror() by replacing it with printf()'s %m specifier. |
bf4c113e179650c07a8f95a14d71f365dbfe66e4 |
|
15-Jul-2015 |
David Herrmann <dh.herrmann@gmail.com> |
sd-device: never return NULL+0
It is highly confusing if a getter function returns 0, but the value is
set to NULL. This, right now, triggers assertions as code relies on the
returned values to be non-NULL.
Like with sd-bus-creds and friends, return 0 only if a value is actually
available.
Discussed with Tom, and actually fixes real bugs as in #512. |
8927b1dad2d4a7330174cb924090b4635a2547fb |
|
14-Jun-2015 |
David Herrmann <dh.herrmann@gmail.com> |
hashmap: fix iterators to not skip entries
Currently, the HASHMAP iterators stop at the first NULL entry in a
hashmap. This is non-obvious and breaks users like sd-device, which
legitimately store NULL values in a hashmap.
Fix all the iterators by taking a pointer to the value storage, instead of
returning it. The iterators now return a boolean that tells whether the
end of the list was reached.
Current users of HASHMAP_FOREACH() are *NOT* changed to explicitly check
for NULL. If it turns out, there were users that inserted NULL into
hashmaps, but didn't properly check for it during iteration, then we
really want to find those and fix them. |
7e518afab9fb55b8052f68888210927259275560 |
|
02-Jun-2015 |
Thomas Hindoe Paaboel Andersen <phomes@gmail.com> |
fix double semicolon typo |
7283a80d10217b929acf58899f016ca06dacdc53 |
|
02-Jun-2015 |
Tom Gundersen <teg@jklm.no> |
sd-device: get_driver - remember if a device does not have a driver
Don't try to read it again. |
4189708ad0cde8e211e38d27de943579772f8869 |
|
02-Jun-2015 |
Tom Gundersen <teg@jklm.no> |
sd-device: get_subsystem - don't complain if a device does not have a subsystem |
53fae771bcf1623cd28791c48fa60d9d5e5086e4 |
|
21-May-2015 |
Zbigniew Jędrzejewski-Szmek <zbyszek@in.waw.pl> |
sd-device: fix return codes on error
asprintf() does not set errno. |
7141e4f62c3f220872df3114c42d9e4b9525e43e |
|
26-Apr-2015 |
Tom Gundersen <teg@jklm.no> |
sd-device: don't retry loading uevent/db files more than once
If for whatever reason there was nothing to load or loading failed, don't keep trying. |
2a2137401b3aef20618308d2b2694e21b0124f89 |
|
26-Apr-2015 |
Tom Gundersen <teg@jklm.no> |
sd-device: don't complain if the uevent file is missing
Only 'real' devices are required to have an uevent file. |
107f2e2526d476c6cc9b81a690391c111027d641 |
|
23-Apr-2015 |
Tom Gundersen <teg@jklm.no> |
udevd: fix REMOVE handling
This reverts b67f944. Lazy loading of device properties does not work for devices
that are received over netlink, as these are sealed. Reinstate the unconditional
loading of the device db.
Reported by: Mantas Mikulėnas <grawity@gmail.com>. |
52d629010db73a9466c359201916494bd55186d1 |
|
21-Apr-2015 |
Tom Gundersen <teg@jklm.no> |
sd-device: set_syspath - return ENODEV when passed something that is not a device |
08232a020bd2571088d3ee06dda07732c5e963d1 |
|
17-Apr-2015 |
Tom Gundersen <teg@jklm.no> |
sd-device: uniformly handle missing devices
sd_device_new_from_* now returns -ENODEV when the device does not exist, and the enumerator
silently drops these errors as missing devices is exepected. |
5a917c064b23c1b8a12d6abd2f9f31c575ddebc6 |
|
14-Apr-2015 |
Tom Gundersen <teg@jklm.no> |
sd-devcie: fix typo |
85091685af65831f379580c75b40776c20e245ee |
|
14-Apr-2015 |
Tom Gundersen <teg@jklm.no> |
sd-device: fix reading of subsystem |
bba061662b0f759abb43bad60c9733305c191045 |
|
14-Apr-2015 |
Tom Gundersen <teg@jklm.no> |
sd-device: allow uevent files to be write-only |
24eb4a30982ed18d4716bd59c454a72f161d5982 |
|
07-Apr-2015 |
David Herrmann <dh.herrmann@gmail.com> |
device: fix sysattr newline cutter
Right now, we always drop the last character of all values we write to
sysfs. Fix this! |
2fe29a46a3e16a787098f9fb410e1b756506fd52 |
|
03-Apr-2015 |
Tom Gundersen <teg@jklm.no> |
sd-device: get_sysattr_value - don't leak returned value
This was getting leaked as a copy was added to the hashmap, simply add the
returned value instead.
This should fix CID #1292806. |
afcac065c0f649ebcf0f450475a8d7c3bc776d14 |
|
03-Apr-2015 |
Tom Gundersen <teg@jklm.no> |
sd-device: initialize variable
sysnum would not be initialized if sysname had no trailing digits. |
57fa1d094cd2c5ac68970526ad0a0754c548e75d |
|
02-Apr-2015 |
Tom Gundersen <teg@jklm.no> |
libsystemd: add sd-device library
This provides equivalent functionality to libudev-device, but in the
systemd style. The public API only caters to creating sd_device objects
from for devices that already exist in /sys, there is no support for
listening for monitoring events or creating devices received over
the udev netlink protocol.
The private API contains the necessary functionality to make sd-device
a drop-in replacement for libudev-device, but which we would not
otherwise want to export. |