[systemd-devel] [PATCH 1/2] libsystemd: add sd-hwdb library

Tom Gundersen teg at jklm.no
Wed Dec 3 15:57:53 PST 2014

On Wed, Dec 3, 2014 at 10:19 PM, Greg KH <gregkh at linuxfoundation.org> wrote:
> On Wed, Dec 03, 2014 at 10:11:40PM +0100, Tom Gundersen wrote:
>> This is libudev-hwdb, but decoupled from libudev and in the libsystemd style.
>> The core code is unchanged, apart from the following minor changes:
>>  - hwdb.bin located in /**/systemd/hwdb/ take preference over the ones located
>>    in /**/udev/
>>  - properties are stored internally in an OrderedHashmap, rather than a
>>    linked list.
>>  - a new API call allows individual properties to be queried directly, rather
>>    than iterating over them all
>>  - the iteration over properties have been moved inside the library, rather than
>>    exposing a list directly
>>  - the unused 'flags' parameter was dropped
> Why pull this apart?

We'd like to move the libudev API closer to the libsystemd one, and as
the hwdb stuff is actually completely separate from the rest of
libudev, it is a nice place to start I thought. The benefit is rather
minor (consistency of API and improved error handling), but still
worth-while I think.

One point though, which I forgot to mention in the patch description,
is that one more change is made: I dropped the unused struct udev
context and didn't replace it with anything else. I think this fits
with how other things are done in libsystemd, but it _is_ nice to have
a context around for future extensions... What do you think Kay?

> Are other applications wanting to use this?

A couple applications use hwdb directly yes, and in some cases without
using libudev for anything else. If people start using dbus more in
place of the userspace-to-userspace udev transport, then I guess we'll
have more cases of programs using hwdb directly without otherwise
needing libudev, so having these separate (at least their API, if not
the actual .so) makes sense I think. There have been requests for
splitting out hwdb before [0], but I don't think these patches help
much for what they want (and hwdb really does not make sense in a
non-Linux setting anyway, so I'm not really convinced by that feature
request at all).

Thanks for taking a look!



[0]: <https://bugs.freedesktop.org/show_bug.cgi?id=72562>

More information about the systemd-devel mailing list