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