shithub: riscv

Download patch

ref: d8d433894a706ec65384bd8a18630d18912f0f78
parent: 926be5e34eb633bc3e22b013705f5474d21aa735
author: Jacob Moody <moody@posixcafe.org>
date: Sun Jun 5 08:29:50 EDT 2022

kernel: cleanup unused fields from devpipe

We don't need to multiply session path by 2, the definition
for NETQID is:

Meaning we don't need to save room between session paths
for individual Qid paths. This doubles the amount of
pipe sessions we can have before a wrap.

--- a/sys/src/9/port/devpipe.c
+++ b/sys/src/9/port/devpipe.c
@@ -11,9 +11,7 @@
 struct Pipe
 {
 	QLock;
-	Pipe	*next;
 	int	ref;
-	ulong	path;
 	Queue	*q[2];
 	int	qref[2];
 };
@@ -57,6 +55,7 @@
 {
 	Pipe *p;
 	Chan *c;
+	ulong path;
 
 	c = devattach('|', spec);
 	if(waserror()){
@@ -82,10 +81,10 @@
 	poperror();
 
 	lock(&pipealloc);
-	p->path = ++pipealloc.path;
+	path = ++pipealloc.path;
 	unlock(&pipealloc);
 
-	mkqid(&c->qid, NETQID(2*p->path, Qdir), 0, QTDIR);
+	mkqid(&c->qid, NETQID(path, Qdir), 0, QTDIR);
 	c->aux = p;
 	c->dev = 0;
 	return c;