]> git.proxmox.com Git - systemd.git/blame - man/sd_id128_to_string.html
Imported Upstream version 219
[systemd.git] / man / sd_id128_to_string.html
CommitLineData
663996b3
MS
1<html><head><meta http-equiv="Content-Type" content="text/html; charset=UTF-8"><title>sd_id128_to_string</title><meta name="generator" content="DocBook XSL Stylesheets V1.78.1"></head><body bgcolor="white" text="black" link="#0000FF" vlink="#840084" alink="#0000FF"><style>
2 a.headerlink {
3 color: #c60f0f;
4 font-size: 0.8em;
5 padding: 0 4px 0 4px;
6 text-decoration: none;
7 visibility: hidden;
8 }
9
10 a.headerlink:hover {
11 background-color: #c60f0f;
12 color: white;
13 }
14
15 h1:hover > a.headerlink, h2:hover > a.headerlink, h3:hover > a.headerlink, dt:hover > a.headerlink {
16 visibility: visible;
17 }
18 </style><a href="index.html">Index </a>·
19 <a href="systemd.directives.html">Directives </a>·
20 <a href="../python-systemd/index.html">Python </a>·
21 <a href="../libudev/index.html">libudev </a>·
e735f4d4
MP
22 <a href="../libudev/index.html">gudev </a><span style="float:right">systemd 219</span><hr><div class="refentry"><a name="sd_id128_to_string"></a><div class="titlepage"></div><div class="refnamediv"><h2>Name</h2><p>sd_id128_to_string, sd_id128_from_string — Format or parse 128-bit IDs as strings</p></div><div class="refsynopsisdiv"><h2>Synopsis</h2><div class="funcsynopsis"><pre class="funcsynopsisinfo">#include &lt;systemd/sd-id128.h&gt;</pre><table border="0" class="funcprototype-table" summary="Function synopsis" style="cellspacing: 0; cellpadding: 0;"><tr><td><code class="funcdef">char *<b class="fsfunc">sd_id128_to_string</b>(</code></td><td>sd_id128_t <var class="pdparam">id</var>, char <var class="pdparam">s</var>[33]<code>)</code>;</td></tr></table><div class="funcprototype-spacer"> </div><table border="0" class="funcprototype-table" summary="Function synopsis" style="cellspacing: 0; cellpadding: 0;"><tr><td><code class="funcdef">int <b class="fsfunc">sd_id128_from_string</b>(</code></td><td>const char *<var class="pdparam">s</var>, sd_id128_t *<var class="pdparam">ret</var><code>)</code>;</td></tr></table><div class="funcprototype-spacer"> </div></div></div><div class="refsect1"><a name="idm140369556398160"></a><h2 id="Description">Description<a class="headerlink" title="Permalink to this headline" href="#Description">¶</a></h2><p><code class="function">sd_id128_to_string()</code> formats a 128-bit
23 ID as a character string. It expects the ID and a string array
24 capable of storing 33 characters. The ID will be formatted as 32
25 lowercase hexadecimal digits and be terminated by a
26 <code class="constant">NUL</code> byte.</p><p><code class="function">sd_id128_from_string()</code> implements the
27 reverse operation: it takes a 33 character string with 32
28 hexadecimal digits (either lowercase or uppercase, terminated by
29 <code class="constant">NUL</code>) and parses them back into a 128-bit ID
30 returned in <em class="parameter"><code>ret</code></em>. Alternatively, this call
31 can also parse a 37-character string with a 128-bit ID formatted
32 as RFC UUID.</p><p>For more information about the "<code class="literal">sd_id128_t</code>"
33 type see
34 <a href="sd-id128.html"><span class="citerefentry"><span class="refentrytitle">sd-id128</span>(3)</span></a>.
35 Note that these calls operate the same way on all architectures,
36 i.e. the results do not depend on endianness.</p><p>When formatting a 128-bit ID into a string, it is often
37 easier to use a format string for
38 <a href="http://man7.org/linux/man-pages/man3/printf.3.html"><span class="citerefentry"><span class="refentrytitle">printf</span>(3)</span></a>.
39 This is easily done using the
40 <code class="function">SD_ID128_FORMAT_STR</code> and
41 <code class="function">SD_ID128_FORMAT_VAL()</code> macros. For more
42 information see
43 <a href="sd-id128.html"><span class="citerefentry"><span class="refentrytitle">sd-id128</span>(3)</span></a>.</p></div><div class="refsect1"><a name="idm140369560290192"></a><h2 id="Return Value">Return Value<a class="headerlink" title="Permalink to this headline" href="#Return%20Value">¶</a></h2><p><code class="function">sd_id128_to_string()</code> always succeeds
44 and returns a pointer to the string array passed in.
45 <code class="function">sd_id128_from_string</code> returns 0 on success, in
46 which case <em class="parameter"><code>ret</code></em> is filled in, or a negative
47 errno-style error code.</p></div><div class="refsect1"><a name="idm140369560287104"></a><h2 id="Notes">Notes<a class="headerlink" title="Permalink to this headline" href="#Notes">¶</a></h2><p>The <code class="function">sd_id128_to_string()</code> and
48 <code class="function">sd_id128_from_string()</code> interfaces are
49 available as a shared library, which can be compiled and linked to
50 with the
51 "<code class="literal">libsystemd</code>" <a href="http://linux.die.net/man/1/pkg-config"><span class="citerefentry"><span class="refentrytitle">pkg-config</span>(1)</span></a>
52 file.</p></div><div class="refsect1"><a name="idm140369560282528"></a><h2 id="See Also">See Also<a class="headerlink" title="Permalink to this headline" href="#See%20Also">¶</a></h2><p>
53 <a href="systemd.html"><span class="citerefentry"><span class="refentrytitle">systemd</span>(1)</span></a>,
54 <a href="sd-id128.html"><span class="citerefentry"><span class="refentrytitle">sd-id128</span>(3)</span></a>,
55 <a href="http://man7.org/linux/man-pages/man3/printf.3.html"><span class="citerefentry"><span class="refentrytitle">printf</span>(3)</span></a>
56 </p></div></div></body></html>