]>
Commit | Line | Data |
---|---|---|
ec7ea47d ZJS |
1 | <?xml version='1.0'?> |
2 | <!DOCTYPE refentry PUBLIC "-//OASIS//DTD DocBook XML V4.5//EN" | |
eea10b26 | 3 | "http://www.oasis-open.org/docbook/xml/4.5/docbookx.dtd"> |
db9ecf05 | 4 | <!-- SPDX-License-Identifier: LGPL-2.1-or-later --> |
ec7ea47d ZJS |
5 | |
6 | <refentry id="sd_hwdb_new" xmlns:xi="http://www.w3.org/2001/XInclude"> | |
7 | <refentryinfo> | |
8 | <title>sd_hwdb_new</title> | |
9 | <productname>systemd</productname> | |
10 | </refentryinfo> | |
11 | ||
12 | <refmeta> | |
13 | <refentrytitle>sd_hwdb_new</refentrytitle> | |
14 | <manvolnum>3</manvolnum> | |
15 | </refmeta> | |
16 | ||
17 | <refnamediv> | |
18 | <refname>sd_hwdb_new</refname> | |
60f0ba75 | 19 | <refname>sd_hwdb_new_from_path</refname> |
ec7ea47d ZJS |
20 | <refname>sd_hwdb_ref</refname> |
21 | <refname>sd_hwdb_unref</refname> | |
22 | ||
23 | <refpurpose>Create a new hwdb object and create or destroy references to it</refpurpose> | |
24 | </refnamediv> | |
25 | ||
26 | <refsynopsisdiv> | |
27 | <funcsynopsis> | |
28 | <funcsynopsisinfo>#include <systemd/sd-hwdb.h></funcsynopsisinfo> | |
29 | ||
30 | <funcprototype> | |
31 | <funcdef>int <function>sd_hwdb_new</function></funcdef> | |
32 | <paramdef>sd_hwdb **<parameter>hwdb</parameter></paramdef> | |
33 | </funcprototype> | |
34 | ||
60f0ba75 NR |
35 | <funcprototype> |
36 | <funcdef>int <function>sd_hwdb_new_from_path</function></funcdef> | |
37 | <paramdef>const char *<parameter>path</parameter></paramdef> | |
38 | <paramdef>sd_hwdb **<parameter>hwdb</parameter></paramdef> | |
39 | </funcprototype> | |
40 | ||
ec7ea47d ZJS |
41 | <funcprototype> |
42 | <funcdef>sd_hwdb* <function>sd_hwdb_ref</function></funcdef> | |
43 | <paramdef>sd_hwdb *<parameter>hwdb</parameter></paramdef> | |
44 | </funcprototype> | |
45 | ||
46 | <funcprototype> | |
47 | <funcdef>sd_hwdb* <function>sd_hwdb_unref</function></funcdef> | |
48 | <paramdef>sd_hwdb *<parameter>hwdb</parameter></paramdef> | |
49 | </funcprototype> | |
50 | </funcsynopsis> | |
51 | </refsynopsisdiv> | |
52 | ||
53 | <refsect1> | |
54 | <title>Description</title> | |
55 | ||
56 | <para><function>sd_hwdb_new()</function> creates a new hwdb object to access the binary hwdb | |
57 | database. Upon initialization, the file containing the binary representation of the hardware database is | |
58 | located and opened. The new object is returned in <parameter>hwdb</parameter>.</para> | |
59 | ||
60f0ba75 NR |
60 | <para><function>sd_hwdb_new_from_path()</function> may be used to specify the path from which the binary |
61 | hardware database should be opened.</para> | |
62 | ||
ec7ea47d ZJS |
63 | <para>The <parameter>hwdb</parameter> object is reference counted. <function>sd_hwdb_ref()</function> and |
64 | <function>sd_hwdb_unref()</function> may be used to get a new reference or destroy an existing reference | |
65 | to an object. The caller must dispose of the reference acquired with <function>sd_hwdb_new()</function> | |
66 | by calling <function>sd_hwdb_unref()</function> when done with the object.</para> | |
67 | ||
68 | <para>Use | |
69 | <citerefentry><refentrytitle>sd_hwdb_seek</refentrytitle><manvolnum>3</manvolnum></citerefentry>, | |
70 | <citerefentry><refentrytitle>sd_hwdb_get</refentrytitle><manvolnum>3</manvolnum></citerefentry>, and | |
71 | <citerefentry><refentrytitle>sd_hwdb_enumerate</refentrytitle><manvolnum>3</manvolnum></citerefentry> to | |
72 | access entries.</para> | |
73 | </refsect1> | |
74 | ||
75 | <refsect1> | |
76 | <title>Return Value</title> | |
77 | ||
60f0ba75 NR |
78 | <para>On success, <function>sd_hwdb_new()</function> and <function>sd_hwdb_new_from_path()</function> |
79 | return a non-negative integer. On failure, a negative errno-style error code is returned.</para> | |
ec7ea47d ZJS |
80 | |
81 | <para><function>sd_hwdb_ref()</function> always returns the argument. | |
82 | </para> | |
83 | ||
84 | <para><function>sd_hwdb_unref()</function> always returns <constant>NULL</constant>. | |
85 | </para> | |
86 | ||
87 | <refsect2> | |
88 | <title>Errors</title> | |
89 | ||
90 | <para>Returned errors may indicate the following problems:</para> | |
91 | ||
92 | <variablelist> | |
93 | <varlistentry> | |
94 | <term><constant>-ENOENT</constant></term> | |
95 | ||
96 | <listitem><para>The binary hardware database file could not be located. See | |
97 | <citerefentry><refentrytitle>systemd-hwdb</refentrytitle><manvolnum>8</manvolnum></citerefentry> | |
98 | for more information.</para> | |
ec07c3c8 AK |
99 | |
100 | <xi:include href="version-info.xml" xpointer="v246"/> | |
ec7ea47d ZJS |
101 | </listitem> |
102 | </varlistentry> | |
103 | ||
104 | <varlistentry> | |
105 | <term><constant>-EINVAL</constant></term> | |
106 | ||
107 | <listitem><para>The located binary hardware database file is in an incompatible format. | |
ec07c3c8 AK |
108 | </para> |
109 | ||
110 | <xi:include href="version-info.xml" xpointer="v246"/></listitem> | |
ec7ea47d ZJS |
111 | </varlistentry> |
112 | ||
113 | <varlistentry> | |
114 | <term><constant>-ENOMEM</constant></term> | |
115 | ||
ec07c3c8 AK |
116 | <listitem><para>Memory allocation failed.</para> |
117 | ||
118 | <xi:include href="version-info.xml" xpointer="v246"/></listitem> | |
ec7ea47d ZJS |
119 | </varlistentry> |
120 | </variablelist> | |
121 | </refsect2> | |
122 | </refsect1> | |
123 | ||
124 | <xi:include href="libsystemd-pkgconfig.xml" /> | |
125 | ||
69106f47 AK |
126 | <refsect1> |
127 | <title>History</title> | |
00f95506 AK |
128 | <para><function>sd_hwdb_new()</function>, |
129 | <function>sd_hwdb_ref()</function>, and | |
130 | <function>sd_hwdb_unref()</function> were added in version 246.</para> | |
69106f47 AK |
131 | <para><function>sd_hwdb_new_from_path()</function> was added in version 252.</para> |
132 | </refsect1> | |
133 | ||
ec7ea47d ZJS |
134 | <refsect1> |
135 | <title>See Also</title> | |
136 | ||
13a69c12 DT |
137 | <para><simplelist type="inline"> |
138 | <member><citerefentry><refentrytitle>systemd</refentrytitle><manvolnum>1</manvolnum></citerefentry></member> | |
139 | <member><citerefentry><refentrytitle>systemd-udevd.service</refentrytitle><manvolnum>8</manvolnum></citerefentry></member> | |
140 | <member><citerefentry><refentrytitle>sd-hwdb</refentrytitle><manvolnum>3</manvolnum></citerefentry></member> | |
141 | <member><citerefentry><refentrytitle>systemd-hwdb</refentrytitle><manvolnum>3</manvolnum></citerefentry></member> | |
142 | </simplelist></para> | |
ec7ea47d ZJS |
143 | </refsect1> |
144 | ||
145 | </refentry> |