]> git.ipfire.org Git - thirdparty/systemd.git/blob - man/sd_hwdb_new.xml
man: add version information for functions
[thirdparty/systemd.git] / man / sd_hwdb_new.xml
1 <?xml version='1.0'?>
2 <!DOCTYPE refentry PUBLIC "-//OASIS//DTD DocBook XML V4.5//EN"
3 "http://www.oasis-open.org/docbook/xml/4.2/docbookx.dtd">
4 <!-- SPDX-License-Identifier: LGPL-2.1-or-later -->
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>
19 <refname>sd_hwdb_new_from_path</refname>
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 &lt;systemd/sd-hwdb.h&gt;</funcsynopsisinfo>
29
30 <funcprototype>
31 <funcdef>int <function>sd_hwdb_new</function></funcdef>
32 <paramdef>sd_hwdb **<parameter>hwdb</parameter></paramdef>
33 </funcprototype>
34
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
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
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
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
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>
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>
99
100 <xi:include href="version-info.xml" xpointer="v246"/>
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.
108 </para>
109
110 <xi:include href="version-info.xml" xpointer="v246"/></listitem>
111 </varlistentry>
112
113 <varlistentry>
114 <term><constant>-ENOMEM</constant></term>
115
116 <listitem><para>Memory allocation failed.</para>
117
118 <xi:include href="version-info.xml" xpointer="v246"/></listitem>
119 </varlistentry>
120 </variablelist>
121 </refsect2>
122 </refsect1>
123
124 <xi:include href="libsystemd-pkgconfig.xml" />
125
126 <refsect1>
127 <title>History</title>
128 <para><function>sd_hwdb_new()</function> was added in version 246.</para>
129 <para><function>sd_hwdb_ref()</function> was added in version 246.</para>
130 <para><function>sd_hwdb_unref()</function> was added in version 246.</para>
131 <para><function>sd_hwdb_new_from_path()</function> was added in version 252.</para>
132 </refsect1>
133
134 <refsect1>
135 <title>See Also</title>
136
137 <para>
138 <citerefentry><refentrytitle>systemd</refentrytitle><manvolnum>1</manvolnum></citerefentry>,
139 <citerefentry><refentrytitle>systemd-udevd.service</refentrytitle><manvolnum>8</manvolnum></citerefentry>,
140 <citerefentry><refentrytitle>sd-hwdb</refentrytitle><manvolnum>3</manvolnum></citerefentry>,
141 <citerefentry><refentrytitle>systemd-hwdb</refentrytitle><manvolnum>3</manvolnum></citerefentry>
142 </para>
143 </refsect1>
144
145 </refentry>