From 1a7dc59f07767966c162f37188b9869aba41c8e1 Mon Sep 17 00:00:00 2001 From: Ernest Wong Date: Sat, 1 Sep 2018 21:28:26 +1200 Subject: [PATCH] 9p: Track filename during RENAMEAT --- lib/9p.js | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/lib/9p.js b/lib/9p.js index 51a345bd..fe0f12df 100644 --- a/lib/9p.js +++ b/lib/9p.js @@ -199,6 +199,14 @@ Virtio9p.prototype.Createfid = function(inodeid, type, uid, dbg_name) { return {inodeid, type, uid, dbg_name}; }; +Virtio9p.prototype.update_dbg_name = function(idx, newname) +{ + for(const fid of this.fids) + { + if(fid.inodeid === idx) fid.dbg_name = newname; + } +}; + Virtio9p.prototype.Reset = function() { this.fids = []; }; @@ -389,6 +397,7 @@ Virtio9p.prototype.ReceiveRequest = function (bufchain) { var idx = this.fs.CreateFile(name, this.fids[fid].inodeid); this.fids[fid].inodeid = idx; this.fids[fid].type = FID_INODE; + this.fids[fid].dbg_name = name; var inode = this.fs.GetInode(idx); inode.uid = this.fids[fid].uid; inode.gid = gid; @@ -618,6 +627,8 @@ Virtio9p.prototype.ReceiveRequest = function (bufchain) { this.SendReply(bufchain); break; } + const newidx = this.fs.Search(this.fids[newdirfid].inodeid, newname); + this.update_dbg_name(newidx, newname); this.BuildReply(id, tag, 0); this.SendReply(bufchain); break;