Filesystem: Tidy naming of STATUS_ON_SERVER to ON_STORAGE

This commit is contained in:
Ernest Wong 2018-11-19 00:02:52 +13:00 committed by Fabian
commit 2f4520619a

View file

@ -26,7 +26,7 @@ var O_ACCMODE = 0x0003; // mask for above modes
var STATUS_INVALID = -0x1;
var STATUS_OK = 0x0;
var STATUS_ON_SERVER = 0x2;
var STATUS_ON_STORAGE = 0x2;
var STATUS_UNLINKED = 0x4;
var STATUS_FORWARDING = 0x5;
@ -128,7 +128,7 @@ FS.prototype.set_state = function(state)
FS.prototype.AddEvent = function(id, OnEvent) {
var inode = this.inodes[id];
if (inode.status == STATUS_OK || inode.status == STATUS_ON_SERVER) {
if (inode.status == STATUS_OK || inode.status == STATUS_ON_STORAGE) {
OnEvent();
}
else if(this.is_forwarder(inode))
@ -210,7 +210,7 @@ FS.prototype.LoadRecursive = function(data, parentid)
}
else if(ifmt === S_IFREG)
{
inode.status = STATUS_ON_SERVER;
inode.status = STATUS_ON_STORAGE;
inode.sha256sum = data[JSONFS_IDX_SHA256];
this.PushInode(inode, parentid, name);
}
@ -700,7 +700,7 @@ FS.prototype.CloseInode = async function(id) { // jshint ignore:line
{
return this.follow_fs(inode).CloseInode(inode.foreign_id);
}
if(inode.status === STATUS_ON_SERVER)
if(inode.status === STATUS_ON_STORAGE)
{
this.storage.can_uncache(inode.sha256sum);
}
@ -1077,7 +1077,7 @@ FS.prototype.get_data = async function(idx, offset, count) // jshint ignore:line
{
return this.inodedata[idx].subarray(offset, offset + count);
}
else if(inode.status === STATUS_ON_SERVER)
else if(inode.status === STATUS_ON_STORAGE)
{
dbg_assert(inode.sha256sum, "Filesystem get_data: found inode on server without sha256sum");
return await this.storage.read(inode.sha256sum, offset, count); // jshint ignore:line
@ -1097,7 +1097,7 @@ FS.prototype.set_data = async function(idx, buffer) // jshint ignore:line
{
// Current scheme: Save all modified buffers into local inodedata.
this.inodedata[idx] = buffer;
if(this.inodes[idx].status === STATUS_ON_SERVER)
if(this.inodes[idx].status === STATUS_ON_STORAGE)
{
this.inodes[idx].status = STATUS_OK;
this.storage.can_uncache(this.inodes[idx].sha256sum);