importfs and exportfs improvements

This commit is contained in:
Izaya 2020-03-26 17:37:14 +11:00
parent 6c2ef1580b
commit cfe3e78d64

View File

@ -1,6 +1,7 @@
local computer = require "computer"
local minitel = require "minitel"
local event = require "event"
local ufs = require "unionfs"
local rpc = require "rpc"
local netutil = {}
@ -9,6 +10,7 @@ function netutil.importfs(host,rpath,lpath) -- import filesystem *rpath* from *h
function px.getLabel()
return host..":"..rpath
end
px.address = host..":"..rpath
return fs.mount(lpath,px)
end
@ -16,7 +18,7 @@ function netutil.exportfs(path) -- export the directory *path* over RPC
local path = "/"..table.concat(fs.segments(path),"/")
local px = ufs.create(path)
for k,v in pairs(px) do
rpcs.register(path.."_"..k,v)
rpc.register(path.."_"..k,v)
print(path.."_"..k)
end
return true