* Copyright (c) 1982 Regents of the University of California.
* All rights reserved. The Berkeley software License Agreement
* specifies the terms and conditions for redistribution.
* @(#)drtest.c 6.2 (Berkeley) %G%
* Standalone program to test a disk and driver
* by reading the disk a track at a time.
int fd
, tracksize
, debug
;
register int sector
, lastsector
;
printf("Testprogram for stand-alone driver\n\n");
cp
= prompt("Enable debugging (1=bse, 2=ecc, 3=bse+ecc)? ");
ioctl(fd
, SAIODEVDATA
, (char *)&st
);
printf("Device data: #cylinders=%d, #tracks=%d, #sectors=%d\n",
st
.ncyl
, st
.ntrak
, st
.nsect
);
ioctl(fd
, SAIODEBUG
, (char *)debug
);
tracksize
= st
.nsect
* SECTSIZ
;
printf("Reading in %d byte records\n", tracksize
);
printf("Start ...make sure drive is on-line\n");
lastsector
= st
.ncyl
* st
.nspc
;
for (sector
= 0; sector
< lastsector
; sector
+= st
.nsect
) {
if (sector
&& (sector
% (st
.nspc
* 10)) == 0)
printf("cylinder %d\n", sector
/st
.nspc
);
* Prompt and verify a device name from the user.
register struct devsw
*dp
;
cp
= prompt("Device to read? ");
if ((fd
= open(cp
, 2)) < 0) {
printf("Known devices are: ");
for (dp
= devsw
; dp
->dv_name
; dp
++)
printf("%s ",dp
->dv_name
);
* Allocate memory on a page-aligned address.
* Round allocated chunk to a page multiple to
last
= (caddr_t
)(((int)&end
+ 511) & ~0x1ff);
size
= (size
+ 511) & ~0x1ff;