9front - general discussion about 9front
 help / color / mirror / Atom feed
* [9front] [patch] fix port/devloopback.c so #λ can be built
@ 2021-04-21  7:10 unobe
  0 siblings, 0 replies; only message in thread
From: unobe @ 2021-04-21  7:10 UTC (permalink / raw)
  To: 9front

loopback(3) describes #λ, but AFAICT it hasn't been built in the
9front kernels.  Granted, this is all new to me, so I could very well
be misunderstanding something critical.  I didn't add the device to
pc/pc and pc64/pc64 because I wasn't sure if the driver should be
added back, or if it's only selected for inclusion in the kernel for
testing.  Clearly, it hadn't been tested in awhile, if ever.  I
reviewed the logs for devloopback.c and pc/pc and pc/pc64 all the way
back to the initial import of the Plan 9 code: it never was included
in the initial import of pc/pccpuf, pc/pc64, etc.

I did add it to my mbp branch's pc64/pc64mb after ip and tested it by
building the kernel and booting; I can now use/see #λ:

@@ -22,6 +22,7 @@
 	ether		netif
 	bridge		netif log
 	ip		arp chandial ip ipv6 ipaux iproute netlog ethermedium nullmedium pktmedium inferno
+	loopback
 
 	draw		screen vga vgax vgasoft
 	mouse		mouse

This patch below apply cleanly to the default branch.

changeset:   8444:a321ba95666e
branch:      mbp-2011
user:        Romano <unobe@cpan.org>
date:        Tue Apr 20 23:55:06 2021 -0700
files:       sys/src/9/port/devloopback.c
description:
devloopback.c didn't compile due to changes in the Timer struct, the
Link struct, and referencing devloopbacktab before it was declared.


diff -r 2bc7dceab4ef -r a321ba95666e sys/src/9/port/devloopback.c
--- a/sys/src/9/port/devloopback.c	Tue Apr 20 22:41:52 2021 -0700
+++ b/sys/src/9/port/devloopback.c	Tue Apr 20 23:55:06 2021 -0700
@@ -127,7 +127,7 @@
 	if(dev >= Nloopbacks)
 		error(Enodev);
 
-	c = devattach(loopbackdevtab.dc, spec);
+	c = devattach(L'λ', spec);
 	if(waserror()){
 		chanfree(c);
 		nexterror();
@@ -144,9 +144,9 @@
 	lb->ref++;
 	if(lb->ref == 1){
 		for(chan = 0; chan < 2; chan++){
-			lb->link[chan].ci.mode = Trelative;
-			lb->link[chan].ci.a = &lb->link[chan];
-			lb->link[chan].ci.f = linkintr;
+			lb->link[chan].ci.tmode = Trelative;
+			lb->link[chan].ci.ta = &lb->link[chan];
+			lb->link[chan].ci.tf = linkintr;
 			lb->link[chan].limit = Loopqlim;
 			q = qopen(lb->link[chan].limit, 0, 0, 0);
 			lb->link[chan].iq = q;
@@ -464,8 +464,8 @@
 	Link *link;
 	Cmdbuf *volatile cb;
 	Block *volatile bp;
-	vlong d0, d0ns;
-	long dn, dnns;
+	vlong d0ns;
+	long dnns;
 
 	switch(TYPE(c->qid.path)){
 	case Qdata:
@@ -580,8 +580,8 @@
 {
 	Link *link;
 
-	link = ci->a;
-	pushlink(link, ci->ns);
+	link = ci->ta;
+	pushlink(link, ci->tns);
 }
 
 /*
@@ -630,7 +630,7 @@
 		tin = gtime(bp->rp);
 		if(tin > tout)
 			tout = tin;
-		tout = tout + (BLEN(bp) - Tmsize) * link->delayn;
+		tout = tout + (BLEN(bp) - Tmsize) * link->delaynns;
 
 		/*
 		 * drop packets
@@ -678,7 +678,7 @@
 	if(!tin || tin > tout && tout)
 		tin = tout;
 
-	link->ci.ns = tin - now;
+	link->ci.tns = tin - now;
 	if(tin){
 		if(tin < now)
 			panic("loopback unfinished business");



^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2021-04-21  7:18 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-04-21  7:10 [9front] [patch] fix port/devloopback.c so #λ can be built unobe

9front - general discussion about 9front

This inbox may be cloned and mirrored by anyone:

	git clone --mirror http://inbox.vuxu.org/9front

	# If you have public-inbox 1.1+ installed, you may
	# initialize and index your mirror using the following commands:
	public-inbox-init -V1 9front 9front/ http://inbox.vuxu.org/9front \
		9front@9front.org
	public-inbox-index 9front

Example config snippet for mirrors.
Newsgroup available over NNTP:
	nntp://inbox.vuxu.org/vuxu.archive.9front


AGPL code for this site: git clone https://public-inbox.org/public-inbox.git