shithub: riscv

Download patch

ref: 09a848d825a600a2fe67ce37192a11fbf9f3685f
parent: db7290d79e86abfdab490e793073a4936c8e1e5f
author: cinap_lenrek <cinap_lenrek@localhost>
date: Sun May 1 03:41:21 EDT 2011

cwfs: cleanup

--- a/sys/src/cmd/cwfs/9p2.c
+++ b/sys/src/cmd/cwfs/9p2.c
@@ -242,7 +242,7 @@
 	}
 
 	/* fake read to get auth info */
-	authread(chan, af, nil, 0);
+	authread(af, nil, 0);
 	uid = af->uid;
 	if(db)
 		print("authorize: uid is %d\n", uid);
@@ -283,6 +283,7 @@
 			error = Ebadu;
 			goto out;
 		}
+		chan->err[0] = 0;
 	}
 	file->uid = u;
 
@@ -1001,7 +1002,7 @@
 		goto out;
 	}
 	if(file->qid.type & QTAUTH){
-		nread = authread(chan, file, (uchar*)data, count);
+		nread = authread(file, (uchar*)data, count);
 		if(nread < 0)
 			error = Eauth2;
 		goto out;
@@ -1198,7 +1199,7 @@
 	}
 
 	if(file->qid.type & QTAUTH){
-		nwrite = authwrite(chan, file, (uchar*)f->data, count);
+		nwrite = authwrite(file, (uchar*)f->data, count);
 		if(nwrite < 0)
 			error = Eauth2;
 		goto out;
--- a/sys/src/cmd/cwfs/auth.c
+++ b/sys/src/cmd/cwfs/auth.c
@@ -119,11 +119,13 @@
 }
 
 int
-authread(Chan *chan, File *file, uchar *data, int count)
+authread(File *file, uchar *data, int count)
 {
 	AuthInfo *ai;
 	AuthRpc *rpc;
+	Chan *chan;
 
+	chan = file->cp;
 	if((rpc = file->auth) == nil){
 		snprint(chan->err, sizeof(chan->err),
 			"not an auth fid");
@@ -162,10 +164,12 @@
 }
 
 int
-authwrite(Chan *chan, File *file, uchar *data, int count)
+authwrite(File *file, uchar *data, int count)
 {
 	AuthRpc *rpc;
+	Chan *chan;
 
+	chan = file->cp;
 	if((rpc = file->auth) == nil){
 		snprint(chan->err, sizeof(chan->err),
 			"not an auth fid");
--- a/sys/src/cmd/cwfs/portfns.h
+++ b/sys/src/cmd/cwfs/portfns.h
@@ -4,8 +4,8 @@
 void	arginit(void);
 void*	authnew(void);
 void	authfree(void*);
-int	authread(Chan*, File*, uchar*, int);
-int	authwrite(Chan*, File*, uchar*, int);
+int	authread(File*, uchar*, int);
+int	authwrite(File*, uchar*, int);
 void	cdiag(char*, int);
 int	cnumb(void);
 Device*	config(void);