FreeBSD/Linux Kernel Cross Reference
sys/sys/disk.h
1 /*-
2 * ----------------------------------------------------------------------------
3 * "THE BEER-WARE LICENSE" (Revision 42):
4 * <phk@FreeBSD.ORG> wrote this file. As long as you retain this notice you
5 * can do whatever you want with this stuff. If we meet some day, and you think
6 * this stuff is worth it, you can buy me a beer in return. Poul-Henning Kamp
7 * ----------------------------------------------------------------------------
8 *
9 * $FreeBSD: releng/10.2/sys/sys/disk.h 279005 2015-02-19 14:40:50Z mav $
10 *
11 */
12
13 #ifndef _SYS_DISK_H_
14 #define _SYS_DISK_H_
15
16 #include <sys/ioccom.h>
17 #include <sys/types.h>
18
19 #ifdef _KERNEL
20
21 #ifndef _SYS_CONF_H_
22 #include <sys/conf.h> /* XXX: temporary to avoid breakage */
23 #endif
24
25 void disk_err(struct bio *bp, const char *what, int blkdone, int nl);
26
27 #endif
28
29 #define DIOCGSECTORSIZE _IOR('d', 128, u_int)
30 /*
31 * Get the sector size of the device in bytes. The sector size is the
32 * smallest unit of data which can be transferred from this device.
33 * Usually this is a power of 2 but it might not be (i.e. CDROM audio).
34 */
35
36 #define DIOCGMEDIASIZE _IOR('d', 129, off_t) /* Get media size in bytes */
37 /*
38 * Get the size of the entire device in bytes. This should be a
39 * multiple of the sector size.
40 */
41
42 #define DIOCGFWSECTORS _IOR('d', 130, u_int) /* Get firmware's sectorcount */
43 /*
44 * Get the firmware's notion of number of sectors per track. This
45 * value is mostly used for compatibility with various ill designed
46 * disk label formats. Don't use it unless you have to.
47 */
48
49 #define DIOCGFWHEADS _IOR('d', 131, u_int) /* Get firmware's headcount */
50 /*
51 * Get the firmwares notion of number of heads per cylinder. This
52 * value is mostly used for compatibility with various ill designed
53 * disk label formats. Don't use it unless you have to.
54 */
55
56 #define DIOCSKERNELDUMP _IOW('d', 133, u_int) /* Set/Clear kernel dumps */
57 /*
58 * Enable/Disable (the argument is boolean) the device for kernel
59 * core dumps.
60 */
61
62 #define DIOCGFRONTSTUFF _IOR('d', 134, off_t)
63 /*
64 * Many disk formats have some amount of space reserved at the
65 * start of the disk to hold bootblocks, various disklabels and
66 * similar stuff. This ioctl returns the number of such bytes
67 * which may apply to the device.
68 */
69
70 #define DIOCGFLUSH _IO('d', 135) /* Flush write cache */
71 /*
72 * Flush write cache of the device.
73 */
74
75 #define DIOCGDELETE _IOW('d', 136, off_t[2]) /* Delete data */
76 /*
77 * Mark data on the device as unused.
78 */
79
80 #define DISK_IDENT_SIZE 256
81 #define DIOCGIDENT _IOR('d', 137, char[DISK_IDENT_SIZE])
82 /*-
83 * Get the ident of the given provider. Ident is (most of the time)
84 * a uniqe and fixed provider's identifier. Ident's properties are as
85 * follow:
86 * - ident value is preserved between reboots,
87 * - provider can be detached/attached and ident is preserved,
88 * - provider's name can change - ident can't,
89 * - ident value should not be based on on-disk metadata; in other
90 * words copying whole data from one disk to another should not
91 * yield the same ident for the other disk,
92 * - there could be more than one provider with the same ident, but
93 * only if they point at exactly the same physical storage, this is
94 * the case for multipathing for example,
95 * - GEOM classes that consumes single providers and provide single
96 * providers, like geli, gbde, should just attach class name to the
97 * ident of the underlying provider,
98 * - ident is an ASCII string (is printable),
99 * - ident is optional and applications can't relay on its presence.
100 */
101
102 #define DIOCGPROVIDERNAME _IOR('d', 138, char[MAXPATHLEN])
103 /*
104 * Store the provider name, given a device path, in a buffer. The buffer
105 * must be at least MAXPATHLEN bytes long.
106 */
107
108 #define DIOCGSTRIPESIZE _IOR('d', 139, off_t) /* Get stripe size in bytes */
109 /*
110 * Get the size of the device's optimal access block in bytes.
111 * This should be a multiple of the sector size.
112 */
113
114 #define DIOCGSTRIPEOFFSET _IOR('d', 140, off_t) /* Get stripe offset in bytes */
115 /*
116 * Get the offset of the first device's optimal access block in bytes.
117 * This should be a multiple of the sector size.
118 */
119
120 #define DIOCGPHYSPATH _IOR('d', 141, char[MAXPATHLEN])
121 /*
122 * Get a string defining the physical path for a given provider.
123 * This has similar rules to ident, but is intended to uniquely
124 * identify the physical location of the device, not the current
125 * occupant of that location.
126 */
127
128 struct diocgattr_arg {
129 char name[64];
130 int len;
131 union {
132 char str[DISK_IDENT_SIZE];
133 off_t off;
134 int i;
135 } value;
136 };
137 #define DIOCGATTR _IOWR('d', 142, struct diocgattr_arg)
138
139 #endif /* _SYS_DISK_H_ */
Cache object: ac7b54e8b02c39308e72453e9a9c6e4e
|