summaryrefslogtreecommitdiff
path: root/src/libsystemd/sd-device/device-private.c
AgeCommit message (Collapse)Author
2016-05-25stuffLuke Shumaker
2015-11-27tree-wide: expose "p"-suffix unref calls in public APIs to make gcc cleanup easyLennart Poettering
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.
2015-10-27util-lib: split out allocation calls into alloc-util.[ch]Lennart Poettering
2015-10-27user-util: move UID/GID related macros from macro.h to user-util.hLennart Poettering
2015-10-27util-lib: move string table stuff into its own string-table.[ch]Lennart Poettering
2015-10-27util-lib: move a number of fs operations into fs-util.[ch]Lennart Poettering
2015-10-27util-lib: split string parsing related calls from util.[ch] into parse-util.[ch]Lennart Poettering
2015-10-25util-lib: split out fd-related operations into fd-util.[ch]Lennart Poettering
There are more than enough to deserve their own .c file, hence move them over.
2015-10-24util-lib: split our string related calls from util.[ch] into its own file ↵Lennart Poettering
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-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-07-29tree-wide: port everything over to fflush_and_check()Lennart Poettering
Some places invoked fflush() directly with their own manual error checking, let's unify all that by using fflush_and_check(). This also unifies the general error paths of fflush()+rename() file writers.
2015-06-01sd-device: ensure update_properties_buf() is a noop on failureTom Gundersen
Don't clobber the sd_device struct, and don't leak memory when memory allocation fails.
2015-06-01sd-device: fix invalid property strv pointersMartin Pitt
In device_update_properties_bufs(), the strv is built from pointers into the single nul-terminated buf_nulstr string, to avoid allocating the key=value strings twice. However, we must not do that while building and GREEDY_REALLOC0()'ing buf_nulstr, as each time when this actually reallocates memory the pointers we wrote into buf_strv so far become invalid. So change the logic to first completely build the new buf_nulstr, and then iterate over it to pick out the pointers to the individual key=value strings for properties_strv. This fixes invalid environment for udev callouts.
2015-05-27sd-device: fix device_get_properties_strv()Tom Gundersen
A NULL pointer was inserted as the first element of the strv. This had the effect of always passing the empty environment to processes spawned by udev. Reported by Michał Bartoszkiewicz.
2015-04-23udevd: fix REMOVE handlingTom Gundersen
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>.
2015-04-05sd-device: don't use alloca() within loopsTom Gundersen
I shall not use alloca() within loops I shall not use alloca() within loops I shall not use alloca() within loops I shall not use alloca() within loops ...
2015-04-03sd-device,udevd: fix spelling /ammend/amend/Tom Gundersen
2015-04-03sd-device: fix deserialization from netlinkTom Gundersen
Use the standard FOREACH_WORD* macros. The current code was broken in the devlink case so the last one received was being dropped, causing https://bugs.freedesktop.org/show_bug.cgi?id=89894
2015-04-03sd-device: get_properties_{nulstr,strv} - don't recreate the buffer ↵Tom Gundersen
unnecessarily
2015-04-02libsystemd: add sd-device libraryTom Gundersen
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.