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$ 1050565Sphk * 1150565Sphk */ 1250565Sphk 1350565Sphk#ifndef _SYS_DISK_H_ 1450565Sphk#define _SYS_DISK_H_ 1550565Sphk 1694182Sphk#include <sys/ioccom.h> 17274732Smav#include <sys/types.h> 1894182Sphk 1994182Sphk#ifdef _KERNEL 2050565Sphk 21110119Sphk#ifndef _SYS_CONF_H_ 22110119Sphk#include <sys/conf.h> /* XXX: temporary to avoid breakage */ 23110119Sphk#endif 24110119Sphk 25103675Sphkvoid disk_err(struct bio *bp, const char *what, int blkdone, int nl); 2650565Sphk 2794182Sphk#endif 2894182Sphk 29210365Strasz#define DIOCGSECTORSIZE _IOR('d', 128, u_int) 30210365Strasz /* 31210365Strasz * Get the sector size of the device in bytes. The sector size is the 32210365Strasz * smallest unit of data which can be transferred from this device. 33210365Strasz * Usually this is a power of 2 but it might not be (i.e. CDROM audio). 3494282Sphk */ 3594282Sphk 36210365Strasz#define DIOCGMEDIASIZE _IOR('d', 129, off_t) /* Get media size in bytes */ 37210365Strasz /* 3894282Sphk * Get the size of the entire device in bytes. This should be a 39210365Strasz * multiple of the sector size. 4094282Sphk */ 4194282Sphk 42210365Strasz#define DIOCGFWSECTORS _IOR('d', 130, u_int) /* Get firmware's sectorcount */ 43210365Strasz /* 44210365Strasz * Get the firmware's notion of number of sectors per track. This 4594282Sphk * value is mostly used for compatibility with various ill designed 4694282Sphk * disk label formats. Don't use it unless you have to. 4794282Sphk */ 4894282Sphk 49210365Strasz#define DIOCGFWHEADS _IOR('d', 131, u_int) /* Get firmware's headcount */ 50210365Strasz /* 5194282Sphk * Get the firmwares notion of number of heads per cylinder. This 5294282Sphk * value is mostly used for compatibility with various ill designed 5394282Sphk * disk label formats. Don't use it unless you have to. 5494282Sphk */ 5594282Sphk 56210365Strasz#define DIOCSKERNELDUMP _IOW('d', 133, u_int) /* Set/Clear kernel dumps */ 57210365Strasz /* 5894282Sphk * Enable/Disable (the argument is boolean) the device for kernel 5994282Sphk * core dumps. 6094282Sphk */ 6194282Sphk 62210365Strasz#define DIOCGFRONTSTUFF _IOR('d', 134, off_t) 63210365Strasz /* 6494287Sphk * Many disk formats have some amount of space reserved at the 6594287Sphk * start of the disk to hold bootblocks, various disklabels and 6694287Sphk * similar stuff. This ioctl returns the number of such bytes 6794287Sphk * which may apply to the device. 6894287Sphk */ 6994287Sphk 70169284Spjd#define DIOCGFLUSH _IO('d', 135) /* Flush write cache */ 71210365Strasz /* 72169284Spjd * Flush write cache of the device. 73169284Spjd */ 74169284Spjd 75169284Spjd#define DIOCGDELETE _IOW('d', 136, off_t[2]) /* Delete data */ 76210365Strasz /* 77169284Spjd * Mark data on the device as unused. 78169284Spjd */ 79169284Spjd 80169284Spjd#define DISK_IDENT_SIZE 256 81169284Spjd#define DIOCGIDENT _IOR('d', 137, char[DISK_IDENT_SIZE]) 82210226Strasz /*- 83169284Spjd * Get the ident of the given provider. Ident is (most of the time) 84169284Spjd * a uniqe and fixed provider's identifier. Ident's properties are as 85169284Spjd * follow: 86169284Spjd * - ident value is preserved between reboots, 87169284Spjd * - provider can be detached/attached and ident is preserved, 88169284Spjd * - provider's name can change - ident can't, 89169284Spjd * - ident value should not be based on on-disk metadata; in other 90169284Spjd * words copying whole data from one disk to another should not 91169284Spjd * yield the same ident for the other disk, 92169284Spjd * - there could be more than one provider with the same ident, but 93169284Spjd * only if they point at exactly the same physical storage, this is 94169284Spjd * the case for multipathing for example, 95169284Spjd * - GEOM classes that consumes single providers and provide single 96169284Spjd * providers, like geli, gbde, should just attach class name to the 97169284Spjd * ident of the underlying provider, 98169284Spjd * - ident is an ASCII string (is printable), 99169284Spjd * - ident is optional and applications can't relay on its presence. 100169284Spjd */ 101169284Spjd 102210365Strasz#define DIOCGPROVIDERNAME _IOR('d', 138, char[MAXPATHLEN]) 103210365Strasz /* 104182843Slulf * Store the provider name, given a device path, in a buffer. The buffer 105182843Slulf * must be at least MAXPATHLEN bytes long. 106182843Slulf */ 107182843Slulf 108210365Strasz#define DIOCGSTRIPESIZE _IOR('d', 139, off_t) /* Get stripe size in bytes */ 109210365Strasz /* 110200934Smav * Get the size of the device's optimal access block in bytes. 111210365Strasz * This should be a multiple of the sector size. 112200934Smav */ 113200934Smav 114210365Strasz#define DIOCGSTRIPEOFFSET _IOR('d', 140, off_t) /* Get stripe offset in bytes */ 115210365Strasz /* 116200934Smav * Get the offset of the first device's optimal access block in bytes. 117210365Strasz * This should be a multiple of the sector size. 118200934Smav */ 119200934Smav 120223089Sgibbs#define DIOCGPHYSPATH _IOR('d', 141, char[MAXPATHLEN]) 121223089Sgibbs /* 122223089Sgibbs * Get a string defining the physical path for a given provider. 123223089Sgibbs * This has similar rules to ident, but is intended to uniquely 124223089Sgibbs * identify the physical location of the device, not the current 125223089Sgibbs * occupant of that location. 126223089Sgibbs */ 127223089Sgibbs 128274732Smavstruct diocgattr_arg { 129274732Smav char name[64]; 130274732Smav int len; 131274732Smav union { 132274732Smav char str[DISK_IDENT_SIZE]; 133274732Smav off_t off; 134279005Smav int i; 135274732Smav } value; 136274732Smav}; 137274732Smav#define DIOCGATTR _IOWR('d', 142, struct diocgattr_arg) 138274732Smav 13950565Sphk#endif /* _SYS_DISK_H_ */ 140