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
105
106
107
108
109
110
111
112
113
114
115
|
<table class="head">
<tr>
<td class="head-ltitle">VOP_COPY_FILE_RANGE(9)</td>
<td class="head-vol">Kernel Developer's Manual</td>
<td class="head-rtitle">VOP_COPY_FILE_RANGE(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">VOP_COPY_FILE_RANGE</code> —
<span class="Nd">copy a byte range within a file or from one file to another
in a single file system or between multiple file systems</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
<<a class="In">sys/param.h</a>></code>
<br/>
<code class="In">#include <<a class="In">sys/vnode.h</a>></code></p>
<p class="Pp"><var class="Ft">int</var>
<br/>
<code class="Fn">VOP_COPY_FILE_RANGE</code>(<var class="Fa">struct vnode
*invp</var>, <var class="Fa">off_t *inoff</var>, <var class="Fa">struct
vnode *outvp</var>, <var class="Fa">off_t *outoff</var>,
<var class="Fa">size_t *len</var>, <var class="Fa">unsigned int flags</var>,
<var class="Fa">struct ucred *incred</var>, <var class="Fa">struct ucred
*outcred</var>, <var class="Fa">struct thread *fsize_td</var>);</p>
</section>
<section class="Sh">
<h1 class="Sh" id="DESCRIPTION"><a class="permalink" href="#DESCRIPTION">DESCRIPTION</a></h1>
<p class="Pp">This entry point copies a byte range from one regular file to
another or within one file in a single file system.
<var class="Fa">invp</var> and <var class="Fa">outvp</var> can refer to the
same file. For this case, the byte ranges defined by
<var class="Fa">*inoff</var>, <var class="Fa">*outoff and</var>
<var class="Fa">*len</var> will not overlap.</p>
<p class="Pp">The arguments are:</p>
<dl class="Bl-tag">
<dt><var class="Fa">invp</var></dt>
<dd>The vnode of the input file.</dd>
<dt><var class="Fa">inoff</var></dt>
<dd>A pointer to the file offset for the input file.</dd>
<dt><var class="Fa">outvp</var></dt>
<dd>The vnode of the output file.</dd>
<dt><var class="Fa">outoff</var></dt>
<dd>A pointer to the file offset for the output file.</dd>
<dt><var class="Fa">len</var></dt>
<dd>A pointer to the byte count for the copy.</dd>
<dt><var class="Fa">flags</var></dt>
<dd>Flags, should be set to 0 for now.</dd>
<dt><var class="Fa">incred</var></dt>
<dd>The credentials used to read <var class="Fa">invp</var>.</dd>
<dt><var class="Fa">outcred</var></dt>
<dd>The credentials used to write <var class="Fa">outvp</var>.</dd>
<dt><var class="Fa">fsize_td</var></dt>
<dd>The thread pointer to be passed to vn_rlimit_fsize(). This will be
<code class="Dv">NULL</code> for a server thread without limits, such as
for the NFS server or <code class="Dv">curthread</code> otherwise.</dd>
</dl>
<p class="Pp">On entry and on return, the <var class="Fa">inoff</var> and
<var class="Fa">outoff</var> arguments point to the locations of the file
offsets. These file offsets should be updated by the number of bytes copied.
The <var class="Fa">len</var> argument points to the location that stores
the number of bytes to be copied. Upon a successful return
<var class="Fa">len</var> will be updated to the number of bytes actually
copied. Normally, this will be the number of bytes requested to be copied,
however a copy of fewer bytes than requested is permitted. This does not
necessarily indicate that the copy reached EOF on the input file. However,
if the value pointed to by the <var class="Fa">len</var> argument is zero
upon a successful return, it indicates that the offset pointed to by
<var class="Fa">inoff</var> is at or beyond EOF on the input file.</p>
</section>
<section class="Sh">
<h1 class="Sh" id="LOCKS"><a class="permalink" href="#LOCKS">LOCKS</a></h1>
<p class="Pp">The vnode are unlocked on entry and must be unlocked on return.
The byte ranges for both <var class="Fa">invp</var> and
<var class="Fa">outvp</var> should be range locked when this call is
done.</p>
</section>
<section class="Sh">
<h1 class="Sh" id="RETURN_VALUES"><a class="permalink" href="#RETURN_VALUES">RETURN
VALUES</a></h1>
<p class="Pp">Zero is returned on success, otherwise an error code is
returned.</p>
</section>
<section class="Sh">
<h1 class="Sh" id="ERRORS"><a class="permalink" href="#ERRORS">ERRORS</a></h1>
<dl class="Bl-tag">
<dt id="EFBIG">[<a class="permalink" href="#EFBIG"><code class="Er">EFBIG</code></a>]</dt>
<dd>If the copy exceeds the process's file size limit or the maximum file size
for the file system <var class="Fa">invp</var> and
<var class="Fa">outvp</var> reside on.</dd>
<dt id="EINTR">[<a class="permalink" href="#EINTR"><code class="Er">EINTR</code></a>]</dt>
<dd>A signal interrupted the VOP call before it could be completed.</dd>
<dt id="EIO">[<a class="permalink" href="#EIO"><code class="Er">EIO</code></a>]</dt>
<dd>An I/O error occurred while reading/writing the files.</dd>
<dt id="EINTEGRITY">[<a class="permalink" href="#EINTEGRITY"><code class="Er">EINTEGRITY</code></a>]</dt>
<dd>Corrupted data was detected while reading/writing the files.</dd>
<dt id="ENOSPC">[<a class="permalink" href="#ENOSPC"><code class="Er">ENOSPC</code></a>]</dt>
<dd>The file system is full.</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">vn_rdwr(9)</a>, <a class="Xr">vnode(9)</a></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>
|