summaryrefslogtreecommitdiff
path: root/static/freebsd/man9/vn_deallocate.9 4.html
blob: b2da14ec098b367c5b69d9cbc686d2ecf8f12722 (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
<table class="head">
  <tr>
    <td class="head-ltitle">VN_DEALLOCATE(9)</td>
    <td class="head-vol">Kernel Developer's Manual</td>
    <td class="head-rtitle">VN_DEALLOCATE(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">vn_deallocate</code> &#x2014;
    <span class="Nd">zero and/or deallocate storage from a file</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">sys/param.h</a>&gt;</code>
  <br/>
  <code class="In">#include &lt;<a class="In">sys/vnode.h</a>&gt;</code></p>
<p class="Pp"><var class="Ft">int</var>
  <br/>
  <code class="Fn">vn_deallocate</code>(<var class="Fa">struct vnode *vp</var>,
    <var class="Fa">off_t *offset</var>, <var class="Fa">off_t *length</var>,
    <var class="Fa">int flags</var>, <var class="Fa">int ioflag</var>,
    <var class="Fa">struct ucred *active_cred</var>, <var class="Fa">struct
    ucred *file_cred</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="#vn_deallocate"><code class="Fn" id="vn_deallocate">vn_deallocate</code></a>()
    function zeros and/or deallocates backing storage space from a file. This
    function only works on vnodes with <code class="Dv">VREG</code> type.</p>
<p class="Pp">The arguments are:</p>
<dl class="Bl-tag">
  <dt><var class="Fa">vp</var></dt>
  <dd>The vnode of the file.</dd>
  <dt><var class="Fa">offset</var></dt>
  <dd>The starting offset of the operation range.</dd>
  <dt><var class="Fa">length</var></dt>
  <dd>The length of the operation range. This must be greater than 0.</dd>
  <dt><var class="Fa">flags</var></dt>
  <dd>The control flags of the operation. This should be set to 0 for now.</dd>
  <dt><var class="Fa">ioflag</var></dt>
  <dd>Directives and hints to be given to the file system.</dd>
  <dt><var class="Fa">active_cred</var></dt>
  <dd>The user credentials of the calling thread.</dd>
  <dt><var class="Fa">file_cred</var></dt>
  <dd>The credentials installed on the file description pointing to the vnode or
      NOCRED.</dd>
</dl>
<p class="Pp" id="ioflag">The
    <a class="permalink" href="#ioflag"><code class="Fn">ioflag</code></a>()
    argument gives directives and hints to the file system. It may include one
    or more of the following flags:</p>
<dl class="Bl-tag">
  <dt id="IO_NODELOCKED"><a class="permalink" href="#IO_NODELOCKED"><code class="Dv">IO_NODELOCKED</code></a></dt>
  <dd>The vnode was locked before the call.</dd>
  <dt id="IO_RANGELOCKED"><a class="permalink" href="#IO_RANGELOCKED"><code class="Dv">IO_RANGELOCKED</code></a></dt>
  <dd>Rangelock was owned around the call.</dd>
  <dt id="IO_NOMACCHECK"><a class="permalink" href="#IO_NOMACCHECK"><code class="Dv">IO_NOMACCHECK</code></a></dt>
  <dd>Skip MAC checking in the call.</dd>
  <dt id="IO_SYNC"><a class="permalink" href="#IO_SYNC"><code class="Dv">IO_SYNC</code></a></dt>
  <dd>Do I/O synchronously.</dd>
  <dt id="IO_DIRECT"><a class="permalink" href="#IO_DIRECT"><code class="Dv">IO_DIRECT</code></a></dt>
  <dd>Attempt to bypass buffer cache.</dd>
</dl>
<p class="Pp"><var class="Fa">*offset</var> and <var class="Fa">*length</var>
    are updated to reflect the unprocessed operation range of the call. For a
    successful completion, <var class="Fa">*length</var> is updated to be the
    value 0, and <var class="Fa">*offset</var> is incremented by the number of
    bytes zeroed before the end-of-file.</p>
</section>
<section class="Sh">
<h1 class="Sh" id="RETURN_VALUES"><a class="permalink" href="#RETURN_VALUES">RETURN
  VALUES</a></h1>
<p class="Pp">Upon successful completion, the value 0 is returned; otherwise the
    appropriate error is returned.</p>
</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">vnode(9)</a>,
  <a class="Xr">VOP_DEALLOCATE(9)</a></p>
</section>
<section class="Sh">
<h1 class="Sh" id="AUTHORS"><a class="permalink" href="#AUTHORS">AUTHORS</a></h1>
<p class="Pp"><code class="Nm">vn_deallocate</code> and this manual page was
    written by <span class="An">Ka Ho Ng</span>
    &lt;<a class="Mt" href="mailto:khng@FreeBSD.org">khng@FreeBSD.org</a>&gt;
    under sponsorship from the FreeBSD Foundation.</p>
</section>
</div>
<table class="foot">
  <tr>
    <td class="foot-date">August 25, 2021</td>
    <td class="foot-os">FreeBSD 15.0</td>
  </tr>
</table>