summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--CHANGES2
-rw-r--r--emu/port/devsrv.c8
-rw-r--r--include/version.h2
-rw-r--r--man/2/styxservers32
-rw-r--r--os/port/devsrv.c8
5 files changed, 42 insertions, 10 deletions
diff --git a/CHANGES b/CHANGES
index 899f899e..1667763e 100644
--- a/CHANGES
+++ b/CHANGES
@@ -1,3 +1,5 @@
+20070319
+ emu/port/devsrv.c and os/port/devsrv.c delete wc at correct time
20070312
rename -D and -k options to plumb (old ones still accepted); add -i option to take data from standard input; update man page
enable 64-bit seeks in /emu/Nt/devfs.c
diff --git a/emu/port/devsrv.c b/emu/port/devsrv.c
index 3fec01fc..f655bf96 100644
--- a/emu/port/devsrv.c
+++ b/emu/port/devsrv.c
@@ -607,10 +607,6 @@ srvwrite(Chan *c, void *va, long count, vlong offset)
ptrdel(D2H(req.t1));
destroy(req.t1);
- poperror();
- ptrdel(D2H(wc));
- destroy(wc);
-
h = heap(dev.Rwrite);
w = H2D(Sys_Rwrite *, h);
ptradd(h);
@@ -628,6 +624,10 @@ srvwrite(Chan *c, void *va, long count, vlong offset)
destroy(w);
poperror();
+ ptrdel(D2H(wc));
+ destroy(wc);
+
+ poperror();
release();
if(l < 0)
l = 0;
diff --git a/include/version.h b/include/version.h
index 224f2d4f..87f72207 100644
--- a/include/version.h
+++ b/include/version.h
@@ -1 +1 @@
-#define VERSION "Fourth Edition (20070312)"
+#define VERSION "Fourth Edition (20070319)"
diff --git a/man/2/styxservers b/man/2/styxservers
index bf66283b..3ba77131 100644
--- a/man/2/styxservers
+++ b/man/2/styxservers
@@ -42,6 +42,8 @@ Styxserver: adt {
:(ref Fid, string);
canwrite: fn(srv: self ref Styxserver, m: ref Tmsg.Write)
:(ref Fid, string);
+ canremove: fn(srv: self ref Styxserver, m: ref Tmsg.Remove)
+ :(ref Fid, big, string);
# fid management
getfid: fn(srv: self ref Styxserver, fid: int): ref Fid;
@@ -621,7 +623,7 @@ message
refers to a valid fid that has been opened for writing,
and that the file offset is non-negative.
.B Canwrite
-returns a tuple, say
+returns a tuple
.RI ( f ,\ err );
if the attempted access is illegal,
.I f
@@ -639,6 +641,34 @@ to obtain the
.B Fid
corresponding to the fid in the message, and check the access.
.TP
+.IB srv .canremove( m )
+Checks whether the
+removal of the file requested by
+message
+.I m
+is legal: the fid is valid, it is not a root directory, and there is write permission
+in the parent directory.
+.B Canremove
+returns a tuple
+.RI ( f,\ path,\ err );
+if the attempted access is illegal,
+.I f
+will be nil and
+.I err
+contains a description of the error;
+otherwise
+.I f
+contains the
+.B Fid
+for the file to be removed, and
+.I path
+is the
+.B Qid.path
+for the parent directory.The caller should remove the file, and in every case must call
+.B srv.delfid
+before replying,
+because the protocol's remove operation always clunks the fid.
+.TP
.IB srv .iounit()
Return an appropriate value for use as the
.I iounit
diff --git a/os/port/devsrv.c b/os/port/devsrv.c
index a80a3984..724e007e 100644
--- a/os/port/devsrv.c
+++ b/os/port/devsrv.c
@@ -606,10 +606,6 @@ srvwrite(Chan *c, void *va, long count, vlong offset)
ptrdel(D2H(req.t1));
destroy(req.t1);
- poperror();
- ptrdel(D2H(wc));
- destroy(wc);
-
h = heap(dev.Rwrite);
w = H2D(Sys_Rwrite *, h);
ptradd(h);
@@ -627,6 +623,10 @@ srvwrite(Chan *c, void *va, long count, vlong offset)
destroy(w);
poperror();
+ ptrdel(D2H(wc));
+ destroy(wc);
+
+ poperror();
release();
if(l < 0)
l = 0;