Newsgroups: comp.os.minix
Path: euryale.cc.adfa.oz.au!newshost.anu.edu.au!harbinger.cc.monash.edu.au!nntp.coast.net!howland.reston.ans.net!EU.net!sun4nl!cs.vu.nl!philip
From: philip@cs.vu.nl (Philip Homburg)
Subject: Re: Removing task numbers from FS
Nntp-Posting-Host: centaur.cs.vu.nl
Keywords: FS, device drivers
References: <9602081023@fangorn.moria>
Sender: news@cs.vu.nl
Organization: Fac. Wiskunde & Informatica, VU, Amsterdam
Date: Thu, 8 Feb 1996 17:50:48 GMT
Message-ID: <DMGxKp.JAL.0.-s@cs.vu.nl>
Lines: 58

In article <9602081023@fangorn.moria>,
Michael Haardt  <michael@cantor.informatik.rwth-aachen.de> wrote:
%Last weekend I had a little time and so I decided to continue the FS
%cleanup which I started ages ago: The device drivers should not be
%hardcoded in FS, but register in dmap at run time.  Of course there is a
%deadlock when FS wants to mount the root device but the root device
%wants to register its services.

In the current version of Minix-vmd, tasks have names. Those names are mapped
to tasks numbers when the device is opened for the first time:

	dmapp= dmap[major];
	dev_task = dmapp->dmap_task;                    /* device task nr */
	if (dev_task == ANY && dmapp->dmap_taskname != NULL)
	{
		/* Task has not been found yet, ask the kernel. */
		r= sys_findproc(dmapp->dmap_taskname, &tasknr, 0);
		if (r == ESRCH)
		{
			printf("unable to find task '%s'\n",
				dmapp->dmap_taskname);
			return ENODEV;
		}
		assert(r == OK);
		dev_task= dmapp->dmap_task= tasknr;
	}

An entry in the device table looks like this:
/* /dev/lp */     { gen_opcl,    gen_opcl,   ogen_rw,      no_ioctl,
                    gen_cancel,  gen_msg,    ANY,          6,
                    PRINTER_NAME,                                       },

(6 is the major device number of /dev/lp)

Devices that are not listed in the device table (like inet) register
themselves when they start:
 
        /* What device group am I to manage? */
        if (stat("/dev/eth0", &stb) < 0) {
                write(2, "inet: can't access device /dev/eth0\n", 36);
                _exit(1);
        }

        /* Register the device group. */
        device.dev= stb.st_rdev;
        device.style= STYLE_CLONE;
        if (svrctl(FSSIGNON, (void *) &device) == -1) {
                printf("error %d on registering ethernet devices\n", errno);
                pause();
        }







					Philip Homburg
