1 /* 2 * Copyright (c) 1992 The Regents of the University of California. 3 * All rights reserved. 4 * 5 * This software was developed by the Computer Systems Engineering group 6 * at Lawrence Berkeley Laboratory under DARPA contract BG 91-66 and 7 * contributed to Berkeley. 8 * 9 * All advertising materials mentioning features or use of this software 10 * must display the following acknowledgement: 11 * This product includes software developed by the University of 12 * California, Lawrence Berkeley Laboratories. 13 * 14 * %sccs.include.redist.c% 15 * 16 * @(#)sdtrace.h 5.2 (Berkeley) 07/23/92 17 * 18 * $Header: sdtrace.h,v 1.5 92/07/10 07:00:38 torek Exp $ (LBL) 19 */ 20 21 /* 22 * SCSI disk command tracing 23 */ 24 25 #if defined(SDTRACE) || !defined(KERNEL) 26 struct sdtrace { 27 struct timeval time; /* timestamp */ 28 u_int block; /* disk block */ 29 u_int bcount; /* # bytes transferred */ 30 u_char tcode; /* trace code */ 31 u_char target; /* target number */ 32 u_char unit; /* unit number on target */ 33 u_char read; /* read operation */ 34 }; 35 36 #define T_START 0x01 37 #define T_MKCDB 0x02 38 #define T_INTR 0x03 39 #endif 40 41 #ifdef SDTRACE 42 /* Allow kernel config to override number of entries */ 43 #ifndef NSDOPBUF 44 #define NSDOPBUF 1024 45 #endif 46 47 struct sdtrace sdopbuf[NSDOPBUF]; 48 struct sdtrace *sdopptr = sdopbuf; 49 int nsdopbuf = NSDOPBUF; /* for sdtrace */ 50 u_long sdopcnt; 51 52 #define SD_TRACE(code, sc, bp) { \ 53 if (++sdopptr >= &sdopbuf[NSDOPBUF]) \ 54 sdopptr = sdopbuf; \ 55 microtime(&sdopptr->time); \ 56 sdopptr->tcode = code; \ 57 sdopptr->read = bp->b_flags & B_READ; \ 58 sdopptr->block = bp->b_blkno; \ 59 sdopptr->bcount = bp->b_bcount; \ 60 sdopptr->target = sc->sc_unit.u_targ; \ 61 sdopptr->unit = sc->sc_unit.u_unit; \ 62 ++sdopcnt; \ 63 } 64 #else 65 #define SD_TRACE(code, sc, bp) { } 66 #endif 67