aboutsummaryrefslogtreecommitdiffstats
path: root/include/linux/ftape-header-segment.h
diff options
context:
space:
mode:
authorLinus Torvalds <torvalds@ppc970.osdl.org>2005-04-16 18:20:36 -0400
committerLinus Torvalds <torvalds@ppc970.osdl.org>2005-04-16 18:20:36 -0400
commit1da177e4c3f41524e886b7f1b8a0c1fc7321cac2 (patch)
tree0bba044c4ce775e45a88a51686b5d9f90697ea9d /include/linux/ftape-header-segment.h
Linux-2.6.12-rc2v2.6.12-rc2
Initial git repository build. I'm not bothering with the full history, even though we have it. We can create a separate "historical" git archive of that later if we want to, and in the meantime it's about 3.2GB when imported into git - space that would just make the early git days unnecessarily complicated, when we don't have a lot of good infrastructure for it. Let it rip!
Diffstat (limited to 'include/linux/ftape-header-segment.h')
-rw-r--r--include/linux/ftape-header-segment.h122
1 files changed, 122 insertions, 0 deletions
diff --git a/include/linux/ftape-header-segment.h b/include/linux/ftape-header-segment.h
new file mode 100644
index 000000000000..4732218f0708
--- /dev/null
+++ b/include/linux/ftape-header-segment.h
@@ -0,0 +1,122 @@
1#ifndef _FTAPE_HEADER_SEGMENT_H
2#define _FTAPE_HEADER_SEGMENT_H
3
4/*
5 * Copyright (C) 1996-1997 Claus-Justus Heine.
6
7 This program is free software; you can redistribute it and/or modify
8 it under the terms of the GNU General Public License as published by
9 the Free Software Foundation; either version 2, or (at your option)
10 any later version.
11
12 This program is distributed in the hope that it will be useful,
13 but WITHOUT ANY WARRANTY; without even the implied warranty of
14 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 GNU General Public License for more details.
16
17 You should have received a copy of the GNU General Public License
18 along with this program; see the file COPYING. If not, write to
19 the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.
20
21 *
22 * $Source: /homes/cvs/ftape-stacked/include/linux/ftape-header-segment.h,v $
23 * $Revision: 1.2 $
24 * $Date: 1997/10/05 19:19:28 $
25 *
26 * This file defines some offsets into the header segment of a
27 * floppy tape cartridge. For use with the QIC-40/80/3010/3020
28 * floppy-tape driver "ftape" for Linux.
29 */
30
31#define FT_SIGNATURE 0 /* must be 0xaa55aa55 */
32#define FT_FMT_CODE 4
33#define FT_REV_LEVEL 5 /* only for QIC-80 since. Rev. L (== 0x0c) */
34#define FT_HSEG_1 6 /* first header segment, except for format code 6 */
35#define FT_HSEG_2 8 /* second header segment, except for format code 6 */
36#define FT_FRST_SEG 10 /* first data segment, except for format code 6 */
37#define FT_LAST_SEG 12 /* last data segment, except for format code 6 */
38#define FT_FMT_DATE 14 /* date and time of most recent format, see below */
39#define FT_WR_DATE 18 /* date and time of most recent write or format */
40#define FT_SPT 24 /* segments per track */
41#define FT_TPC 26 /* tracks per cartridge */
42#define FT_FHM 27 /* floppy drive head (maximum of it) */
43#define FT_FTM 28 /* floppy track max. */
44#define FT_FSM 29 /* floppy sector max. (128) */
45#define FT_LABEL 30 /* floppy tape label */
46#define FT_LABEL_DATE 74 /* date and time the tape label was written */
47#define FT_LABEL_SZ (FT_LABEL_DATE - FT_LABEL)
48#define FT_CMAP_START 78 /* starting segment of compression map */
49#define FT_FMT_ERROR 128 /* must be set to 0xff if remainder gets lost during
50 * tape format
51 */
52#define FT_SEG_CNT 130 /* number of seg. written, formatted or verified
53 * through lifetime of tape (why not read?)
54 */
55#define FT_INIT_DATE 138 /* date and time of initial tape format */
56#define FT_FMT_CNT 142 /* number of times tape has been formatted */
57#define FT_FSL_CNT 144 /* number of segments in failed sector log */
58#define FT_MK_CODE 146 /* id string of tape manufacturer */
59#define FT_LOT_CODE 190 /* tape manufacturer lot code */
60#define FT_6_HSEG_1 234 /* first header segment for format code 6 */
61#define FT_6_HSEG_2 238 /* second header segment for format code 6 */
62#define FT_6_FRST_SEG 242 /* first data segment for format code 6 */
63#define FT_6_LAST_SEG 246 /* last data segment for format code 6 */
64
65#define FT_FSL 256
66#define FT_HEADER_END 256 /* space beyond this point:
67 * format codes 2, 3 and 5:
68 * - failed sector log until byte 2047
69 * - bad sector map in the reamining part of segment
70 * format codes 4 and 6:
71 * - bad sector map starts hear
72 */
73
74
75/* value to be stored at the FT_SIGNATURE offset
76 */
77#define FT_HSEG_MAGIC 0xaa55aa55
78#define FT_D2G_MAGIC 0x82288228 /* Ditto 2GB */
79
80/* data and time encoding: */
81#define FT_YEAR_SHIFT 25
82#define FT_YEAR_MASK 0xfe000000
83#define FT_YEAR_0 1970
84#define FT_YEAR_MAX 127
85#define FT_YEAR(year) ((((year)-FT_YEAR_0)<<FT_YEAR_SHIFT)&FT_YEAR_MASK)
86
87#define FT_TIME_SHIFT 0
88#define FT_TIME_MASK 0x01FFFFFF
89#define FT_TIME_MAX 0x01ea6dff /* last second of a year */
90#define FT_TIME(mo,d,h,m,s) \
91 ((((s)+60*((m)+60*((h)+24*((d)+31*(mo))))) & FT_TIME_MASK))
92
93#define FT_TIME_STAMP(y,mo,d,h,m,s) (FT_YEAR(y) | FT_TIME(mo,d,h,m,s))
94
95/* values for the format code field */
96typedef enum {
97 fmt_normal = 2, /* QIC-80 post Rev. B 205Ft or 307Ft tape */
98 fmt_1100ft = 3, /* QIC-80 post Rev. B 1100Ft tape */
99 fmt_var = 4, /* QIC-80 post Rev. B variabel length format */
100 fmt_425ft = 5, /* QIC-80 post Rev. B 425Ft tape */
101 fmt_big = 6 /* QIC-3010/3020 variable length tape with more
102 * than 2^16 segments per tape
103 */
104} ft_format_type;
105
106/* definitions for the failed sector log */
107#define FT_FSL_SIZE (2 * FT_SECTOR_SIZE - FT_HEADER_END)
108#define FT_FSL_MAX_ENTRIES (FT_FSL_SIZE/sizeof(__u32))
109
110typedef struct ft_fsl_entry {
111 __u16 segment;
112 __u16 date;
113} __attribute__ ((packed)) ft_fsl_entry;
114
115
116/* date encoding for the failed sector log
117 * month: 1..12, day: 1..31, year: 1970..2097
118 */
119#define FT_FSL_TIME_STAMP(y,m,d) \
120 (((((y) - FT_YEAR_0)<<9)&0xfe00) | (((m)<<5)&0x01e0) | ((d)&0x001f))
121
122#endif /* _FTAPE_HEADER_SEGMENT_H */