henesyinit from p9f0ed2a895 years agoHistory
155 lines · 2.5 KB · C
RawDownload
#include "all.h"#include "mem.h"#include "io.h"#include "ureg.h" #include "dosfs.h" #ifndef	DATE#define	DATE	568011600L+4*3600#endif ulong	mktime		= DATE;				/* set by mkfile */Startsb	startsb[] ={	"main",	3066839,	0}; Dos dos; staticstruct{	char	*name;	long	(*read)(int, void*, long);	long	(*seek)(int, long);	long	(*write)(int, void*, long);	int	(*part)(int, char*);} nvrdevs[] ={	{ "fd", floppyread, floppyseek, floppywrite, 0, },	{ "hd", ataread,   ataseek,   atawrite,   setatapart, },	/*	{ "sd", scsiread,   scsiseek,   scsiwrite,   setscsipart, },	 */	{ 0, },}; voidotherinit(void){	int dev, i, nfd, nhd, s;	char *p, *q, buf[sizeof(nvrfile)+8]; 	kbdinit();	printcpufreq();	etherinit();	scsiinit(); 	s = spllo();	nhd = atainit();	nfd = floppyinit();	dev = 0;	if(p = getconf("nvr")){		strncpy(buf, p, sizeof(buf)-2);		buf[sizeof(buf)-1] = 0;		p = strchr(buf, '!');		q = strrchr(buf, '!');		if(p == 0 || q == 0 || strchr(p+1, '!') != q)			panic("malformed nvrfile: %s\n", buf);		*p++ = 0;		*q++ = 0;		dev = strtoul(p, 0, 0);		strcpy(nvrfile, q);		p = buf;	} else	if(p = getconf("bootfile")){		strncpy(buf, p, sizeof(buf)-2);		buf[sizeof(buf)-1] = 0;		p = strchr(buf, '!');		q = strrchr(buf, '!');		if(p == 0 || q == 0 || strchr(p+1, '!') != q)			panic("malformed bootfile: %s\n", buf);		*p++ = 0;		*q = 0;		dev = strtoul(p, 0, 0);		p = buf;	} else	if(nfd)		p = "fd";	else	if(nhd)		p = "hd";	else		p = "sd"; 	for(i = 0; nvrdevs[i].name; i++){		if(strcmp(p, nvrdevs[i].name) == 0){			dos.dev = dev;			if(nvrdevs[i].part && (*nvrdevs[i].part)(dos.dev, "disk") == 0)				break;			dos.read = nvrdevs[i].read;			dos.seek = nvrdevs[i].seek;			dos.write = nvrdevs[i].write;			break;		}	}	if(dos.read == 0)		panic("no device for nvram\n");	if(dosinit(&dos) < 0)		panic("can't init dos dosfs on %s\n", p);	splx(s); 	conf.nuid = 1000;	conf.gidspace = conf.nuid*3;	conf.nfile = 50000;	conf.nwpath = conf.nfile*8;} voidtouser(void){	int i;  	settime(rtctime());	boottime = time(); 	print("sysinit\n");	sysinit(); 	userinit(floppyproc, 0, "floppyproc");	/*	 * Ethernet i/o processes	 */	etherstart(); 	/*	 * read ahead processes	 */	userinit(rahead, 0, "rah"); 	/*	 * server processes	 */	for(i=0; i<conf.nserve; i++)		userinit(serve, 0, "srv"); 	/*	 * worm "dump" copy process	 */	userinit(wormcopy, 0, "wcp"); 	/*	 * processes to read the console	 */	consserve(); 	/*	 * "sync" copy process	 * this doesn't return.	 */	u->text = "scp";	synccopy();}

Keyboard shortcuts

General

Show keyboard shortcuts
?
Focus the current search
/

Issues and pull requests

Open filters
f

Issues, pull requests and Inbox

Select next item
j↓
Select previous item
k↑
Open selected item
Enter
Dismiss filters or clear selection
Esc

Repository code

Go to file
t