9front - general discussion about 9front
 help / color / mirror / Atom feed
From: unobe@cpan.org
To: 9front@9front.org
Subject: [9front] [patch] fix port/devloopback.c so #λ can be built
Date: Wed, 21 Apr 2021 00:10:55 -0700	[thread overview]
Message-ID: <F2B06ADD862A56891D4CB9E98A0CC91F@smtp.pobox.com> (raw)

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");



                 reply	other threads:[~2021-04-21  7:18 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=F2B06ADD862A56891D4CB9E98A0CC91F@smtp.pobox.com \
    --to=unobe@cpan.org \
    --cc=9front@9front.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).