2 * SPDX-License-Identifier: Beerware
4 * ----------------------------------------------------------------------------
5 * "THE BEER-WARE LICENSE" (Revision 42):
6 * <phk@FreeBSD.ORG> wrote this file. As long as you retain this notice you
7 * can do whatever you want with this stuff. If we meet some day, and you think
8 * this stuff is worth it, you can buy me a beer in return. Poul-Henning Kamp
9 * ----------------------------------------------------------------------------
18 #include <sys/ioccom.h>
19 #include <sys/kerneldump.h>
20 #include <sys/types.h>
21 #include <sys/disk_zone.h>
22 #include <sys/socket.h>
27 #include <sys/conf.h> /* XXX: temporary to avoid breakage */
30 void disk_err(struct bio *bp, const char *what, int blkdone, int nl);
34 #define DIOCGSECTORSIZE _IOR('d', 128, u_int)
36 * Get the sector size of the device in bytes. The sector size is the
37 * smallest unit of data which can be transferred from this device.
38 * Usually this is a power of 2 but it might not be (i.e. CDROM audio).
41 #define DIOCGMEDIASIZE _IOR('d', 129, off_t) /* Get media size in bytes */
43 * Get the size of the entire device in bytes. This should be a
44 * multiple of the sector size.
47 #define DIOCGFWSECTORS _IOR('d', 130, u_int) /* Get firmware's sectorcount */
49 * Get the firmware's notion of number of sectors per track. This
50 * value is mostly used for compatibility with various ill designed
51 * disk label formats. Don't use it unless you have to.
54 #define DIOCGFWHEADS _IOR('d', 131, u_int) /* Get firmware's headcount */
56 * Get the firmwares notion of number of heads per cylinder. This
57 * value is mostly used for compatibility with various ill designed
58 * disk label formats. Don't use it unless you have to.
61 #define DIOCGFLUSH _IO('d', 135) /* Flush write cache */
63 * Flush write cache of the device.
66 #define DIOCGDELETE _IOW('d', 136, off_t[2]) /* Delete data */
68 * Mark data on the device as unused.
71 #define DISK_IDENT_SIZE 256
72 #define DIOCGIDENT _IOR('d', 137, char[DISK_IDENT_SIZE])
74 * Get the ident of the given provider. Ident is (most of the time)
75 * a uniqe and fixed provider's identifier. Ident's properties are as
77 * - ident value is preserved between reboots,
78 * - provider can be detached/attached and ident is preserved,
79 * - provider's name can change - ident can't,
80 * - ident value should not be based on on-disk metadata; in other
81 * words copying whole data from one disk to another should not
82 * yield the same ident for the other disk,
83 * - there could be more than one provider with the same ident, but
84 * only if they point at exactly the same physical storage, this is
85 * the case for multipathing for example,
86 * - GEOM classes that consumes single providers and provide single
87 * providers, like geli, gbde, should just attach class name to the
88 * ident of the underlying provider,
89 * - ident is an ASCII string (is printable),
90 * - ident is optional and applications can't relay on its presence.
93 #define DIOCGPROVIDERNAME _IOR('d', 138, char[MAXPATHLEN])
95 * Store the provider name, given a device path, in a buffer. The buffer
96 * must be at least MAXPATHLEN bytes long.
99 #define DIOCGSTRIPESIZE _IOR('d', 139, off_t) /* Get stripe size in bytes */
101 * Get the size of the device's optimal access block in bytes.
102 * This should be a multiple of the sector size.
105 #define DIOCGSTRIPEOFFSET _IOR('d', 140, off_t) /* Get stripe offset in bytes */
107 * Get the offset of the first device's optimal access block in bytes.
108 * This should be a multiple of the sector size.
111 #define DIOCGPHYSPATH _IOR('d', 141, char[MAXPATHLEN])
113 * Get a string defining the physical path for a given provider.
114 * This has similar rules to ident, but is intended to uniquely
115 * identify the physical location of the device, not the current
116 * occupant of that location.
119 struct diocgattr_arg {
123 char str[DISK_IDENT_SIZE];
129 #define DIOCGATTR _IOWR('d', 142, struct diocgattr_arg)
131 #define DIOCZONECMD _IOWR('d', 143, struct disk_zone_args)
133 #ifndef WITHOUT_NETDUMP
135 #include <netinet/in.h>
143 * Sentinel values for kda_index.
145 * If kda_index is KDA_REMOVE_ALL, all dump configurations are cleared.
147 * If kda_index is KDA_REMOVE_DEV, all dump configurations for the specified
148 * device are cleared.
150 * If kda_index is KDA_REMOVE, only the specified dump configuration for the
151 * given device is removed from the list of fallback dump configurations.
153 * If kda_index is KDA_APPEND, the dump configuration is added after all
154 * existing dump configurations.
156 * Otherwise, the new configuration is inserted into the fallback dump list at
159 #define KDA_REMOVE UINT8_MAX
160 #define KDA_REMOVE_ALL (UINT8_MAX - 1)
161 #define KDA_REMOVE_DEV (UINT8_MAX - 2)
162 #define KDA_APPEND (UINT8_MAX - 3)
163 struct diocskerneldump_arg {
165 uint8_t kda_compression;
166 uint8_t kda_encryption;
167 uint8_t kda_key[KERNELDUMP_KEY_MAX_SIZE];
168 uint32_t kda_encryptedkeysize;
169 uint8_t *kda_encryptedkey;
170 char kda_iface[IFNAMSIZ];
171 union kd_ip kda_server;
172 union kd_ip kda_client;
173 union kd_ip kda_gateway;
176 #define DIOCSKERNELDUMP _IOW('d', 145, struct diocskerneldump_arg)
178 * Enable/Disable the device for kernel core dumps.
181 #define DIOCGKERNELDUMP _IOWR('d', 146, struct diocskerneldump_arg)
183 * Get current kernel netdump configuration details for a given index.
187 #endif /* _SYS_DISK_H_ */