code: 9ferno

Download patch

ref: 0cb3dc37ca3d619e5f2017a592bc793094b9f7e4
parent: 07efa53a2516709225c49819bd45d7d7bc3b4f70
author: joe9 <joe9mail@gmail.com>
date: Wed Aug 4 07:02:18 EDT 2021

minor changes to account for 64 bit Qid.path

--- a/os/port/devsd.c
+++ b/os/port/devsd.c
@@ -71,10 +71,10 @@
 	Ncmd = 20,
 };
 
-#define TYPE(q)		((((ulong)(q).path)>>TypeSHIFT) & TypeMASK)
-#define PART(q)		((((ulong)(q).path)>>PartSHIFT) & PartMASK)
-#define UNIT(q)		((((ulong)(q).path)>>UnitSHIFT) & UnitMASK)
-#define DEV(q)		((((ulong)(q).path)>>DevSHIFT) & DevMASK)
+#define TYPE(q)		((((u64)(q).path)>>TypeSHIFT) & TypeMASK)
+#define PART(q)		((((u64)(q).path)>>PartSHIFT) & PartMASK)
+#define UNIT(q)		((((u64)(q).path)>>UnitSHIFT) & UnitMASK)
+#define DEV(q)		((((u64)(q).path)>>DevSHIFT) & DevMASK)
 #define QID(d,u, p, t)	(((d)<<DevSHIFT)|((u)<<UnitSHIFT)|\
 					 ((p)<<PartSHIFT)|((t)<<TypeSHIFT))
 
@@ -777,8 +777,8 @@
 	SDpart *pp;
 	SDunit *unit;
 	SDev *sdev;
-	ulong max, nb, offset;
-	uvlong bno;
+	u64 max, nb, offset;
+	u64 bno;
 
 	sdev = sdgetdev(DEV(c->qid));
 	if(sdev == nil){
@@ -1233,7 +1233,7 @@
 	SDpart *pp;
 	SDreq *r;
 	SDunit *unit;
-	u64 offset;
+	s64 offset;
 	int i, l, m, status;
 
 	offset = off;
--- a/os/port/proc.c
+++ b/os/port/proc.c
@@ -24,6 +24,10 @@
 	Proc*	tail;
 };
 
+/* multiple run queues by priority, different from Brian's book
+ * Per Brian's book, it is the struct Procs == struct Scheq.
+ * Now, inferno maintains multiple Schedq based on priority.
+ */
 static Schedq	runq[Nrq];
 static ulong	occupied;
 int	nrdy;
@@ -116,6 +120,8 @@
 		return;
 	}
 */
+
+	/* adding to the end of the queue of procs ready to run */
 	rq = &runq[p->pri];
 	lock(runq);
 	p->rnext = 0;