Edit File by line
/home/barbar84/public_h.../wp-conte.../plugins/sujqvwi/ExeBy/smexe_ro.../usr/include/linux
File: fd.h
/* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */
[0] Fix | Delete
#ifndef _LINUX_FD_H
[1] Fix | Delete
#define _LINUX_FD_H
[2] Fix | Delete
[3] Fix | Delete
#include <linux/ioctl.h>
[4] Fix | Delete
[5] Fix | Delete
[6] Fix | Delete
/* New file layout: Now the ioctl definitions immediately follow the
[7] Fix | Delete
* definitions of the structures that they use */
[8] Fix | Delete
[9] Fix | Delete
/*
[10] Fix | Delete
* Geometry
[11] Fix | Delete
*/
[12] Fix | Delete
struct floppy_struct {
[13] Fix | Delete
unsigned int size, /* nr of sectors total */
[14] Fix | Delete
sect, /* sectors per track */
[15] Fix | Delete
head, /* nr of heads */
[16] Fix | Delete
track, /* nr of tracks */
[17] Fix | Delete
stretch; /* bit 0 !=0 means double track steps */
[18] Fix | Delete
/* bit 1 != 0 means swap sides */
[19] Fix | Delete
/* bits 2..9 give the first sector */
[20] Fix | Delete
/* number (the LSB is flipped) */
[21] Fix | Delete
#define FD_STRETCH 1
[22] Fix | Delete
#define FD_SWAPSIDES 2
[23] Fix | Delete
#define FD_ZEROBASED 4
[24] Fix | Delete
#define FD_SECTBASEMASK 0x3FC
[25] Fix | Delete
#define FD_MKSECTBASE(s) (((s) ^ 1) << 2)
[26] Fix | Delete
#define FD_SECTBASE(floppy) ((((floppy)->stretch & FD_SECTBASEMASK) >> 2) ^ 1)
[27] Fix | Delete
[28] Fix | Delete
unsigned char gap, /* gap1 size */
[29] Fix | Delete
[30] Fix | Delete
rate, /* data rate. |= 0x40 for perpendicular */
[31] Fix | Delete
#define FD_2M 0x4
[32] Fix | Delete
#define FD_SIZECODEMASK 0x38
[33] Fix | Delete
#define FD_SIZECODE(floppy) (((((floppy)->rate&FD_SIZECODEMASK)>> 3)+ 2) %8)
[34] Fix | Delete
#define FD_SECTSIZE(floppy) ( (floppy)->rate & FD_2M ? \
[35] Fix | Delete
512 : 128 << FD_SIZECODE(floppy) )
[36] Fix | Delete
#define FD_PERP 0x40
[37] Fix | Delete
[38] Fix | Delete
spec1, /* stepping rate, head unload time */
[39] Fix | Delete
fmt_gap; /* gap2 size */
[40] Fix | Delete
const char * name; /* used only for predefined formats */
[41] Fix | Delete
};
[42] Fix | Delete
[43] Fix | Delete
[44] Fix | Delete
/* commands needing write access have 0x40 set */
[45] Fix | Delete
/* commands needing super user access have 0x80 set */
[46] Fix | Delete
[47] Fix | Delete
#define FDCLRPRM _IO(2, 0x41)
[48] Fix | Delete
/* clear user-defined parameters */
[49] Fix | Delete
[50] Fix | Delete
#define FDSETPRM _IOW(2, 0x42, struct floppy_struct)
[51] Fix | Delete
#define FDSETMEDIAPRM FDSETPRM
[52] Fix | Delete
/* set user-defined parameters for current media */
[53] Fix | Delete
[54] Fix | Delete
#define FDDEFPRM _IOW(2, 0x43, struct floppy_struct)
[55] Fix | Delete
#define FDGETPRM _IOR(2, 0x04, struct floppy_struct)
[56] Fix | Delete
#define FDDEFMEDIAPRM FDDEFPRM
[57] Fix | Delete
#define FDGETMEDIAPRM FDGETPRM
[58] Fix | Delete
/* set/get disk parameters */
[59] Fix | Delete
[60] Fix | Delete
[61] Fix | Delete
#define FDMSGON _IO(2,0x45)
[62] Fix | Delete
#define FDMSGOFF _IO(2,0x46)
[63] Fix | Delete
/* issue/don't issue kernel messages on media type change */
[64] Fix | Delete
[65] Fix | Delete
[66] Fix | Delete
/*
[67] Fix | Delete
* Formatting (obsolete)
[68] Fix | Delete
*/
[69] Fix | Delete
#define FD_FILL_BYTE 0xF6 /* format fill byte. */
[70] Fix | Delete
[71] Fix | Delete
struct format_descr {
[72] Fix | Delete
unsigned int device,head,track;
[73] Fix | Delete
};
[74] Fix | Delete
[75] Fix | Delete
#define FDFMTBEG _IO(2,0x47)
[76] Fix | Delete
/* begin formatting a disk */
[77] Fix | Delete
#define FDFMTTRK _IOW(2,0x48, struct format_descr)
[78] Fix | Delete
/* format the specified track */
[79] Fix | Delete
#define FDFMTEND _IO(2,0x49)
[80] Fix | Delete
/* end formatting a disk */
[81] Fix | Delete
[82] Fix | Delete
[83] Fix | Delete
/*
[84] Fix | Delete
* Error thresholds
[85] Fix | Delete
*/
[86] Fix | Delete
struct floppy_max_errors {
[87] Fix | Delete
unsigned int
[88] Fix | Delete
abort, /* number of errors to be reached before aborting */
[89] Fix | Delete
read_track, /* maximal number of errors permitted to read an
[90] Fix | Delete
* entire track at once */
[91] Fix | Delete
reset, /* maximal number of errors before a reset is tried */
[92] Fix | Delete
recal, /* maximal number of errors before a recalibrate is
[93] Fix | Delete
* tried */
[94] Fix | Delete
[95] Fix | Delete
/*
[96] Fix | Delete
* Threshold for reporting FDC errors to the console.
[97] Fix | Delete
* Setting this to zero may flood your screen when using
[98] Fix | Delete
* ultra cheap floppies ;-)
[99] Fix | Delete
*/
[100] Fix | Delete
reporting;
[101] Fix | Delete
[102] Fix | Delete
};
[103] Fix | Delete
[104] Fix | Delete
#define FDSETEMSGTRESH _IO(2,0x4a)
[105] Fix | Delete
/* set fdc error reporting threshold */
[106] Fix | Delete
[107] Fix | Delete
#define FDFLUSH _IO(2,0x4b)
[108] Fix | Delete
/* flush buffers for media; either for verifying media, or for
[109] Fix | Delete
* handling a media change without closing the file descriptor */
[110] Fix | Delete
[111] Fix | Delete
#define FDSETMAXERRS _IOW(2, 0x4c, struct floppy_max_errors)
[112] Fix | Delete
#define FDGETMAXERRS _IOR(2, 0x0e, struct floppy_max_errors)
[113] Fix | Delete
/* set/get abortion and read_track threshold. See also floppy_drive_params
[114] Fix | Delete
* structure */
[115] Fix | Delete
[116] Fix | Delete
[117] Fix | Delete
typedef char floppy_drive_name[16];
[118] Fix | Delete
#define FDGETDRVTYP _IOR(2, 0x0f, floppy_drive_name)
[119] Fix | Delete
/* get drive type: 5 1/4 or 3 1/2 */
[120] Fix | Delete
[121] Fix | Delete
[122] Fix | Delete
/*
[123] Fix | Delete
* Drive parameters (user modifiable)
[124] Fix | Delete
*/
[125] Fix | Delete
struct floppy_drive_params {
[126] Fix | Delete
signed char cmos; /* CMOS type */
[127] Fix | Delete
[128] Fix | Delete
/* Spec2 is (HLD<<1 | ND), where HLD is head load time (1=2ms, 2=4 ms
[129] Fix | Delete
* etc) and ND is set means no DMA. Hardcoded to 6 (HLD=6ms, use DMA).
[130] Fix | Delete
*/
[131] Fix | Delete
unsigned long max_dtr; /* Step rate, usec */
[132] Fix | Delete
unsigned long hlt; /* Head load/settle time, msec */
[133] Fix | Delete
unsigned long hut; /* Head unload time (remnant of
[134] Fix | Delete
* 8" drives) */
[135] Fix | Delete
unsigned long srt; /* Step rate, usec */
[136] Fix | Delete
[137] Fix | Delete
unsigned long spinup; /* time needed for spinup (expressed
[138] Fix | Delete
* in jiffies) */
[139] Fix | Delete
unsigned long spindown; /* timeout needed for spindown */
[140] Fix | Delete
unsigned char spindown_offset; /* decides in which position the disk
[141] Fix | Delete
* will stop */
[142] Fix | Delete
unsigned char select_delay; /* delay to wait after select */
[143] Fix | Delete
unsigned char rps; /* rotations per second */
[144] Fix | Delete
unsigned char tracks; /* maximum number of tracks */
[145] Fix | Delete
unsigned long timeout; /* timeout for interrupt requests */
[146] Fix | Delete
[147] Fix | Delete
unsigned char interleave_sect; /* if there are more sectors, use
[148] Fix | Delete
* interleave */
[149] Fix | Delete
[150] Fix | Delete
struct floppy_max_errors max_errors;
[151] Fix | Delete
[152] Fix | Delete
char flags; /* various flags, including ftd_msg */
[153] Fix | Delete
/*
[154] Fix | Delete
* Announce successful media type detection and media information loss after
[155] Fix | Delete
* disk changes.
[156] Fix | Delete
* Also used to enable/disable printing of overrun warnings.
[157] Fix | Delete
*/
[158] Fix | Delete
[159] Fix | Delete
#define FTD_MSG 0x10
[160] Fix | Delete
#define FD_BROKEN_DCL 0x20
[161] Fix | Delete
#define FD_DEBUG 0x02
[162] Fix | Delete
#define FD_SILENT_DCL_CLEAR 0x4
[163] Fix | Delete
#define FD_INVERTED_DCL 0x80 /* must be 0x80, because of hardware
[164] Fix | Delete
considerations */
[165] Fix | Delete
[166] Fix | Delete
char read_track; /* use readtrack during probing? */
[167] Fix | Delete
[168] Fix | Delete
/*
[169] Fix | Delete
* Auto-detection. Each drive type has eight formats which are
[170] Fix | Delete
* used in succession to try to read the disk. If the FDC cannot lock onto
[171] Fix | Delete
* the disk, the next format is tried. This uses the variable 'probing'.
[172] Fix | Delete
*/
[173] Fix | Delete
short autodetect[8]; /* autodetected formats */
[174] Fix | Delete
[175] Fix | Delete
int checkfreq; /* how often should the drive be checked for disk
[176] Fix | Delete
* changes */
[177] Fix | Delete
int native_format; /* native format of this drive */
[178] Fix | Delete
};
[179] Fix | Delete
[180] Fix | Delete
enum {
[181] Fix | Delete
FD_NEED_TWADDLE_BIT, /* more magic */
[182] Fix | Delete
FD_VERIFY_BIT, /* inquire for write protection */
[183] Fix | Delete
FD_DISK_NEWCHANGE_BIT, /* change detected, and no action undertaken yet
[184] Fix | Delete
* to clear media change status */
[185] Fix | Delete
FD_UNUSED_BIT,
[186] Fix | Delete
FD_DISK_CHANGED_BIT, /* disk has been changed since last i/o */
[187] Fix | Delete
FD_DISK_WRITABLE_BIT, /* disk is writable */
[188] Fix | Delete
FD_OPEN_SHOULD_FAIL_BIT
[189] Fix | Delete
};
[190] Fix | Delete
[191] Fix | Delete
#define FDSETDRVPRM _IOW(2, 0x90, struct floppy_drive_params)
[192] Fix | Delete
#define FDGETDRVPRM _IOR(2, 0x11, struct floppy_drive_params)
[193] Fix | Delete
/* set/get drive parameters */
[194] Fix | Delete
[195] Fix | Delete
[196] Fix | Delete
/*
[197] Fix | Delete
* Current drive state (not directly modifiable by user, readonly)
[198] Fix | Delete
*/
[199] Fix | Delete
struct floppy_drive_struct {
[200] Fix | Delete
unsigned long flags;
[201] Fix | Delete
/* values for these flags */
[202] Fix | Delete
#define FD_NEED_TWADDLE (1 << FD_NEED_TWADDLE_BIT)
[203] Fix | Delete
#define FD_VERIFY (1 << FD_VERIFY_BIT)
[204] Fix | Delete
#define FD_DISK_NEWCHANGE (1 << FD_DISK_NEWCHANGE_BIT)
[205] Fix | Delete
#define FD_DISK_CHANGED (1 << FD_DISK_CHANGED_BIT)
[206] Fix | Delete
#define FD_DISK_WRITABLE (1 << FD_DISK_WRITABLE_BIT)
[207] Fix | Delete
[208] Fix | Delete
unsigned long spinup_date;
[209] Fix | Delete
unsigned long select_date;
[210] Fix | Delete
unsigned long first_read_date;
[211] Fix | Delete
short probed_format;
[212] Fix | Delete
short track; /* current track */
[213] Fix | Delete
short maxblock; /* id of highest block read */
[214] Fix | Delete
short maxtrack; /* id of highest half track read */
[215] Fix | Delete
int generation; /* how many diskchanges? */
[216] Fix | Delete
[217] Fix | Delete
/*
[218] Fix | Delete
* (User-provided) media information is _not_ discarded after a media change
[219] Fix | Delete
* if the corresponding keep_data flag is non-zero. Positive values are
[220] Fix | Delete
* decremented after each probe.
[221] Fix | Delete
*/
[222] Fix | Delete
int keep_data;
[223] Fix | Delete
[224] Fix | Delete
/* Prevent "aliased" accesses. */
[225] Fix | Delete
int fd_ref;
[226] Fix | Delete
int fd_device;
[227] Fix | Delete
unsigned long last_checked; /* when was the drive last checked for a disk
[228] Fix | Delete
* change? */
[229] Fix | Delete
[230] Fix | Delete
char *dmabuf;
[231] Fix | Delete
int bufblocks;
[232] Fix | Delete
};
[233] Fix | Delete
[234] Fix | Delete
#define FDGETDRVSTAT _IOR(2, 0x12, struct floppy_drive_struct)
[235] Fix | Delete
#define FDPOLLDRVSTAT _IOR(2, 0x13, struct floppy_drive_struct)
[236] Fix | Delete
/* get drive state: GET returns the cached state, POLL polls for new state */
[237] Fix | Delete
[238] Fix | Delete
[239] Fix | Delete
/*
[240] Fix | Delete
* reset FDC
[241] Fix | Delete
*/
[242] Fix | Delete
enum reset_mode {
[243] Fix | Delete
FD_RESET_IF_NEEDED, /* reset only if the reset flags is set */
[244] Fix | Delete
FD_RESET_IF_RAWCMD, /* obsolete */
[245] Fix | Delete
FD_RESET_ALWAYS /* reset always */
[246] Fix | Delete
};
[247] Fix | Delete
#define FDRESET _IO(2, 0x54)
[248] Fix | Delete
[249] Fix | Delete
[250] Fix | Delete
/*
[251] Fix | Delete
* FDC state
[252] Fix | Delete
*/
[253] Fix | Delete
struct floppy_fdc_state {
[254] Fix | Delete
int spec1; /* spec1 value last used */
[255] Fix | Delete
int spec2; /* spec2 value last used */
[256] Fix | Delete
int dtr;
[257] Fix | Delete
unsigned char version; /* FDC version code */
[258] Fix | Delete
unsigned char dor;
[259] Fix | Delete
unsigned long address; /* io address */
[260] Fix | Delete
unsigned int rawcmd:2;
[261] Fix | Delete
unsigned int reset:1;
[262] Fix | Delete
unsigned int need_configure:1;
[263] Fix | Delete
unsigned int perp_mode:2;
[264] Fix | Delete
unsigned int has_fifo:1;
[265] Fix | Delete
unsigned int driver_version; /* version code for floppy driver */
[266] Fix | Delete
#define FD_DRIVER_VERSION 0x100
[267] Fix | Delete
/* user programs using the floppy API should use floppy_fdc_state to
[268] Fix | Delete
* get the version number of the floppy driver that they are running
[269] Fix | Delete
* on. If this version number is bigger than the one compiled into the
[270] Fix | Delete
* user program (the FD_DRIVER_VERSION define), it should be prepared
[271] Fix | Delete
* to bigger structures
[272] Fix | Delete
*/
[273] Fix | Delete
[274] Fix | Delete
unsigned char track[4];
[275] Fix | Delete
/* Position of the heads of the 4 units attached to this FDC,
[276] Fix | Delete
* as stored on the FDC. In the future, the position as stored
[277] Fix | Delete
* on the FDC might not agree with the actual physical
[278] Fix | Delete
* position of these drive heads. By allowing such
[279] Fix | Delete
* disagreement, it will be possible to reset the FDC without
[280] Fix | Delete
* incurring the expensive cost of repositioning all heads.
[281] Fix | Delete
* Right now, these positions are hard wired to 0. */
[282] Fix | Delete
[283] Fix | Delete
};
[284] Fix | Delete
[285] Fix | Delete
#define FDGETFDCSTAT _IOR(2, 0x15, struct floppy_fdc_state)
[286] Fix | Delete
[287] Fix | Delete
[288] Fix | Delete
/*
[289] Fix | Delete
* Asynchronous Write error tracking
[290] Fix | Delete
*/
[291] Fix | Delete
struct floppy_write_errors {
[292] Fix | Delete
/* Write error logging.
[293] Fix | Delete
*
[294] Fix | Delete
* These fields can be cleared with the FDWERRORCLR ioctl.
[295] Fix | Delete
* Only writes that were attempted but failed due to a physical media
[296] Fix | Delete
* error are logged. write(2) calls that fail and return an error code
[297] Fix | Delete
* to the user process are not counted.
[298] Fix | Delete
*/
[299] Fix | Delete
[300] Fix | Delete
unsigned int write_errors; /* number of physical write errors
[301] Fix | Delete
* encountered */
[302] Fix | Delete
[303] Fix | Delete
/* position of first and last write errors */
[304] Fix | Delete
unsigned long first_error_sector;
[305] Fix | Delete
int first_error_generation;
[306] Fix | Delete
unsigned long last_error_sector;
[307] Fix | Delete
int last_error_generation;
[308] Fix | Delete
[309] Fix | Delete
unsigned int badness; /* highest retry count for a read or write
[310] Fix | Delete
* operation */
[311] Fix | Delete
};
[312] Fix | Delete
[313] Fix | Delete
#define FDWERRORCLR _IO(2, 0x56)
[314] Fix | Delete
/* clear write error and badness information */
[315] Fix | Delete
#define FDWERRORGET _IOR(2, 0x17, struct floppy_write_errors)
[316] Fix | Delete
/* get write error and badness information */
[317] Fix | Delete
[318] Fix | Delete
[319] Fix | Delete
/*
[320] Fix | Delete
* Raw commands
[321] Fix | Delete
*/
[322] Fix | Delete
/* new interface flag: now we can do them in batches */
[323] Fix | Delete
#define FDHAVEBATCHEDRAWCMD
[324] Fix | Delete
[325] Fix | Delete
struct floppy_raw_cmd {
[326] Fix | Delete
unsigned int flags;
[327] Fix | Delete
#define FD_RAW_READ 1
[328] Fix | Delete
#define FD_RAW_WRITE 2
[329] Fix | Delete
#define FD_RAW_NO_MOTOR 4
[330] Fix | Delete
#define FD_RAW_DISK_CHANGE 4 /* out: disk change flag was set */
[331] Fix | Delete
#define FD_RAW_INTR 8 /* wait for an interrupt */
[332] Fix | Delete
#define FD_RAW_SPIN 0x10 /* spin up the disk for this command */
[333] Fix | Delete
#define FD_RAW_NO_MOTOR_AFTER 0x20 /* switch the motor off after command
[334] Fix | Delete
* completion */
[335] Fix | Delete
#define FD_RAW_NEED_DISK 0x40 /* this command needs a disk to be present */
[336] Fix | Delete
#define FD_RAW_NEED_SEEK 0x80 /* this command uses an implied seek (soft) */
[337] Fix | Delete
[338] Fix | Delete
/* more "in" flags */
[339] Fix | Delete
#define FD_RAW_MORE 0x100 /* more records follow */
[340] Fix | Delete
#define FD_RAW_STOP_IF_FAILURE 0x200 /* stop if we encounter a failure */
[341] Fix | Delete
#define FD_RAW_STOP_IF_SUCCESS 0x400 /* stop if command successful */
[342] Fix | Delete
#define FD_RAW_SOFTFAILURE 0x800 /* consider the return value for failure
[343] Fix | Delete
* detection too */
[344] Fix | Delete
[345] Fix | Delete
/* more "out" flags */
[346] Fix | Delete
#define FD_RAW_FAILURE 0x10000 /* command sent to fdc, fdc returned error */
[347] Fix | Delete
#define FD_RAW_HARDFAILURE 0x20000 /* fdc had to be reset, or timed out */
[348] Fix | Delete
[349] Fix | Delete
void *data;
[350] Fix | Delete
char *kernel_data; /* location of data buffer in the kernel */
[351] Fix | Delete
struct floppy_raw_cmd *next; /* used for chaining of raw cmd's
[352] Fix | Delete
* within the kernel */
[353] Fix | Delete
long length; /* in: length of dma transfer. out: remaining bytes */
[354] Fix | Delete
long phys_length; /* physical length, if different from dma length */
[355] Fix | Delete
int buffer_length; /* length of allocated buffer */
[356] Fix | Delete
[357] Fix | Delete
unsigned char rate;
[358] Fix | Delete
unsigned char cmd_count;
[359] Fix | Delete
unsigned char cmd[16];
[360] Fix | Delete
unsigned char reply_count;
[361] Fix | Delete
unsigned char reply[16];
[362] Fix | Delete
int track;
[363] Fix | Delete
int resultcode;
[364] Fix | Delete
[365] Fix | Delete
int reserved1;
[366] Fix | Delete
int reserved2;
[367] Fix | Delete
};
[368] Fix | Delete
[369] Fix | Delete
#define FDRAWCMD _IO(2, 0x58)
[370] Fix | Delete
/* send a raw command to the fdc. Structure size not included, because of
[371] Fix | Delete
* batches */
[372] Fix | Delete
[373] Fix | Delete
#define FDTWADDLE _IO(2, 0x59)
[374] Fix | Delete
/* flicker motor-on bit before reading a sector. Experimental */
[375] Fix | Delete
[376] Fix | Delete
[377] Fix | Delete
#define FDEJECT _IO(2, 0x5a)
[378] Fix | Delete
/* eject the disk */
[379] Fix | Delete
[380] Fix | Delete
[381] Fix | Delete
[382] Fix | Delete
#endif /* _LINUX_FD_H */
[383] Fix | Delete
[384] Fix | Delete
It is recommended that you Edit text format, this type of Fix handles quite a lot in one request
Function