|
|
1.1 ! root 1: /* dsinit.c - dsinit */ ! 2: ! 3: #include <conf.h> ! 4: #include <kernel.h> ! 5: #include <disk.h> ! 6: ! 7: #ifdef Ndsk ! 8: struct dsblk dstab[Ndsk]; ! 9: #endif ! 10: int dskdbp, dskrbp; ! 11: ! 12: /*------------------------------------------------------------------------ ! 13: * dsinit -- initialize disk drive device ! 14: *------------------------------------------------------------------------ ! 15: */ ! 16: dsinit(devptr) ! 17: struct devsw *devptr; ! 18: { ! 19: struct dsblk *dsptr; ! 20: struct dtc *dtptr; ! 21: int status; ! 22: char ps; ! 23: ! 24: disable(ps); ! 25: devptr->dvioblk = dsptr = &dstab[ devptr->dvminor ]; ! 26: dsptr->dcsr = devptr->dvcsr; ! 27: dsptr->dreqlst = DRNULL; ! 28: dsptr->dnum = devptr->dvnum; ! 29: dsptr->dibsem = screate(1); ! 30: dsptr->dflsem = screate(1); ! 31: dsptr->ddirsem = screate(1); ! 32: dsptr->dnfiles = 0; ! 33: dsptr->ddir = getbuf(dskdbp); ! 34: iosetvec(devptr->dvnum, dsptr, dsptr); ! 35: ! 36: /* read directory block: setup read command then start interface */ ! 37: ! 38: dsptr->ddcb.xop = (char) XOREAD; ! 39: dsptr->ddcb.xunit = (char) 0; ! 40: dsptr->ddcb.xcntl = (char) XRETRY; ! 41: dsptr->ddcb.xmaddr = (char) ((DIRBLK>>8)&(0377)); ! 42: dsptr->ddcb.xladdr = (char) (DIRBLK&0377); ! 43: dsptr->ddcb.xcount = (char) 1; ! 44: dtptr = dsptr->dcsr; ! 45: dtptr->dt_dar = dsptr->ddir; ! 46: dtptr->dt_car = &dsptr->ddcb; ! 47: dtptr->dt_xdar = dtptr->dt_xcar = NULL; ! 48: dtptr->dt_csr = DTGO; ! 49: while ( ( (status=dtptr->dt_csr) & DTDONE) == 0) ! 50: ; ! 51: if (status & DTERROR) ! 52: panic("Disk error"); ! 53: restore(ps); ! 54: return(OK); ! 55: }
This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.