summaryrefslogtreecommitdiff
path: root/static/freebsd/man4/disk.4 3.html
blob: 3aa31a90395fc287168267bb73820883075a03c5 (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
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
<table class="head">
  <tr>
    <td class="head-ltitle">disk(4)</td>
    <td class="head-vol">Device Drivers Manual</td>
    <td class="head-rtitle">disk(4)</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">disk</code> &#x2014; <span class="Nd">common disk
    interfaces</span></p>
</section>
<section class="Sh">
<h1 class="Sh" id="SYNOPSIS"><a class="permalink" href="#SYNOPSIS">SYNOPSIS</a></h1>
<p class="Pp"><code class="Cd">device cd</code></p>
</section>
<section class="Sh">
<h1 class="Sh" id="DESCRIPTION"><a class="permalink" href="#DESCRIPTION">DESCRIPTION</a></h1>
<p class="Pp">Common block device IOCTLs</p>
<p class="Pp">All the block devices in the system should support these disk
    <a class="Xr">ioctl(2)</a> commands defined here. Much of this information
    is also available via the <a class="Xr">geom(2)</a> attributes.</p>
</section>
<section class="Sh">
<h1 class="Sh" id="IOCTLS"><a class="permalink" href="#IOCTLS">IOCTLS</a></h1>
<p class="Pp">The following <a class="Xr">ioctl(2)</a> calls apply to disk
    drives, and are defined in the
    <code class="In">&lt;<a class="In">sys/disk.h</a>&gt;</code> header
  file.</p>
<dl class="Bl-tag">
  <dt id="DIOCGSECTORSIZE"><a class="permalink" href="#DIOCGSECTORSIZE"><code class="Dv">DIOCGSECTORSIZE</code></a></dt>
  <dd>(<code class="Li">u_int</code>) Get the sector or block size of the device
      in bytes. The sector size is the smallest unit of data which can be
      transferred from this device. This is usually a power of 2 but it might
      not be (e.g. CDROM audio). Operations to block devices such as
      <a class="Xr">lseek(2)</a>, <a class="Xr">read(2)</a>, and
      <a class="Xr">write(2)</a> may only be performed at file offsets that are
      integral multiple of this size.</dd>
  <dt id="DIOCGMEDIASIZE"><a class="permalink" href="#DIOCGMEDIASIZE"><code class="Dv">DIOCGMEDIASIZE</code></a></dt>
  <dd>(<code class="Li">off_t</code>) Get the size of the entire device in
      bytes. This should be a multiple of the sector size.</dd>
  <dt id="DIOCGFWSECTORS"><a class="permalink" href="#DIOCGFWSECTORS"><code class="Dv">DIOCGFWSECTORS</code></a></dt>
  <dd>(<code class="Li">u_int</code>) Return the firmware's notion of number of
      sectors per track. This value is mostly used for compatibility with
      various ill designed disk label formats. Use this value only when
      absolutely required. Its interpretation and use is largely obsolete.</dd>
  <dt id="DIOCGFWHEADS"><a class="permalink" href="#DIOCGFWHEADS"><code class="Dv">DIOCGFWHEADS</code></a></dt>
  <dd>(<code class="Li">u_int</code>) Return the firmware's notion of number of
      heads per cylinder. This value is mostly used for compatibility with
      various ill designed disk label formats. Use this value only when
      absolutely required. Its interpretation and use is largely obsolete.</dd>
  <dt id="DIOCGFLUSH"><a class="permalink" href="#DIOCGFLUSH"><code class="Dv">DIOCGFLUSH</code></a></dt>
  <dd>Flush write cache of the device.</dd>
  <dt id="DIOCGDELETE"><a class="permalink" href="#DIOCGDELETE"><code class="Dv">DIOCGDELETE</code></a></dt>
  <dd>(<code class="Li">off_t[2]</code>) Mark data on the device as unused. The
      first element is the offset to start deleting. The second element is the
      length to delete. Providers may use this information to free storage or
      instruct storage devices the contents can be discarded.</dd>
  <dt id="DIOCGIDENT"><a class="permalink" href="#DIOCGIDENT"><code class="Dv">DIOCGIDENT</code></a></dt>
  <dd>(<code class="Li">char[DISK_IDENT_SIZE]</code>) Get the ident for this
      provider. Ident is a unique and fixed identifier for this provider.
      Ident's properties are as follow:
    <ul class="Bl-bullet">
      <li>preserved between reboots,</li>
      <li>preserved across a provider being detached/attached,</li>
      <li>provider's name can change - ident can't,</li>
      <li>ident value should not be based on on-disk metadata; in other words,
          copying whole data from one disk to another should not yield the same
          ident for the other disk,</li>
      <li>there can be more than one provider with the same ident, but only if
          they point at exactly the same physical storage, this is the case for
          multipathing for example,</li>
      <li>GEOM classes that consume a single provider and provide single
          provider, like <a class="Xr">geli(8)</a>, the identifier should be
          formed by attaching that provider's class name to the ident of the
          underlying provider,</li>
      <li>ident is an NUL-terminated ASCII string (is printable),</li>
      <li>ident is optional and applications can't relay on its presence.</li>
    </ul>
  </dd>
  <dt id="DIOCGPROVIDERNAME"><a class="permalink" href="#DIOCGPROVIDERNAME"><code class="Dv">DIOCGPROVIDERNAME</code></a></dt>
  <dd>(<code class="Li">char[MAXPATHLEN]</code>) Store the provider name for the
      device in a buffer. The buffer must be at least MAXPATHLEN bytes
    long.</dd>
  <dt id="DIOCGSTRIPESIZE"><a class="permalink" href="#DIOCGSTRIPESIZE"><code class="Dv">DIOCGSTRIPESIZE</code></a></dt>
  <dd>(<code class="Li">off_t</code>) Get the size of the device's optimal
      access block in bytes. This should be a multiple of the sector size.</dd>
  <dt id="DIOCGSTRIPEOFFSET"><a class="permalink" href="#DIOCGSTRIPEOFFSET"><code class="Dv">DIOCGSTRIPEOFFSET</code></a></dt>
  <dd>(<code class="Li">off_t</code>) Get the offset of the first device's
      optimal access block in bytes. This should be a multiple of the sector
      size.</dd>
  <dt id="DIOCGPHYSPATH"><a class="permalink" href="#DIOCGPHYSPATH"><code class="Dv">DIOCGPHYSPATH</code></a></dt>
  <dd>(<code class="Li">char[MAXPATHLEN]</code>) Get a string defining the
      physical path for a given provider. This has similar rules to ident, but
      is intended to uniquely identify the physical location of the device, not
      the current occupant of that location. The buffer must be at least
      MAXPATHLEN bytes long.</dd>
  <dt id="DIOCGATTR"><a class="permalink" href="#DIOCGATTR"><code class="Dv">DIOCGATTR</code></a></dt>
  <dd>(<code class="Li">struct diocgattr_arg</code>)
    <div class="Bd Pp Bd-indent Li">
    <pre>struct diocgattr_arg {
	char name[64];
	int len;
	union {
		char str[DISK_IDENT_SIZE];
		off_t off;
		int i;
		uint16_t u16;
	} value;
};</pre>
    </div>
    Get a geom attribute from the provider. Format of the returned data is
      specific to the attribute.</dd>
  <dt id="DIOCZONECMD"><a class="permalink" href="#DIOCZONECMD"><code class="Dv">DIOCZONECMD</code></a></dt>
  <dd>(<code class="Li">struct disk_zone_arg</code>) Send disk zone
    commands.</dd>
  <dt id="DIOCSKERNELDUMP"><a class="permalink" href="#DIOCSKERNELDUMP"><code class="Dv">DIOCSKERNELDUMP</code></a></dt>
  <dd>(<code class="Li">struct diocskerneldump_arg</code>) Enable/Disable the
      device for kernel core dumps.</dd>
  <dt id="DIOCGKERNELDUMP"><a class="permalink" href="#DIOCGKERNELDUMP"><code class="Dv">DIOCGKERNELDUMP</code></a></dt>
  <dd>(<code class="Li">struct diocskerneldump_arg</code>) Get current kernel
      netdump configuration details for a given index.
    <div class="Bd Pp Bd-indent Li">
    <pre>/*
 * Sentinel values for kda_index.
 *
 * If kda_index is KDA_REMOVE_ALL, all dump configurations are cleared.
 *
 * If kda_index is KDA_REMOVE_DEV, all dump configurations for the specified
 * device are cleared.
 *
 * If kda_index is KDA_REMOVE, only the specified dump configuration for the
 * given device is removed from the list of fallback dump configurations.
 *
 * If kda_index is KDA_APPEND, the dump configuration is added after all
 * existing dump configurations.
 *
 * Otherwise, the new configuration is inserted into the fallback dump list at
 * index 'kda_index'.
 */
#define	KDA_REMOVE		UINT8_MAX
#define	KDA_REMOVE_ALL		(UINT8_MAX - 1)
#define	KDA_REMOVE_DEV		(UINT8_MAX - 2)
#define	KDA_APPEND		(UINT8_MAX - 3)
struct diocskerneldump_arg {
	uint8_t		 kda_index;
	uint8_t		 kda_compression;
	uint8_t		 kda_encryption;
	uint8_t		 kda_key[KERNELDUMP_KEY_MAX_SIZE];
	uint32_t	 kda_encryptedkeysize;
	uint8_t		*kda_encryptedkey;
	char		 kda_iface[IFNAMSIZ];
	union kd_ip	 kda_server;
	union kd_ip	 kda_client;
	union kd_ip	 kda_gateway;
	uint8_t		 kda_af;
};</pre>
    </div>
  </dd>
</dl>
</section>
<section class="Sh">
<h1 class="Sh" id="HISTORY"><a class="permalink" href="#HISTORY">HISTORY</a></h1>
<p class="Pp">The manual page was written by <span class="An">M Warner
    Losh</span>
    &lt;<a class="Mt" href="mailto:imp@FreeBSD.org">imp@FreeBSD.org</a>&gt; from
    text largely derived from
    <code class="In">&lt;<a class="In">sys/disk.h</a>&gt;</code>.</p>
</section>
</div>
<table class="foot">
  <tr>
    <td class="foot-date">November 20, 2020</td>
    <td class="foot-os">FreeBSD 15.0</td>
  </tr>
</table>