Example #1
0
/*******************************************************
 * MODULES 
 */
int64 stream_out_module(FILE *fp, MODULE *m)
{
	int64 count=0;

	PUTT(MODULE,BEGIN);

	PUTT(MODULE,NAME);
	PUTD(m->name,strlen(m->name));

	PUTT(MODULE,VERSION);
	PUTS(m->major);
	PUTS(m->minor);

	PUTT(MODULE,END);

	return count;
}
extern void
strategy(ReqPtr p)
{
	word rc, dseg;

	switch (p->cmd) {

	case DevInit:
		devhlp = p->u.ini.devhlp;

		dseg = ctors();

		if ((rc = DrvInit(p->u.ini.cmdline)) & ERROR) {
			p->u.ino.nunits = 0;
			p->u.ino.endCode = 0;
			p->u.ino.endData = 0;
		} else {
			p->u.ino.endCode = Offset(&end_code);
			p->u.ino.endData = dseg;
		}
		p->u.ino.bpb = 0;
		break;

	case DevBaseInit:
		devhlp = p->u.ini.devhlp;

		dseg = ctors();

		if ((rc = DrvInitBase(p->u.ini.cmdline)) & ERROR) {
			p->u.ino.nunits = 0;
			p->u.ino.endCode = 0;
			p->u.ino.endData = 0;
		} else {
			p->u.ino.endCode = Offset(&end_code);
			p->u.ino.endData = dseg;
			p->u.ini.cmdline = 0;
		}
		p->u.ino.bpb = 0;
		break;

	case DevRead:
		PUTS(2, "DevRead file=");
		PUTD(2, p->u.rw.fileno);
		PUTS(2, ", count=");
		PUTD(2, p->u.rw.count);
		PUTC(2, '\n');
		rc = DrvRead(p);
		break;
	case DevWrite:
		PUTS(2, "DevWrite file=");
		PUTD(2, p->u.rw.fileno);
		PUTS(2, ", count=");
		PUTD(2, p->u.rw.count);
		PUTC(2, '\n');
		rc = DrvWrite(p, 0);
		break;
	case DevWriteVerify:
		PUTS(2, "DevWriteVerify file=");
		PUTD(2, p->u.rw.fileno);
		PUTS(2, ", count=");
		PUTD(2, p->u.rw.count);
		PUTC(2, '\n');
		rc = DrvWrite(p, 1);
		break;
	case DevPeek:
		PUTS(2, "DevPeek\n");
		rc = DrvPeek(p);
		break;
	case DevInputStatus:
		PUTS(2, "DevInputStatus\n");
		rc = DrvInputStatus();
		break;
	case DevInputFlush:
		PUTS(2, "DevInputFlush\n");
		rc = DrvInputFlush();
		break;
	case DevOutputStatus:
		PUTS(2, "DevOutputStatus\n");
		rc = DrvOutputStatus();
		break;
	case DevOutputFlush:
		PUTS(2, "DevOutputFlush\n");
		rc = DrvOutputFlush();
		break;
	case DevOpen:
		PUTS(2, "DevOpen file=");
		PUTD(2, p->u.oc.fileno);
		PUTC(2, '\n');
		rc = DrvOpen(p);
		break;
	case DevClose:
		PUTS(2, "DevClose file=");
		PUTD(2, p->u.oc.fileno);
		PUTC(2, '\n');
		rc = DrvClose(p);
		break;
	case DevIOCtl:
		PUTS(2, "DevIOCtl cat=");
		PUTX(2, p->u.ioc.cat);
		PUTS(2, ", fcn=");
		PUTX(2, p->u.ioc.fcn);
		PUTS(2, ", plen=");
		PUTD(2, p->u.ioc.plen);
		PUTS(2, ", dlen=");
		PUTD(2, p->u.ioc.dlen);
		PUTC(2, '\n');
		rc = DrvIOCtl(p);
		break;
	default:
		rc = ERROR + DONE + InvalidCommand;
	}

	PUTS(2, "Status=");
	PUTX(2, rc);
	PUTC(2, '\n');
	p->status = rc;
}
Example #3
0
void trav(int beg, int post[]) {
  int i;
  for (i = beg; i != -1; i = post[i]) PUTD(i);
  puts("");
}