shithub: rngfs

Download patch

ref: a8195ee6b67009a01caceaa25680115410ee6876
parent: 4ac4dc82da5199dd156f2c0c103f614c0e1d35c7
author: kvik <kvik@a-b.xyz>
date: Sun Jun 7 17:19:00 EDT 2020

Rename Fstate fs -> st, and Srv fileserver -> fs

--- a/rngfs.c	Sun Jun  7 17:07:40 2020
+++ b/rngfs.c	Sun Jun  7 17:19:00 2020
@@ -171,7 +171,7 @@
 	char buf[128];
 	int n = 0;
 	uvlong path = r->fid->qid.path;
-	Fstate *fs = r->fid->aux;
+	Fstate *st = r->fid->aux;
 
 	if(path == Qroot){
 		dirread9p(r, rootgen, r);
@@ -182,11 +182,11 @@
 	switch(path){
 	case Qinteger:
 		n = snprint(buf, sizeof buf, "%ld\n",
-			randominteger(fs->min.i, fs->max.i));
+			randominteger(st->min.i, st->max.i));
 		break;
 	case Qreal:
 		n = snprint(buf, sizeof buf, "%f\n",
-			randomreal(fs->min.d, fs->max.d));
+			randomreal(st->min.d, st->max.d));
 		break;
 	}
 	if(r->ifcall.count < n)
@@ -202,7 +202,7 @@
 	uvlong path = r->fid->qid.path;
 	Cmdbuf *cb;
 	Cmdtab *cp;
-	Fstate *fs = r->fid->aux;
+	Fstate *st = r->fid->aux;
 
 	cb = parsecmd(r->ifcall.data, r->ifcall.count);
 	cp = lookupcmd(cb, cmd, nelem(cmd));
@@ -214,19 +214,19 @@
 	case Cmdrange:
 		switch(path){
 		case Qinteger:
-			fs->min.i = strtol(cb->f[1], nil, 10);
-			fs->max.i = strtol(cb->f[2], nil, 10);
+			st->min.i = strtol(cb->f[1], nil, 10);
+			st->max.i = strtol(cb->f[2], nil, 10);
 			break;
 		case Qreal:
-			fs->min.d = strtod(cb->f[1], nil);
-			fs->max.d = strtod(cb->f[1], nil);
+			st->min.d = strtod(cb->f[1], nil);
+			st->max.d = strtod(cb->f[1], nil);
 		}
 		break;
 	}
 	respond(r, nil);
 }
 
-Srv fileserver = {
+Srv fs = {
 	.attach = xattach,
 	.walk1 = xwalk1,
 	.open = xopen,
@@ -259,6 +259,6 @@
 	}ARGEND;
 	
 	srand(time(0));
-	postmountsrv(&fileserver, srvn, mtpt, MREPL);
+	postmountsrv(&fs, srvn, mtpt, MREPL);
 	exits(nil);
 }