elsen@esat.kuleuven.ac.be (12/11/89)
I would like to know how LBN's relate to head numbers on RA81's and RA90's. This would give me the opportunity of tracking down possible defective heads (or head pre-amplifiers) when I get BAD BLOCK Replacements in the errorlog (of course , BBR's can have other causes too). Could someone please post this formula ? -- Marc Elsen (System Manager/Software Engineer) Katholieke Universiteit Leuven Dep. E.S.A.T. Kard. Mercierlaan 94 3030 HEVERLEE Belgium tel. 32(0)16220931(ext. 1080) EMAIL : elsen@esat.kuleuven.ac.be ...!kulcs!kulesat!elsen (UUCP) elsen%kulesat.uucp@blekul60 (BITNET) psi%02062166012::elsen (PSI MAIL)
jtkohl@quicksilver.mit.edu (John T Kohl) (12/13/89)
Here's a program which reads LBN's from a Unix/Ultrix message file, and translates to cylinder, etc. This one knows about ra80's and ra81's; if you get an RA90 user's manual, it should have the appropriate geometry info you need to wire into this program. I got this from someone else at MIT, who got it from someone else... insert standard disclaimer. #include <stdio.h> #define LINESIZE 132 /* Maximum number of characters on a line */ main(argc,argv) int argc; char *argv[]; { char line[LINESIZE], *fgets(), *lineptr, *findstring(); long blocknumber; FILE *infile; int nscyl, nstrk, nblk = -1; if (argc != 4) { fprintf(stderr, "Usage: %s drive_type drive_name log_file\n", argv[0]); exit(-1); } if (!strcmp(argv[1], "ra81")) { nscyl = 714; nstrk = 51; nblk = 891072; } else if (!strcmp(argv[1], "ra80")) { nscyl = 434; nstrk = 31; nblk = 242606; } else if (!strcmp(argv[1], "ra60")) { nscyl = 168; nstrk = 42; nblk = 400176; } if (nblk == -1) { fprintf(stderr, "%s: unknown drive type %s\n", argv[0], argv[1]); exit(-1); } if ((infile = fopen(argv[3], "r")) == NULL) { fprintf(stderr, "%s: Can't open %s\n", argv[0], argv[3]); exit(-1); } while (fgets(line, LINESIZE, infile) != NULL){ /* Look for a line with the drive name and "hdr" on it */ if ((findstring(argv[2], line) == NULL) || (lineptr = findstring("hdr 0x", line)) == NULL) continue; /* Get the block number */ sscanf(lineptr, "%X", &blocknumber); hdr(blocknumber, nscyl, nstrk, nblk); } } char *findstring(substring, string) register char *substring, *string; { register char *ptr; int match; for ( ; *string != '\0'; string++) { match = 1; for (ptr = substring; *ptr != '\0'; ptr++, string++) { if (*ptr != *string){ match = 0; break; } } if (match) return (string); } return (NULL); } hdr(blocknumber, nscyl, nstrk,nb) long blocknumber; int nscyl; int nstrk; int nb; { long cyl; long trk; long sec; printf("hdr: %6D", blocknumber); if (blocknumber >=0 && blocknumber <=nb) { cyl = blocknumber / nscyl; trk = (blocknumber - (cyl * nscyl)) / nstrk; sec = blocknumber - (cyl * nscyl) - (trk * nstrk); printf(" cyl: %4D trk: %2D sec: %2D\n", cyl, trk, sec); } else printf(" Illegal blocknumber\n"); } -- John Kohl <jtkohl@ATHENA.MIT.EDU> or <jtkohl@Kolvir.Brookline.MA.US> Digital Equipment Corporation/Project Athena (The above opinions are MINE. Don't put my words in somebody else's mouth!)