5 * Copyright (C) 1996, 1997 Claus-Justus Heine.
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)
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.
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.
22 * $Source: /homes/cvs/ftape-stacked/ftape/zftape/zftape-rw.h,v $
24 * $Date: 1997/10/05 19:19:09 $
26 * This file contains the definitions for the read and write
27 * functions for the QIC-117 floppy-tape driver for Linux.
31 #include <linux/config.h> /* for CONFIG_ZFT_DFLT_BLK_SZ */
32 #include "../zftape/zftape-buffers.h"
34 #define SEGMENTS_PER_TAPE (ft_segments_per_track * ft_tracks_per_tape)
36 /* QIC-113 Rev. G says that `a maximum of 63488 raw bytes may be
37 * compressed into a single frame'.
38 * Maybe we should stick to 32kb to make it more `beautiful'
40 #define ZFT_MAX_BLK_SZ (62*1024) /* bytes */
41 #if !defined(CONFIG_ZFT_DFLT_BLK_SZ)
42 # define CONFIG_ZFT_DFLT_BLK_SZ (10*1024) /* bytes, default of gnu tar */
43 #elif CONFIG_ZFT_DFLT_BLK_SZ == 0
44 # undef CONFIG_ZFT_DFLT_BLK_SZ
45 # define CONFIG_ZFT_DFLT_BLK_SZ 1
46 #elif (CONFIG_ZFT_DFLT_BLK_SZ % 1024) != 0
47 # error CONFIG_ZFT_DFLT_BLK_SZ must be 1 or a multiple of 1024
49 /* The *optional* compression routines need some overhead per tape
50 * block for their purposes. Instead of asking the actual compression
51 * implementation how much it needs, we restrict this overhead to be
52 * maximal of ZFT_CMPT_OVERHEAD size. We need this for EOT
53 * conditions. The tape is assumed to be logical at EOT when the
54 * distance from the physical EOT is less than
55 * one tape block + ZFT_CMPR_OVERHEAD
57 #define ZFT_CMPR_OVERHEAD 16 /* bytes */
66 typedef struct /* all values measured in bytes */
68 int seg_pos
; /* segment currently positioned at */
69 int seg_byte_pos
; /* offset in current segment */
70 __s64 tape_pos
; /* real offset from BOT */
71 __s64 volume_pos
; /* pos. in uncompressed data stream in
76 extern zft_position zft_pos
;
77 extern __u8
*zft_deblock_buf
;
78 extern __u8
*zft_hseg_buf
;
79 extern int zft_deblock_segment
;
80 extern zft_status_enum zft_io_state
;
81 extern int zft_header_changed
;
82 extern int zft_qic113
; /* conform to old specs. and old zftape */
83 extern int zft_use_compression
;
84 extern unsigned int zft_blk_sz
;
85 extern __s64 zft_capacity
;
86 extern unsigned int zft_written_segments
;
87 extern int zft_label_changed
;
89 /* zftape-rw.c exported functions
91 extern unsigned int zft_get_seg_sz(unsigned int segment
);
92 extern void zft_set_flags(unsigned int minor_unit
);
93 extern int zft_calc_seg_byte_coord(int *seg_byte_pos
, __s64 tape_pos
);
94 extern __s64
zft_calc_tape_pos(int segment
);
95 extern __s64
zft_get_capacity(void);
96 extern void zft_update_label(__u8
*buffer
);
97 extern int zft_erase(void);
98 extern int zft_verify_write_segments(unsigned int segment
,
99 __u8
*data
, size_t size
, __u8
*buffer
);
100 extern unsigned int zft_get_time(void);
101 #endif /* _ZFTAPE_RW_H */