1 /* @(#)mtio.h 1.6 10/08/23 Copyright 1995,2000-2010 J. Schilling */ 2 /* 3 * Generic header for users of magnetic tape ioctl interface. 4 * 5 * If there is no local mtio.h or equivalent, define 6 * simplified mtio definitions here in order 7 * to be able to do at least remote mtio on systems 8 * that have no local mtio 9 * 10 * Copyright (c) 1995,2000-2010 J. Schilling 11 */ 12 /* 13 * The contents of this file are subject to the terms of the 14 * Common Development and Distribution License, Version 1.0 only 15 * (the "License"). You may not use this file except in compliance 16 * with the License. 17 * 18 * See the file CDDL.Schily.txt in this distribution for details. 19 * A copy of the CDDL is also available via the Internet at 20 * http://www.opensource.org/licenses/cddl1.txt 21 * 22 * When distributing Covered Code, include this CDDL HEADER in each 23 * file and include the License file CDDL.Schily.txt from this distribution. 24 */ 25 26 #ifndef _SCHILY_MTIO_H 27 #define _SCHILY_MTIO_H 28 29 #ifndef _SCHILY_MCONFIG_H 30 #include <schily/mconfig.h> 31 #endif 32 33 #ifdef HAVE_SYS_MTIO_H 34 35 #include <sys/mtio.h> 36 37 #else /* ! HAVE_SYS_MTIO_H */ 38 39 40 #ifdef __cplusplus 41 extern "C" { 42 #endif 43 44 /* 45 * Definitions for magnetic tape io control commands 46 */ 47 48 /* 49 * structure for MTIOCTOP - magnetic tape operation command 50 */ 51 struct mtop { 52 short mt_op; /* op code (see below) */ 53 daddr_t mt_count; /* repeat count or param */ 54 }; 55 56 /* 57 * op code values for mt_op 58 */ 59 #define MTWEOF 0 /* write EOF record(s) */ 60 #define MTFSF 1 /* fwd space over file mark(s) */ 61 #define MTBSF 2 /* back space over file mark(s) (1/2" only ) */ 62 #define MTFSR 3 /* fwd space record(s) (to inter-record gap) */ 63 #define MTBSR 4 /* back space record(s) (to inter-record gap) */ 64 #define MTREW 5 /* rewind tape */ 65 #define MTOFFL 6 /* rewind and put the drive offline */ 66 #define MTNOP 7 /* no operation (sets status ?) */ 67 68 /* 69 * structure for MTIOCGET - magnetic tape get status command 70 */ 71 struct mtget { 72 short mt_type; /* type of magnetic tape device */ 73 /* the next two regs are device dependent */ 74 short mt_dsreg; /* drive status 'register' */ 75 short mt_erreg; /* error 'register' */ 76 daddr_t mt_resid; /* transfer residual count */ 77 daddr_t mt_fileno; /* file # for current position */ 78 daddr_t mt_blkno; /* block # for current position */ 79 }; 80 81 #define HAVE_MTGET_TYPE 82 #define HAVE_MTGET_DSREG 83 #define HAVE_MTGET_ERREG 84 #define HAVE_MTGET_RESID 85 #define HAVE_MTGET_FILENO 86 #define HAVE_MTGET_BLKNO 87 88 /* 89 * Define some junk here as software may assume that these two definitions 90 * are always present. 91 */ 92 #define MTIOCGET 0x12340001 93 #define MTIOCTOP 0x12340002 94 95 #ifdef __cplusplus 96 } 97 #endif 98 99 #endif /* HAVE_SYS_MTIO_H */ 100 101 #endif /* _SCHILY_MTIO_H */ 102