mtio.h revision fa4c0ec88d821f9e87d85b91dc865065b1ec2b52
/*
* CDDL HEADER START
*
* The contents of this file are subject to the terms of the
* Common Development and Distribution License (the "License").
* You may not use this file except in compliance with the License.
*
* You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
* See the License for the specific language governing permissions
* and limitations under the License.
*
* When distributing Covered Code, include this CDDL HEADER in each
* file and include the License file at usr/src/OPENSOLARIS.LICENSE.
* If applicable, add the following below this CDDL HEADER, with the
* fields enclosed by brackets "[]" replaced with your own identifying
* information: Portions Copyright [yyyy] [name of copyright owner]
*
* CDDL HEADER END
*/
/*
* Copyright 2007 Sun Microsystems, Inc. All rights reserved.
* Use is subject to license terms.
*
* Copyright (c) 1983-1989 by AT&T.
* All rights reserved.
*/
/*
* Portions of this source code were derived from Berkeley 4.3 BSD
* under license from the Regents of the University of California.
*/
#ifndef _SYS_MTIO_H
#define _SYS_MTIO_H
#pragma ident "%Z%%M% %I% %E% SMI"
#ifdef __cplusplus
extern "C" {
#endif
/*
* Structures and definitions for mag tape io control commands
*/
/*
* structure for MTIOCTOP - mag tape op command
*/
struct mtop {
short mt_op; /* operations defined below */
};
#if defined(_SYSCALL32)
struct mtop32 {
short mt_op; /* operations defined below */
};
#endif /* _SYSCALL32 */
/*
* structure for MTIOCLTOP - mag tape op command
*/
struct mtlop {
short mt_op;
short pad[3];
};
/*
* values for mt_op
*/
#define MTWEOF 0 /* write an end-of-file record */
/* the tape device) */
/*
* structure for MTIOCGET - mag tape get status command
*/
struct mtget {
short mt_type; /* type of magtape device */
/* the following two registers are grossly device dependent */
short mt_dsreg; /* ``drive status'' register */
short mt_erreg; /* ``error'' register */
/* optional error info. */
short mt_bf; /* optimum blocking factor */
};
#if defined(_SYSCALL32)
struct mtget32 {
short mt_type; /* type of magtape device */
/* the following two registers are grossly device dependent */
short mt_dsreg; /* ``drive status'' register */
short mt_erreg; /* ``error'' register */
/* optional error info. */
short mt_bf; /* optimum blocking factor */
};
#endif /* _SYSCALL32 */
#define MT_NDENSITIES 4
#define MT_NSPEEDS 4
/*
* struct for MTIOCGETDRIVETYPE - get tape config data
*/
struct mtdrivetype {
char type; /* Drive type for driver */
int bsize; /* Block size */
int options; /* Drive options */
int max_rretries; /* Max read retries */
int max_wretries; /* Max write retries */
};
/*
* struct for MTIOCGETERROR - get recent error entry command
*/
struct mterror_entry {
struct scsi_arq_status *mtee_arq_status;
/* scsi arq status buffer */
};
#define MTERROR_ENTRY_SIZE_64 (sizeof (struct mterror_entry))
#if defined(_SYSCALL32)
struct mterror_entry32 {
/* scsi arq status buffer */
};
#define MTERROR_ENTRY_SIZE_32 (sizeof (struct mterror_entry32))
#endif /* _SYSCALL32 */
/*
* error entry stack
*/
struct mterror_entry_stack {
struct mterror_entry mtees_entry;
struct mterror_entry_stack *mtees_nextp;
};
#define MTERROR_LINK_ENTRY_SIZE (sizeof (struct mterror_entry_stack))
struct mtdrivetype_request {
int size;
struct mtdrivetype *mtdtp;
};
#if defined(_SYSCALL32)
struct mtdrivetype_request32 {
int size;
};
#endif /* _SYSCALL32 */
/*
* values for mt_flags
*/
#define MTF_SCSI 0x01
#define MTF_REEL 0x02
#define MTF_ASF 0x04
#define MTF_TAPE_HEAD_DIRTY 0x08
#define MTF_TAPE_CLN_SUPPORTED 0x10
#define MTF_WORM_MEDIA 0x20
#define MTF_LOGICAL_BLOCK 0x40
/*
* Constants for mt_type byte (these are somewhat obsolete)
*/
/*
* these are recommended
*/
/* more Sun devices */
/*
* Device table structure and data for looking tape name from
* tape id number. Used by mt.c.
*/
struct mt_tape_info {
short t_type; /* type of magtape device */
char *t_name; /* printing name */
char *t_dsbits; /* "drive status" register */
char *t_erbits; /* "error" register */
};
/* mag tape io control commands */
/*
* This state enum is the argument passed to the MTIOCSTATE ioctl.
*/
#ifndef KERNEL
/*
* don't use DEFTAPE.
*/
#endif
/*
* Layout of minor device byte
* 15 - 8 7 6 5 4 3 2 1 0
* --------------------------------------------
* | | | | | | | | |----| Unit #. lower 2 bits
* | | | | | | | |---------- No rewind on close bit....
* | | | | | |----|--------------- Density Select
* | | | | |------------------------- Resrvd.(add. campus dens. bit)
* | | | |------------------------------ BSD behavior
* |----|----|----------------------------------- Unit # bit 2-6
*/
#ifdef __cplusplus
}
#endif
#endif /* _SYS_MTIO_H */