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