summaryrefslogtreecommitdiff
path: root/static/freebsd/man9/g_data.9 3.html
blob: 07a20eca001b523d2c8afdc536182d64eabd8081 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
<table class="head">
  <tr>
    <td class="head-ltitle">G_DATA(9)</td>
    <td class="head-vol">Kernel Developer's Manual</td>
    <td class="head-rtitle">G_DATA(9)</td>
  </tr>
</table>
<div class="manual-text">
<section class="Sh">
<h1 class="Sh" id="NAME"><a class="permalink" href="#NAME">NAME</a></h1>
<p class="Pp"><code class="Nm">g_read_data</code>,
    <code class="Nm">g_write_data</code> &#x2014; <span class="Nd">read/write
    data from/to GEOM consumer</span></p>
</section>
<section class="Sh">
<h1 class="Sh" id="SYNOPSIS"><a class="permalink" href="#SYNOPSIS">SYNOPSIS</a></h1>
<p class="Pp"><code class="In">#include
    &lt;<a class="In">geom/geom.h</a>&gt;</code></p>
<p class="Pp"><var class="Ft">void *</var>
  <br/>
  <code class="Fn">g_read_data</code>(<var class="Fa">struct g_consumer
    *cp</var>, <var class="Fa">off_t offset</var>, <var class="Fa">off_t
    length</var>, <var class="Fa">int *error</var>);</p>
<p class="Pp"><var class="Ft">int</var>
  <br/>
  <code class="Fn">g_write_data</code>(<var class="Fa">struct g_consumer
    *cp</var>, <var class="Fa">off_t offset</var>, <var class="Fa">void
    *ptr</var>, <var class="Fa">off_t length</var>);</p>
</section>
<section class="Sh">
<h1 class="Sh" id="DESCRIPTION"><a class="permalink" href="#DESCRIPTION">DESCRIPTION</a></h1>
<p class="Pp">The
    <a class="permalink" href="#g_read_data"><code class="Fn" id="g_read_data">g_read_data</code></a>()
    function reads <var class="Fa">length</var> bytes of data from the provider
    attached to consumer <var class="Fa">cp</var>, starting at offset
    <var class="Fa">offset</var>. The buffer returned from
    <code class="Fn">g_read_data</code>() is allocated with
    <a class="permalink" href="#g_malloc"><code class="Fn" id="g_malloc">g_malloc</code></a>(),
    so it should be freed by the caller with
    <a class="permalink" href="#g_free"><code class="Fn" id="g_free">g_free</code></a>()
    after use. If the operation fails, an error value will be stored in the
    <var class="Fa">error</var> argument if it is not
    <code class="Dv">NULL</code>.</p>
<p class="Pp" id="g_write_data">The
    <a class="permalink" href="#g_write_data"><code class="Fn">g_write_data</code></a>()
    function writes <var class="Fa">length</var> bytes of data from the buffer
    pointed to by <var class="Fa">ptr</var> to the provider attached to consumer
    <var class="Fa">cp</var>, starting at offset
  <var class="Fa">offset</var>.</p>
</section>
<section class="Sh">
<h1 class="Sh" id="RESTRICTIONS/CONDITIONS"><a class="permalink" href="#RESTRICTIONS/CONDITIONS">RESTRICTIONS/CONDITIONS</a></h1>
<p class="Pp">The <var class="Fa">length</var> argument should be a multiple of
    the provider's sectorsize and less than or equal to
    <code class="Dv">DFLTPHYS</code> (<code class="Dv">DFLTPHYS</code> is
    defined in
  <code class="In">&lt;<a class="In">sys/param.h</a>&gt;</code>).</p>
<p class="Pp">The topology lock must not be held.</p>
</section>
<section class="Sh">
<h1 class="Sh" id="RETURN_VALUES"><a class="permalink" href="#RETURN_VALUES">RETURN
  VALUES</a></h1>
<p class="Pp">The <code class="Fn">g_read_data</code>() function returns a
    pointer to a data buffer or <code class="Dv">NULL</code> if an error
    occurred. In that case an error value is stored in the
    <var class="Fa">error</var> argument unless it is
    <code class="Dv">NULL</code>.</p>
<p class="Pp">The <code class="Fn">g_write_data</code>() function returns 0 if
    successful; otherwise an error code is returned.</p>
</section>
<section class="Sh">
<h1 class="Sh" id="ERRORS"><a class="permalink" href="#ERRORS">ERRORS</a></h1>
<p class="Pp">Possible errors:</p>
<dl class="Bl-tag">
  <dt id="EIO">[<a class="permalink" href="#EIO"><code class="Er">EIO</code></a>]</dt>
  <dd>An I/O error occurred while reading from or writing to the consumer.</dd>
  <dt id="EINTEGRITY">[<a class="permalink" href="#EINTEGRITY"><code class="Er">EINTEGRITY</code></a>]</dt>
  <dd>Corrupted data was detected while reading from the consumer.</dd>
</dl>
</section>
<section class="Sh">
<h1 class="Sh" id="SEE_ALSO"><a class="permalink" href="#SEE_ALSO">SEE
  ALSO</a></h1>
<p class="Pp"><a class="Xr">geom(4)</a>,
    <a class="Xr">DECLARE_GEOM_CLASS(9)</a>, <a class="Xr">g_access(9)</a>,
    <a class="Xr">g_attach(9)</a>, <a class="Xr">g_bio(9)</a>,
    <a class="Xr">g_consumer(9)</a>, <a class="Xr">g_event(9)</a>,
    <a class="Xr">g_geom(9)</a>, <a class="Xr">g_provider(9)</a>,
    <a class="Xr">g_provider_by_name(9)</a>,
  <a class="Xr">g_wither_geom(9)</a></p>
</section>
<section class="Sh">
<h1 class="Sh" id="AUTHORS"><a class="permalink" href="#AUTHORS">AUTHORS</a></h1>
<p class="Pp">This manual page was written by <span class="An">Pawel Jakub
    Dawidek</span>
    &lt;<a class="Mt" href="mailto:pjd@FreeBSD.org">pjd@FreeBSD.org</a>&gt;.</p>
</section>
</div>
<table class="foot">
  <tr>
    <td class="foot-date">March 30, 2020</td>
    <td class="foot-os">FreeBSD 15.0</td>
  </tr>
</table>