add some requires and such so rtfs will run on OpenOS unmodified

This commit is contained in:
Izaya 2023-10-07 08:05:13 +10:00
parent 64951b513b
commit ce02798aeb
2 changed files with 6 additions and 2 deletions

View File

@ -1,3 +1,6 @@
local fs = fs or require "filesystem"
local component = require "component"
local computer = require "computer"
local cache = (package.loaded["fs.rtfs"] or {}).cache or {hitsR=0, hitsW=0, missesR=0, missesW=0}
local proxy = {}
local rtfs = {proxy=proxy, cache=cache}

View File

@ -1,3 +1,4 @@
local fs = fs or require "filesystem"
local common = require "fs.rtfs"
local rtfs, proxy = {}, setmetatable({},{__index=common.proxy})
local ieformat = ">I2I8I8c46" -- type (4 bits) and index (12 bits), start sector (32 bits), lenth in bytes (32 bits), name/path (46 bytes)
@ -373,7 +374,7 @@ function proxy:compactIndex(ti)
return ri
end
function rtfs.mount(p)
function rtfs.mount(p,ro)
local d = common.getProxy(p)
local p = setmetatable({}, {__index=proxy})
p.d = d
@ -420,7 +421,7 @@ function rtfs.mount(p)
function p.spaceTotal()
return p.capacity - (math.ceil(p.isize / (p.blockSize / iesize))*p.blockSize) - p.blockSize
end
p.isReadOnly = p.d.isReadOnly
p.isReadOnly = p.d.isReadOnly or function() return ro or false end
function p.list(name)
name = fnormalize(name)