1 /* 2 * Copyright (c) 1992 The Regents of the University of California. 3 * All rights reserved. 4 * 5 * This software was developed by the Computer Systems Engineering group 6 * at Lawrence Berkeley Laboratory under DARPA contract BG 91-66 and 7 * contributed to Berkeley. 8 * 9 * %sccs.include.redist.c% 10 * 11 * @(#)scsi_ioctl.h 5.1 (Berkeley) 07/10/92 12 * 13 * from: $Header: scsi_ioctl.h,v 1.2 92/05/15 11:24:02 torek Exp $ (LBL) 14 */ 15 16 /* 17 * SCSI ioctls (`format' mode). 18 * 19 * Format mode allows a privileged process to issue direct SCSI commands 20 * to a drive (it is intended primarily to allow on-line formatting). 21 * SDIOCSFORMAT sets format mode (nonzero arg => on, zero arg => off). 22 * When in format mode, only the process that issued the SDIOCSFORMAT 23 * can read or write the drive. 24 * 25 * In format mode, the process is expected to 26 * - do SDIOCSCSICOMMAND to supply cdb for next SCSI op 27 * - do read or write as appropriate for cdb 28 * - if I/O error, optionally do SDIOCSENSE to get completion 29 * status and sense data from last SCSI operation. 30 */ 31 32 struct scsi_fmt_sense { 33 u_int status; /* completion status of last op */ 34 u_char sense[28]; /* sense data (if any) from last op */ 35 }; 36 37 #define SDIOCSFORMAT _IOW('S', 1, int) 38 #define SDIOCGFORMAT _IOR('S', 2, int) 39 #define SDIOCSCSICOMMAND _IOW('S', 3, struct scsi_cdb) 40 #define SDIOCSENSE _IOR('S', 4, struct scsi_fmt_sense) 41