]> git.ipfire.org Git - thirdparty/systemd.git/blame - src/systemd/sd-hwdb.h
man: add sd_bus_message_new_signal(3)
[thirdparty/systemd.git] / src / systemd / sd-hwdb.h
CommitLineData
53e1b683 1/* SPDX-License-Identifier: LGPL-2.1+ */
23fbe14f
TG
2#ifndef foosdhwdbhfoo
3#define foosdhwdbhfoo
4
5/***
23fbe14f
TG
6 systemd is free software; you can redistribute it and/or modify it
7 under the terms of the GNU Lesser General Public License as published by
8 the Free Software Foundation; either version 2.1 of the License, or
9 (at your option) any later version.
10
11 systemd is distributed in the hope that it will be useful, but
12 WITHOUT ANY WARRANTY; without even the implied warranty of
13 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
14 Lesser General Public License for more details.
15
16 You should have received a copy of the GNU Lesser General Public License
17 along with systemd; If not, see <http://www.gnu.org/licenses/>.
18***/
19
20#include "_sd-common.h"
21
22_SD_BEGIN_DECLARATIONS;
23
24typedef struct sd_hwdb sd_hwdb;
25
26sd_hwdb *sd_hwdb_ref(sd_hwdb *hwdb);
27sd_hwdb *sd_hwdb_unref(sd_hwdb *hwdb);
28
29int sd_hwdb_new(sd_hwdb **ret);
30
31int sd_hwdb_get(sd_hwdb *hwdb, const char *modalias, const char *key, const char **value);
32
33int sd_hwdb_seek(sd_hwdb *hwdb, const char *modalias);
34int sd_hwdb_enumerate(sd_hwdb *hwdb, const char **key, const char **value);
35
04c01369 36/* the inverse condition avoids ambiguity of dangling 'else' after the macro */
0b931571 37#define SD_HWDB_FOREACH_PROPERTY(hwdb, modalias, key, value) \
bff686e2
DH
38 if (sd_hwdb_seek(hwdb, modalias) < 0) { } \
39 else while (sd_hwdb_enumerate(hwdb, &(key), &(value)) > 0)
23fbe14f 40
4afd3348
LP
41_SD_DEFINE_POINTER_CLEANUP_FUNC(sd_hwdb, sd_hwdb_unref);
42
04c01369
LP
43_SD_END_DECLARATIONS;
44
23fbe14f 45#endif