shithub: 9ferno

Download patch

ref: 98a4d15507d812192519ab53fa552927eb2311eb
parent: 7c9ff080f7f0b6b1a6554adb40310a5b4e6f9fd2
author: joe9 <joe9mail@gmail.com>
date: Tue Jul 13 06:22:25 EDT 2021

more changes to use u64 for c->qid.path

--- a/os/port/devXXX.c
+++ b/os/port/devXXX.c
@@ -87,7 +87,7 @@
 {
 	USED(offset);
 
-	switch((ulong)c->qid.path){
+	switch((u64)c->qid.path){
 	case Qdir:
 		return devdirread(c, a, n, XXXtab, nelem(XXXtab), devgen);
 	case Qdata:
@@ -110,7 +110,7 @@
 {
 	USED(a, offset);
 
-	switch((ulong)c->qid.path){
+	switch((u64)c->qid.path){
 	case Qdata:
 		break;
 	default:
--- a/os/port/devaudio.c
+++ b/os/port/devaudio.c
@@ -614,7 +614,7 @@
 	if(audio.major != 4)
 		error(Emajor);
 
-	switch((ulong)c->qid.path) {
+	switch((u64)c->qid.path) {
 	default:
 		error(Eperm);
 		break;
@@ -655,7 +655,7 @@
 audioclose(Chan *c)
 {
 
-	switch((ulong)c->qid.path) {
+	switch((u64)c->qid.path) {
 	default:
 		error(Eperm);
 		break;
@@ -694,7 +694,7 @@
 
 	a = vp;
 	n0 = n;
-	switch((ulong)c->qid.path) {
+	switch((u64)c->qid.path) {
 	default:
 		error(Eperm);
 		break;
@@ -789,7 +789,7 @@
 
 	a = vp;
 	n0 = n;
-	switch((ulong)c->qid.path) {
+	switch((u64)c->qid.path) {
 	default:
 		error(Eperm);
 		break;
--- a/os/port/devbench.c
+++ b/os/port/devbench.c
@@ -1060,7 +1060,7 @@
 static int
 benchstat(Chan *c, uchar *dp, int n)
 {
-	switch((ulong)c->qid.path){
+	switch((u64)c->qid.path){
 	case Benchdataqid:
 		benchtab[Data].length = bench.wpos - bench.buf;
 	}
@@ -1078,7 +1078,7 @@
 	vlong us;
 	char tmp[64];
 
-	switch((ulong)c->qid.path){
+	switch((u64)c->qid.path){
 	case Benchdirqid:
 		return devdirread(c, buf, n, benchtab, nelem(benchtab), devgen);
 
@@ -1102,7 +1102,7 @@
 {
 	int argn = n;
 
-	switch((ulong)c->qid.path){
+	switch((u64)c->qid.path){
 	case Benchctlqid:
 		bench.test = None;
 		memset((char *)bench.buf, 0, bench.bufsz);
--- a/os/port/devboot.c
+++ b/os/port/devboot.c
@@ -64,7 +64,7 @@
 static long	 
 bootread(Chan *c, void *buf, long n, vlong offset)
 {
-	switch((ulong)c->qid.path){
+	switch((u64)c->qid.path){
 
 	case Qdir:
 		return devdirread(c, buf, n, bootdir, nelem(bootdir), devgen);
@@ -90,7 +90,7 @@
 	ulong pc;
 	uchar *p;
 
-	switch((ulong)c->qid.path){
+	switch((u64)c->qid.path){
 	case Qmem:
 		/* kernel memory */
 		if(offset>=KZERO && offset<KZERO+conf.npage*BY2PG){
--- a/os/port/devcap.c
+++ b/os/port/devcap.c
@@ -123,7 +123,7 @@
 capread(Chan *c, void *va, s32 n, s64 vl)
 {
 	USED(vl);
-	switch((ulong)c->qid.path){
+	switch((u64)c->qid.path){
 	case Qdir:
 		return devdirread(c, va, n, capdir, ncapdir, devgen);
 
@@ -204,7 +204,7 @@
 capwrite(Chan* c, void* buf, s32 n, s64 offset)
 {
 	USED(offset);
-	switch((ulong)c->qid.path){
+	switch((u64)c->qid.path){
 	case Qhash:
 		if(capwritehash(buf, n) < 0)
 			error(Ebadarg);
--- a/os/port/devcons.c
+++ b/os/port/devcons.c
@@ -831,7 +831,7 @@
 consopen(Chan *c, u32 omode)
 {
 	c->aux = 0;
-	switch((ulong)c->qid.path){
+	switch((u64)c->qid.path){
 	case Qconsctl:
 		if(!iseve())
 			error(Eperm);
@@ -891,7 +891,7 @@
 	if((c->flag&COPEN) == 0)
 		return;
 
-	switch((ulong)c->qid.path){
+	switch((u64)c->qid.path){
 	case Qconsctl:
 		/* last close of control file turns off raw */
 		qlock(&kbd);
@@ -938,7 +938,7 @@
 	if(n <= 0)
 		return n;
 	o = up->env;
-	switch((ulong)c->qid.path){
+	switch((u64)c->qid.path){
 	case Qdir:
 		return devdirread(c, buf, n, consdir, nelem(consdir), devgen);
 	case Qsysctl:
@@ -1084,7 +1084,7 @@
 	char buf[256];
 	int x;
 
-	switch((ulong)c->qid.path){
+	switch((u64)c->qid.path){
 	case Qcons:
 		/*
 		 * Can't page fault in putstrn, so copy the data locally.
--- a/os/port/devdbg.c
+++ b/os/port/devdbg.c
@@ -805,7 +805,7 @@
 {
 	char *ctlstate;
 
-	switch((ulong)c->qid.path){
+	switch((u64)c->qid.path){
 	case Qdir:
 		return devdirread(c, buf, n, dbgdir, nelem(dbgdir), devgen);
 	case Qdbgctl:
@@ -956,7 +956,7 @@
 {
 	Cmdbuf *cb;
 
-	switch((ulong)c->qid.path){
+	switch((u64)c->qid.path){
 	default:
 		error(Egreg);
 		break;
--- a/os/port/devdynld.c
+++ b/os/port/devdynld.c
@@ -287,7 +287,7 @@
 static long
 dlread(Chan *c, void *a, long n, vlong voffset)
 {
-	switch((ulong)c->qid.path){
+	switch((u64)c->qid.path){
 	case Qdir:
 		return devdirread(c, a, n, dltab, nelem(dltab), devgen);
 	case Qdynld:
@@ -307,7 +307,7 @@
 	char *name, *tag, *path;
 
 	USED(voffset);
-	switch((ulong)c->qid.path){
+	switch((u64)c->qid.path){
 	case Qdynld:
 		cb = parsecmd(a, n);
 		qlock(&dllock);
--- a/os/port/devflash.c
+++ b/os/port/devflash.c
@@ -112,7 +112,7 @@
 		return flash2gen(c, QID(s>>1, s&1?Qctl:Qdata), dp);
 	case Qctl:
 	case Qdata:
-		return flash2gen(c, (ulong)c->qid.path, dp);
+		return flash2gen(c, (u64)c->qid.path, dp);
 	}
 	return -1;
 }
--- a/os/port/devi2c.c
+++ b/os/port/devi2c.c
@@ -115,7 +115,7 @@
 	ulong len;
 
 	d = c->aux;
-	switch((ulong)c->qid.path){
+	switch((u64)c->qid.path){
 	case Qdir:
 		return devdirread(c, a, n, d->tab, nelem(d->tab), devgen);
 	case Qdata:
@@ -157,7 +157,7 @@
 	Cmdbuf *cb;
 
 	USED(offset);
-	switch((ulong)c->qid.path){
+	switch((u64)c->qid.path){
 	case Qdata:
 		d = c->aux;
 		len = d->tab[1].length;
--- a/os/port/devkprof.c
+++ b/os/port/devkprof.c
@@ -120,7 +120,7 @@
 	ulong w, *bp;
 	uchar *a, *ea;
 
-	switch((ulong)c->qid.path){
+	switch((u64)c->qid.path){
 	case Qdir:
 		return devdirread(c, va, n, kproftab, nelem(kproftab), devgen);
 
@@ -161,7 +161,7 @@
 	USED(offset);
 
 	a = vp;
-	switch((ulong)c->qid.path){
+	switch((u64)c->qid.path){
 	case Qctl:
 		if(strncmp(a, "startclr", 8) == 0){
 			memset((char *)kprof.buf, 0, kprof.nbuf*SZ);
--- a/os/port/devpci.c
+++ b/os/port/devpci.c
@@ -87,7 +87,7 @@
 		return pcigen2(c, s+Qpcictl, p->tbdf, dp);
 	case Qpcictl:
 	case Qpciraw:
-		tbdf = MKBUS(BusPCI, 0, 0, 0)|BUSBDF((ulong)c->qid.path);
+		tbdf = MKBUS(BusPCI, 0, 0, 0)|BUSBDF((u64)c->qid.path);
 		p = pcimatchtbdf(tbdf);
 		if(p == nil)
 			return -1;
@@ -141,7 +141,7 @@
 	case Qpcidir:
 		return devdirread(c, a, n, nil, 0, pcigen);
 	case Qpcictl:
-		tbdf = MKBUS(BusPCI, 0, 0, 0)|BUSBDF((ulong)c->qid.path);
+		tbdf = MKBUS(BusPCI, 0, 0, 0)|BUSBDF((u64)c->qid.path);
 		p = pcimatchtbdf(tbdf);
 		if(p == nil)
 			error(Egreg);
@@ -157,7 +157,7 @@
 		*w = '\0';
 		return readstr(offset, a, n, buf);
 	case Qpciraw:
-		tbdf = MKBUS(BusPCI, 0, 0, 0)|BUSBDF((ulong)c->qid.path);
+		tbdf = MKBUS(BusPCI, 0, 0, 0)|BUSBDF((u64)c->qid.path);
 		p = pcimatchtbdf(tbdf);
 		if(p == nil)
 			error(Egreg);
--- a/os/port/devpointer.c
+++ b/os/port/devpointer.c
@@ -146,7 +146,7 @@
 	Walkqid *wq;
 
 	wq = devwalk(c, nc, name, nname, pointertab, nelem(pointertab), devgen);
-	if(wq != nil && wq->clone != c && wq->clone != nil && (ulong)c->qid.path == Qpointer)
+	if(wq != nil && wq->clone != c && wq->clone != nil && (u64)c->qid.path == Qpointer)
 		incref(&mouse.ref);	/* can this happen? */
 	return wq;
 }
@@ -161,7 +161,7 @@
 pointeropen(Chan* c, u32 omode)
 {
 	c = devopen(c, omode, pointertab, nelem(pointertab), devgen);
-	if((ulong)c->qid.path == Qpointer){
+	if((u64)c->qid.path == Qpointer){
 		if(waserror()){
 			c->flag &= ~COPEN;
 			nexterror();
@@ -184,7 +184,7 @@
 {
 	if((c->flag & COPEN) == 0)
 		return;
-	switch((ulong)c->qid.path){
+	switch((u64)c->qid.path){
 	case Qpointer:
 		qlock(&mouse.q);
 		/* TODO if(decref(&mouse.ref) == 0)
@@ -201,7 +201,7 @@
 	char tmp[128];
 	int l;
 
-	switch((ulong)c->qid.path){
+	switch((u64)c->qid.path){
 	case Qdir:
 		return devdirread(c, a, n, pointertab, nelem(pointertab), devgen);
 	case Qpointer:
--- a/os/port/devprog.c
+++ b/os/port/devprog.c
@@ -168,7 +168,7 @@
 		return 1;
 	}
 
-	if((ulong)c->qid.path == Qdir) {
+	if((u64)c->qid.path == Qdir) {
 		if(name != nil){
 			/* ignore s and use name to find pid */
 			pid = strtoul(name, &e, 0);
--- a/os/port/devsign.c
+++ b/os/port/devsign.c
@@ -282,7 +282,7 @@
 		return c;
 	}
 
-	switch((ulong)c->qid.path){
+	switch((u64)c->qid.path){
 	case Qctl:
 		if(!iseve())
 			error(Eperm);
@@ -320,7 +320,7 @@
 	sigs = up->env->sigs;
 	if(sigs == nil)
 		return 0;
-	switch((ulong)c->qid.path){
+	switch((u64)c->qid.path){
 	case Qkey:
 		buf = smalloc(Maxkey);
 		if(waserror()){
@@ -363,7 +363,7 @@
 	if(c->qid.type & QTDIR)
 		error(Eisdir);
 	USED(offset);
-	switch((ulong)c->qid.path){
+	switch((u64)c->qid.path){
 	case Qkey:
 		if(n >= Maxkey)
 			error(Etoobig);
--- a/os/port/devtest.c
+++ b/os/port/devtest.c
@@ -78,7 +78,7 @@
 testread(Chan* c, void* a, long n, vlong offset)
 {
 	char digest[MD5dlen*2+1];
-	switch ((ulong)c->qid.path) {
+	switch ((u64)c->qid.path) {
 	case Qdir:
 		return devdirread(c, a, n, testtab, nelem(testtab), devgen);
 	case Qkt5sum:
--- a/os/port/devtk.c
+++ b/os/port/devtk.c
@@ -103,7 +103,7 @@
 {
 	if(c->qid.type & QTDIR)
 		return devopen(c, omode, tkdirtab, nelem(tkdirtab), devgen);
-	switch((ulong)c->qid.path){
+	switch((u64)c->qid.path){
 	case Qtkevents:
 		c = devopen(c, omode, tkdirtab, nelem(tkdirtab), devgen);
 		qlock(&tkevents.l);
@@ -139,7 +139,7 @@
 tkread(Chan* c, void* a, long n, vlong offset)
 {
 	USED(offset);
-	switch((ulong)c->qid.path){
+	switch((u64)c->qid.path){
 	case Qdir:
 		return devdirread(c, a, n, tkdirtab, nelem(tkdirtab), devgen);
 	case Qtkevents: