9p: Track filename during RENAMEAT

This commit is contained in:
Ernest Wong 2018-09-01 21:28:26 +12:00 committed by Fabian
commit 1a7dc59f07

View file

@ -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;