<sys/mtio.h>
Change-Id: I8629f90393c555f15208833d2b3f9fb6efc541c3
This commit is contained in:
parent
515ae0a3e9
commit
28b9cb9a52
3 changed files with 161 additions and 42 deletions
|
@ -53,9 +53,9 @@ tape_operation_t tapeops[] = {
|
||||||
{ SELF, "status", IGN }, /* Tape Status */
|
{ SELF, "status", IGN }, /* Tape Status */
|
||||||
{ MTRETEN, "retension",IGN }, /* Retension the tape */
|
{ MTRETEN, "retension",IGN }, /* Retension the tape */
|
||||||
{ MTERASE, "erase", IGN }, /* Erase the tape */
|
{ MTERASE, "erase", IGN }, /* Erase the tape */
|
||||||
{ MTMODE, "density", NNG }, /* Select density */
|
{ MTSETDNSTY, "density", NNG }, /* Select density */
|
||||||
{ MTBLKZ, "blksize", NNG }, /* Select block size */
|
{ MTSETBSIZ, "blksize", NNG }, /* Select block size */
|
||||||
{ MTBLKZ, "blocksize",NNG }, /* Same */
|
{ MTSETBSIZ, "blocksize",NNG }, /* Same */
|
||||||
};
|
};
|
||||||
|
|
||||||
#define arraysize(a) (sizeof(a)/sizeof((a)[0]))
|
#define arraysize(a) (sizeof(a)/sizeof((a)[0]))
|
||||||
|
@ -199,8 +199,8 @@ SCSI tape drive %s:\n\
|
||||||
(long) mtget.mt_fileno,
|
(long) mtget.mt_fileno,
|
||||||
(long) mtget.mt_blkno,
|
(long) mtget.mt_blkno,
|
||||||
(long) mtget.mt_resid);
|
(long) mtget.mt_resid);
|
||||||
printf(mtget.mt_blksize == 0 ? "variable\n" : "%d\n",
|
printf(mtget.mt_blksiz == 0 ? "variable\n" : "%d\n",
|
||||||
mtget.mt_blksize);
|
mtget.mt_blksiz);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (r < 0) {
|
if (r < 0) {
|
||||||
|
|
|
@ -273,17 +273,17 @@ int fd;
|
||||||
exit(1);
|
exit(1);
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
if (mtget.mt_blksize > SSIZE_MAX) {
|
if (mtget.mt_blksiz > SSIZE_MAX) {
|
||||||
fprintf(stderr,
|
fprintf(stderr,
|
||||||
"vol: %s: tape block size (%lu) is too large to handle\n",
|
"vol: %s: tape block size (%lu) is too large to handle\n",
|
||||||
name, (unsigned long) mtget.mt_blksize);
|
name, (unsigned long) mtget.mt_blksiz);
|
||||||
exit(1);
|
exit(1);
|
||||||
}
|
}
|
||||||
if (mtget.mt_blksize == 0) {
|
if (mtget.mt_blksiz == 0) {
|
||||||
variable = 1;
|
variable = 1;
|
||||||
} else {
|
} else {
|
||||||
/* fixed */
|
/* fixed */
|
||||||
block_size = mtget.mt_blksize;
|
block_size = mtget.mt_blksiz;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
185
sys/sys/mtio.h
185
sys/sys/mtio.h
|
@ -1,45 +1,164 @@
|
||||||
/* <sys/mtio.h> magnetic tape commands Author: Kees J. Bot
|
/* $NetBSD: mtio.h,v 1.23 2005/12/26 18:41:36 perry Exp $ */
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Copyright (c) 1982, 1986, 1993
|
||||||
|
* The Regents of the University of California. All rights reserved.
|
||||||
|
*
|
||||||
|
* Redistribution and use in source and binary forms, with or without
|
||||||
|
* modification, are permitted provided that the following conditions
|
||||||
|
* are met:
|
||||||
|
* 1. Redistributions of source code must retain the above copyright
|
||||||
|
* notice, this list of conditions and the following disclaimer.
|
||||||
|
* 2. Redistributions in binary form must reproduce the above copyright
|
||||||
|
* notice, this list of conditions and the following disclaimer in the
|
||||||
|
* documentation and/or other materials provided with the distribution.
|
||||||
|
* 3. Neither the name of the University nor the names of its contributors
|
||||||
|
* may be used to endorse or promote products derived from this software
|
||||||
|
* without specific prior written permission.
|
||||||
|
*
|
||||||
|
* THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
|
||||||
|
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
||||||
|
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
|
||||||
|
* ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
|
||||||
|
* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
|
||||||
|
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
|
||||||
|
* OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
|
||||||
|
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
|
||||||
|
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
|
||||||
|
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
|
||||||
|
* SUCH DAMAGE.
|
||||||
|
*
|
||||||
|
* @(#)mtio.h 8.1 (Berkeley) 6/2/93
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#ifndef _SYS__MTIO_H
|
#ifndef _SYS_MTIO_H_
|
||||||
#define _SYS__MTIO_H
|
#define _SYS_MTIO_H_
|
||||||
|
|
||||||
/* Tape operations: ioctl(fd, MTIOCTOP, &struct mtop) */
|
/*
|
||||||
|
* Structures and definitions for mag tape io control commands
|
||||||
|
*/
|
||||||
|
|
||||||
|
/* structure for MTIOCTOP - mag tape op command */
|
||||||
struct mtop {
|
struct mtop {
|
||||||
short mt_op; /* Operation (MTWEOF, etc.) */
|
short mt_op; /* operations defined below */
|
||||||
int mt_count; /* Repeat count. */
|
int32_t mt_count; /* how many of them */
|
||||||
};
|
};
|
||||||
|
|
||||||
#define MTWEOF 0 /* Write End-Of-File Marker */
|
/* operations */
|
||||||
#define MTFSF 1 /* Forward Space File mark */
|
#define MTWEOF 0 /* write an end-of-file record */
|
||||||
#define MTBSF 2 /* Backward Space File mark */
|
#define MTFSF 1 /* forward space file */
|
||||||
#define MTFSR 3 /* Forward Space Record */
|
#define MTBSF 2 /* backward space file */
|
||||||
#define MTBSR 4 /* Backward Space Record */
|
#define MTFSR 3 /* forward space record */
|
||||||
#define MTREW 5 /* Rewind tape */
|
#define MTBSR 4 /* backward space record */
|
||||||
#define MTOFFL 6 /* Rewind and take Offline */
|
#define MTREW 5 /* rewind */
|
||||||
#define MTNOP 7 /* No-Operation, set status only */
|
#define MTOFFL 6 /* rewind and put the drive offline */
|
||||||
#define MTRETEN 8 /* Retension (completely wind and rewind) */
|
#define MTNOP 7 /* no operation, sets status only */
|
||||||
#define MTERASE 9 /* Erase the tape and rewind */
|
#define MTRETEN 8 /* retension */
|
||||||
#define MTEOM 10 /* Position at End-Of-Media */
|
#define MTERASE 9 /* erase entire tape */
|
||||||
#define MTMODE 11 /* Select tape density */
|
#define MTEOM 10 /* forward to end of media */
|
||||||
#define MTBLKZ 12 /* Select tape block size */
|
#define MTNBSF 11 /* backward space to beginning of file */
|
||||||
|
#define MTCACHE 12 /* enable controller cache */
|
||||||
|
#define MTNOCACHE 13 /* disable controller cache */
|
||||||
|
#define MTSETBSIZ 14 /* set block size; 0 for variable */
|
||||||
|
#define MTSETDNSTY 15 /* set density code for current mode */
|
||||||
|
#define MTCMPRESS 16 /* set/clear device compression */
|
||||||
|
#define MTEWARN 17 /* set/clear early warning behaviour */
|
||||||
|
|
||||||
/* Tape status: ioctl(fd, MTIOCGET, &struct mtget) */
|
/* structure for MTIOCGET - mag tape get status command */
|
||||||
|
|
||||||
struct mtget {
|
struct mtget {
|
||||||
short mt_type; /* Type of tape device. */
|
short mt_type; /* type of magtape device */
|
||||||
|
/* the following two registers are grossly device dependent */
|
||||||
/* Device dependent "registers". */
|
short mt_dsreg; /* ``drive status'' register */
|
||||||
short mt_dsreg; /* Drive status register. */
|
short mt_erreg; /* ``error'' register */
|
||||||
short mt_erreg; /* Error register. */
|
/* end device-dependent registers */
|
||||||
short dummy; /* (alignment) */
|
short mt_resid; /* residual count */
|
||||||
|
/* the following two are not yet implemented by most tape drivers */
|
||||||
/* Misc info. */
|
int32_t mt_fileno; /* file number of current position */
|
||||||
off_t mt_resid; /* Residual count. */
|
int32_t mt_blkno; /* block number of current position */
|
||||||
off_t mt_fileno; /* Current File Number. */
|
/* end not yet implemented */
|
||||||
off_t mt_blkno; /* Current Block Number within file. */
|
int32_t mt_blksiz; /* current block size */
|
||||||
off_t mt_blksize; /* Current block size. */
|
int32_t mt_density; /* current density code */
|
||||||
|
int32_t mt_mblksiz[4]; /* block size for different modes */
|
||||||
|
int32_t mt_mdensity[4]; /* density codes for different modes */
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif /* _SYS__MTIO_H */
|
/*
|
||||||
|
* Constants for mt_type byte. These are the same
|
||||||
|
* for controllers compatible with the types listed.
|
||||||
|
*/
|
||||||
|
#define MT_ISTS 0x01 /* TS-11 */
|
||||||
|
#define MT_ISHT 0x02 /* TM03 Massbus: TE16, TU45, TU77 */
|
||||||
|
#define MT_ISTM 0x03 /* TM11/TE10 Unibus */
|
||||||
|
#define MT_ISMT 0x04 /* TM78/TU78 Massbus */
|
||||||
|
#define MT_ISUT 0x05 /* SI TU-45 emulation on Unibus */
|
||||||
|
#define MT_ISCPC 0x06 /* SUN */
|
||||||
|
#define MT_ISAR 0x07 /* SUN - Also "GENERIC SCSI" */
|
||||||
|
#define MT_ISTMSCP 0x08 /* DEC TMSCP protocol (TU81, TK50) */
|
||||||
|
#define MT_ISCY 0x09 /* CCI Cipher */
|
||||||
|
#define MT_ISCT 0x0a /* HP 1/4 tape */
|
||||||
|
#define MT_ISFHP 0x0b /* HP 7980 1/2 tape */
|
||||||
|
#define MT_ISEXABYTE 0x0c /* Exabyte */
|
||||||
|
#define MT_ISEXA8200 0x0c /* Exabyte EXB-8200 */
|
||||||
|
#define MT_ISEXA8500 0x0d /* Exabyte EXB-8500 */
|
||||||
|
#define MT_ISVIPER1 0x0e /* Archive Viper-150 */
|
||||||
|
#define MT_ISPYTHON 0x0f /* Archive Python (DAT) */
|
||||||
|
#define MT_ISHPDAT 0x10 /* HP 35450A DAT drive */
|
||||||
|
#define MT_ISWANGTEK 0x11 /* WANGTEK 5150ES */
|
||||||
|
#define MT_ISCALIPER 0x12 /* Caliper CP150 */
|
||||||
|
#define MT_ISWTEK5099 0x13 /* WANGTEK 5099ES */
|
||||||
|
#define MT_ISVIPER2525 0x14 /* Archive Viper 2525 */
|
||||||
|
#define MT_ISMFOUR 0x11 /* M4 Data 1/2 9track drive */
|
||||||
|
#define MT_ISTK50 0x12 /* DEC SCSI TK50 */
|
||||||
|
#define MT_ISMT02 0x13 /* Emulex MT02 SCSI tape controller */
|
||||||
|
|
||||||
|
/* bits defined for the mt_dsreg field */
|
||||||
|
#define MT_DS_RDONLY 0x10 /* tape mounted readonly */
|
||||||
|
#define MT_DS_MOUNTED 0x03 /* tape mounted (for control opens) */
|
||||||
|
|
||||||
|
/*
|
||||||
|
* For the mt_erreg field.....This is supposed to be a *generic*
|
||||||
|
* MT interface, so we cannot overload it with SCSI specific entities,
|
||||||
|
* (like ASC/ASCQ) nor is there enough room to put all the information
|
||||||
|
* in that is desirable. This whole structure should be redone.
|
||||||
|
*
|
||||||
|
* In the interim, this will be considered device-specific. For SCSI,
|
||||||
|
* this will be taken to mean the last Sense Key seen. It is not
|
||||||
|
* guaranteed to always be sensibly associated with any command.
|
||||||
|
*/
|
||||||
|
|
||||||
|
/*
|
||||||
|
* The action of a MTIOCGET command clears mt_dsreg, mt_erreg, and mt_resid
|
||||||
|
*/
|
||||||
|
|
||||||
|
/* mag tape io control commands */
|
||||||
|
#define MTIOCTOP _IOW('m', 1, struct mtop) /* do a mag tape op */
|
||||||
|
#define MTIOCGET _IOR('m', 2, struct mtget) /* get tape status */
|
||||||
|
#define MTIOCIEOT _IO('m', 3) /* ignore EOT error */
|
||||||
|
#define MTIOCEEOT _IO('m', 4) /* enable EOT error */
|
||||||
|
/*
|
||||||
|
* When more SCSI-3 SSC (streaming device) devices are out there
|
||||||
|
* that support the full 32 byte type 2 structure, we'll have to
|
||||||
|
* rethink these ioctls to support all the entities they haul into
|
||||||
|
* the picture (64 bit blocks, logical file record numbers, etc..).
|
||||||
|
*/
|
||||||
|
#define MTIOCRDSPOS _IOR('m', 5, uint32_t) /* get logical blk addr */
|
||||||
|
#define MTIOCRDHPOS _IOR('m', 6, uint32_t) /* get hardware blk addr */
|
||||||
|
#define MTIOCSLOCATE _IOW('m', 5, uint32_t) /* seek to logical blk addr */
|
||||||
|
#define MTIOCHLOCATE _IOW('m', 6, uint32_t) /* seek to hardware blk addr */
|
||||||
|
|
||||||
|
#ifdef _KERNEL
|
||||||
|
/*
|
||||||
|
* minor device number
|
||||||
|
*/
|
||||||
|
|
||||||
|
#define T_UNIT 003 /* unit selection */
|
||||||
|
#define T_NOREWIND 004 /* no rewind on close */
|
||||||
|
#define T_DENSEL 030 /* density select */
|
||||||
|
#define T_800BPI 000 /* select 800 bpi */
|
||||||
|
#define T_1600BPI 010 /* select 1600 bpi */
|
||||||
|
#define T_6250BPI 020 /* select 6250 bpi */
|
||||||
|
#define T_BADBPI 030 /* undefined selection */
|
||||||
|
#endif /* _KERNEL */
|
||||||
|
|
||||||
|
#endif /* !_SYS_MTIO_H_ */
|
||||||
|
|
Loading…
Reference in a new issue