File:  [XINU] / xinu / sys / LSI / dskenq.c
Revision 1.1.1.1 (vendor branch): download - view: text, annotated - select for diffs
Tue Apr 24 17:39:04 2018 UTC (8 years, 3 months ago) by root
Branches: xinu, MAIN
CVS tags: xinu-19870308, HEAD
Xinu for VAX

/* dskenq.c - dskenq */

#include <conf.h>
#include <kernel.h>
#include <disk.h>

/*------------------------------------------------------------------------
 *  dskenq  --  enqueue a disk request and start I/O if disk not busy
 *------------------------------------------------------------------------
 */
dskenq(drptr, dsptr)
	struct	dreq	*drptr;
	struct	dsblk	*dsptr;
{
	struct	dreq	*p, *q;		/* q follows p through requests	*/
	DBADDR	block;
	int	st;

	if ( (q=dsptr->dreqlst) == DRNULL ) {
		dsptr->dreqlst = drptr;
		drptr->drnext = DRNULL;
		dskstrt(dsptr);
		return(DONQ);
	}
	block = drptr->drdba;
	for (p = q->drnext ; p != DRNULL ; q=p,p=p->drnext) {
		if (p->drdba==block && (st=dskqopt(p, q, drptr)!=SYSERR))
				return(st);
		if ( (q->drdba <= block && block < p->drdba) ||
		     (q->drdba >= block && block > p->drdba)   ) {
			drptr->drnext = p;
			q->drnext = drptr;
			return(DONQ);
		}
	}
	drptr->drnext = DRNULL;
	q->drnext = drptr;
	return(DONQ);
}

unix.superglobalmegacorp.com

This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.