summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--CHANGES2
-rw-r--r--appl/cmd/ndb/registry.b19
-rw-r--r--dis/ndb/registry.disbin9615 -> 9642 bytes
-rw-r--r--include/version.h2
4 files changed, 15 insertions, 8 deletions
diff --git a/CHANGES b/CHANGES
index 9f53e5c6..a983d383 100644
--- a/CHANGES
+++ b/CHANGES
@@ -1,3 +1,5 @@
+20090816
+ registry(4) Event.post increased rootvers when entries are written or removed (issue 179, powerman)
20090809
bring mkfs(8) up to date (issue 176)
remove -q options from mkfs and mkext (-q was a transitional option to suppress quoting of file names)
diff --git a/appl/cmd/ndb/registry.b b/appl/cmd/ndb/registry.b
index 15e55622..1dd67903 100644
--- a/appl/cmd/ndb/registry.b
+++ b/appl/cmd/ndb/registry.b
@@ -153,6 +153,7 @@ init(nil: ref Draw->Context, args: list of string)
error(sys->sprint("can't open %s: %r", dbfile));
dbload(db);
db = nil; # for now assume it's static
+ attrdb = nil;
}
navops := chan of ref Navop;
spawn navigator(navops);
@@ -295,8 +296,9 @@ write(m: ref Tmsg.Write, fid: ref Fid): string
return "bad syntax";
# first write names the service (possibly with attributes)
if(svc.name == nil){
- if(svcnameok(hd toks) != nil)
- return "bad service name";
+ err := svcnameok(hd toks);
+ if(err != nil)
+ return err;
svc.name = hd toks;
toks = tl toks;
}
@@ -306,7 +308,8 @@ write(m: ref Tmsg.Write, fid: ref Fid): string
svc.vers++;
for(; toks != nil; toks = tl tl toks)
svc.set(hd toks, hd tl toks);
- Event.post(++rootvers);
+ rootvers++;
+ Event.post(rootvers);
Qfind =>
s := string m.data;
toks := str->unquoted(s);
@@ -339,9 +342,12 @@ clunk(fid: ref Fid)
case path & Mask {
Qsvc =>
svc := Service.find(path >> Shift);
- if(svc != nil && svc.fid == fid.fid && int svc.get("persist") == 0){
+ if(svc != nil && svc.fid == fid.fid && (fid.mode & Sys->ORCLOSE || int svc.get("persist") == 0)){
svc.remove();
- Event.post(rootvers);
+ if(svc.name != nil){ # otherwise there's no visible change
+ rootvers++;
+ Event.post(rootvers);
+ }
}
Qevent =>
if((e := Event.find(fid.fid)) != nil)
@@ -359,6 +365,7 @@ remove(fid: ref Fid): string
svc := Service.find(path >> Shift);
if(fid.uname == svc.owner){
svc.remove();
+ rootvers++;
Event.post(rootvers);
return nil;
}
@@ -568,7 +575,6 @@ Service.new(owner: string): ref Service
services[nservices] = svc;
svc.slot = nservices;
nservices++;
- rootvers++;
return svc;
}
@@ -585,7 +591,6 @@ Service.remove(svc: self ref Service)
slot := svc.slot;
services[slot] = nil;
nservices--;
- rootvers++;
if(slot != nservices){
services[slot] = services[nservices];
services[slot].slot = slot;
diff --git a/dis/ndb/registry.dis b/dis/ndb/registry.dis
index 321450ac..04e41150 100644
--- a/dis/ndb/registry.dis
+++ b/dis/ndb/registry.dis
Binary files differ
diff --git a/include/version.h b/include/version.h
index 1c008024..946be9aa 100644
--- a/include/version.h
+++ b/include/version.h
@@ -1 +1 @@
-#define VERSION "Fourth Edition (20090809)"
+#define VERSION "Fourth Edition (20090816)"