Commits

Anonymous committed ddd52ef

Add fsremove.
Make fsread more clear.
Update todo list.

Comments (0)

Files changed (1)

 /*
  * todo:
- * wstat
- * writing
  * authenticated mounts
  * measure performance penalty
+ * notify failed operations?
  * threads?
  */
 
 	fprint(ctlfd, "create: %s %d %d\n", a->name, r->ifcall.mode, r->ifcall.perm);
 }
 
+static void
+fsremove(Req *r)
+{
+	Aux *a;
+
+	a = r->fid->aux;
+	if(remove(a->name) < 0){
+		respond(r, "could not remove");
+		return;
+	}
+
+	/* 
+	 * If lib9p has freed r->fid->aux, a->name is wrong.
+     * Instead of copying the name, we just notify before responding.
+	 */
+	fprint(ctlfd, "remove: %s\n", a->name);
+	respond(r, nil);
+}
+
 
 static int
 dirgen(int, Dir *rd, void *v)
 	Aux *a;
 
 	a = r->fid->aux;
-	if(r->fid->qid.type & QTDIR){
-		n = fsdirread(r);
-		if(n < 0){
-			respond(r, "read error");
-			return;
-		}		
-		goto Resp;
-	}
-
-	n = pread(a->fd, r->ofcall.data, r->ifcall.count, r->ifcall.offset);
+	if(r->fid->qid.type & QTDIR)
+		n = fsdirread(r);	
+	else
+		n = pread(a->fd, r->ofcall.data, r->ifcall.count, r->ifcall.offset);
 	if(n < 0){
 		respond(r, "read error");
 		return;
 	}
-
-Resp:
+	
 	r->ofcall.count = n;
 	respond(r, nil);
 	fprint(ctlfd, "read: %s %ld %lld\n", a->name, n, r->ifcall.offset);
 .clone=			fsclone,
 .open=			fsopen,
 .create=		fscreate,
+.remove=		fsremove,
 .read=			fsread,
 .write=			fswrite,
 .stat=			fsstat,
Tip: Filter by directory path e.g. /media app.js to search for public/media/app.js.
Tip: Use camelCasing e.g. ProjME to search for ProjectModifiedEvent.java.
Tip: Filter by extension type e.g. /repo .js to search for all .js files in the /repo directory.
Tip: Separate your search with spaces e.g. /ssh pom.xml to search for src/ssh/pom.xml.
Tip: Use ↑ and ↓ arrow keys to navigate and return to view the file.
Tip: You can also navigate files with Ctrl+j (next) and Ctrl+k (previous) and view the file with Ctrl+o.
Tip: You can also navigate files with Alt+j (next) and Alt+k (previous) and view the file with Alt+o.