disk.h revision 210226
1139825Simp/*- 250565Sphk * ---------------------------------------------------------------------------- 350565Sphk * "THE BEER-WARE LICENSE" (Revision 42): 450565Sphk * <phk@FreeBSD.ORG> wrote this file. As long as you retain this notice you 550565Sphk * can do whatever you want with this stuff. If we meet some day, and you think 650565Sphk * this stuff is worth it, you can buy me a beer in return. Poul-Henning Kamp 750565Sphk * ---------------------------------------------------------------------------- 850565Sphk * 950565Sphk * $FreeBSD: head/sys/sys/disk.h 210226 2010-07-18 20:57:53Z trasz $ 1050565Sphk * 1150565Sphk */ 1250565Sphk 1350565Sphk#ifndef _SYS_DISK_H_ 1450565Sphk#define _SYS_DISK_H_ 1550565Sphk 1694182Sphk#include <sys/ioccom.h> 1794182Sphk 1894182Sphk#ifdef _KERNEL 1950565Sphk 20110119Sphk#ifndef _SYS_CONF_H_ 21110119Sphk#include <sys/conf.h> /* XXX: temporary to avoid breakage */ 22110119Sphk#endif 23110119Sphk 24103675Sphkvoid disk_err(struct bio *bp, const char *what, int blkdone, int nl); 2550565Sphk 2694182Sphk#endif 2794182Sphk 2894282Sphk#define DIOCGSECTORSIZE _IOR('d', 128, u_int) 29210226Strasz /*- 3094282Sphk * Get the sectorsize of the device in bytes. The sectorsize is the 3194282Sphk * smallest unit of data which can be transfered from this device. 3294282Sphk * Usually this is a power of two but it may not be. (ie: CDROM audio) 3394282Sphk */ 3494282Sphk 3594182Sphk#define DIOCGMEDIASIZE _IOR('d', 129, off_t) /* Get media size in bytes */ 36210226Strasz /*- 3794282Sphk * Get the size of the entire device in bytes. This should be a 3894282Sphk * multiple of the sectorsize. 3994282Sphk */ 4094282Sphk 4194182Sphk#define DIOCGFWSECTORS _IOR('d', 130, u_int) /* Get firmware sectorcount */ 42210226Strasz /*- 4394282Sphk * Get the firmwares notion of number of sectors per track. This 4494282Sphk * value is mostly used for compatibility with various ill designed 4594282Sphk * disk label formats. Don't use it unless you have to. 4694282Sphk */ 4794282Sphk 4894182Sphk#define DIOCGFWHEADS _IOR('d', 131, u_int) /* Get firmware headcount */ 49210226Strasz /*- 5094282Sphk * Get the firmwares notion of number of heads per cylinder. This 5194282Sphk * value is mostly used for compatibility with various ill designed 5294282Sphk * disk label formats. Don't use it unless you have to. 5394282Sphk */ 5494282Sphk 5594272Sphk#define DIOCSKERNELDUMP _IOW('d', 133, u_int) /* Set/Clear kernel dumps */ 56210226Strasz /*- 5794282Sphk * Enable/Disable (the argument is boolean) the device for kernel 5894282Sphk * core dumps. 5994282Sphk */ 6094282Sphk 6194287Sphk#define DIOCGFRONTSTUFF _IOR('d', 134, off_t) 62210226Strasz /*- 6394287Sphk * Many disk formats have some amount of space reserved at the 6494287Sphk * start of the disk to hold bootblocks, various disklabels and 6594287Sphk * similar stuff. This ioctl returns the number of such bytes 6694287Sphk * which may apply to the device. 6794287Sphk */ 6894287Sphk 69169284Spjd#define DIOCGFLUSH _IO('d', 135) /* Flush write cache */ 70210226Strasz /*- 71169284Spjd * Flush write cache of the device. 72169284Spjd */ 73169284Spjd 74169284Spjd#define DIOCGDELETE _IOW('d', 136, off_t[2]) /* Delete data */ 75210226Strasz /*- 76169284Spjd * Mark data on the device as unused. 77169284Spjd */ 78169284Spjd 79169284Spjd#define DISK_IDENT_SIZE 256 80169284Spjd#define DIOCGIDENT _IOR('d', 137, char[DISK_IDENT_SIZE]) 81210226Strasz /*- 82169284Spjd * Get the ident of the given provider. Ident is (most of the time) 83169284Spjd * a uniqe and fixed provider's identifier. Ident's properties are as 84169284Spjd * follow: 85169284Spjd * - ident value is preserved between reboots, 86169284Spjd * - provider can be detached/attached and ident is preserved, 87169284Spjd * - provider's name can change - ident can't, 88169284Spjd * - ident value should not be based on on-disk metadata; in other 89169284Spjd * words copying whole data from one disk to another should not 90169284Spjd * yield the same ident for the other disk, 91169284Spjd * - there could be more than one provider with the same ident, but 92169284Spjd * only if they point at exactly the same physical storage, this is 93169284Spjd * the case for multipathing for example, 94169284Spjd * - GEOM classes that consumes single providers and provide single 95169284Spjd * providers, like geli, gbde, should just attach class name to the 96169284Spjd * ident of the underlying provider, 97169284Spjd * - ident is an ASCII string (is printable), 98169284Spjd * - ident is optional and applications can't relay on its presence. 99169284Spjd */ 100169284Spjd 101182843Slulf#define DIOCGPROVIDERNAME _IOR('d', 138, char[MAXPATHLEN]) 102210226Strasz /*- 103182843Slulf * Store the provider name, given a device path, in a buffer. The buffer 104182843Slulf * must be at least MAXPATHLEN bytes long. 105182843Slulf */ 106182843Slulf 107200934Smav#define DIOCGSTRIPESIZE _IOR('d', 139, off_t) /* Get stripe size in bytes */ 108210226Strasz /*- 109200934Smav * Get the size of the device's optimal access block in bytes. 110200934Smav * This should be a multiple of the sectorsize. 111200934Smav */ 112200934Smav 113200934Smav#define DIOCGSTRIPEOFFSET _IOR('d', 140, off_t) /* Get stripe offset in bytes */ 114210226Strasz /*- 115200934Smav * Get the offset of the first device's optimal access block in bytes. 116200934Smav * This should be a multiple of the sectorsize. 117200934Smav */ 118200934Smav 11950565Sphk#endif /* _SYS_DISK_H_ */ 120