1 /* 2 * global.h 3 * 4 * Global declarations/definitions for tosha. 5 * 6 * Oliver Fromme <olli@fromme.com> 7 * 8 * Copyright (C) 1997,1998,1999 9 * Oliver Fromme. All rights reserved. 10 * 11 * Redistribution and use in source and binary forms, with or without 12 * modification, are permitted provided that the following conditions 13 * are met: 14 * 1. Redistributions of source code must retain the above copyright 15 * notice, this list of conditions and the following disclaimer. 16 * 2. Redistributions in binary form must reproduce the above copyright 17 * notice, this list of conditions and the following disclaimer in the 18 * documentation and/or other materials provided with the distribution. 19 * 3. Neither the name of the author nor the names of any co-contributors 20 * may be used to endorse or promote products derived from this software 21 * without specific prior written permission. 22 * 23 * THIS SOFTWARE IS PROVIDED BY OLIVER FROMME AND CONTRIBUTORS ``AS IS'' AND 24 * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 25 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 26 * ARE DISCLAIMED. IN NO EVENT SHALL OLIVER FROMME OR CONTRIBUTORS BE LIABLE 27 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 28 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS 29 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 30 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 31 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 32 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 33 * SUCH DAMAGE. 34 * 35 * @(#)$Id: global.h,v 1.3 1999/01/01 23:31:50 olli Exp $ 36 */ 37 38 static const char cvsid_global_h[] 39 = "@(#)$Id: global.h,v 1.3 1999/01/01 23:31:50 olli Exp $"; 40 41 #include <stdio.h> 42 #include <string.h> 43 #include <sys/errno.h> 44 #include <sys/time.h> 45 #include <fcntl.h> 46 #include <sys/types.h> 47 #include <sys/uio.h> 48 #include <unistd.h> 49 50 typedef unsigned char byte; 51 typedef unsigned long ulong; 52 53 /* 54 * Uncommenting this define will cause a LOT of output. 55 * Don't do that unless you need it and you know what you 56 * are doing (and what all the output means). 57 */ 58 /* #define DEBUG 1 */ 59 60 /* 61 * The maximum number of sectors that we can read with a 62 * single access is 26. I found this number by experimenting 63 * with my old Toshiba drive; other drives may differ. 64 * (N.B.: the maximum of 26 is probably caused by a 64 Kb 65 * limit of the drive: 64 Kb / 2450 = 26.7 [2450 is the size 66 * of one raw sector including subchannel data].) 67 * However, the default is 10 which should work with any 68 * reasonable drive. Also see the -b option. 69 */ 70 71 #define MAX_SECTORSPERBUF 26 72 #define SECTORSIZE 2352 73 #define READBUFSIZE ((MAX_SECTORSPERBUF) * (SECTORSIZE)) 74 extern byte buf[READBUFSIZE]; 75 76 extern int readcmd; /* read command to use for DA reading */ 77 extern int byteswap; /* do we have to swap byte order? */ 78 79 extern long long starttime; /* for estimating the remaining time */ 80 extern ulong totalsectors; /* total number of sectors to read */ 81 extern int tracklistsize; /* number of tracks to read */ 82 83 extern int verbose; 84 extern int sectorsperbuf; 85 86 void get_time (long long *tm); 87 88 /* EOF */ 89