1
1
mirror of https://git.shadowkat.net/izaya/OC-PsychOS2.git synced 2024-11-22 12:04:20 -05:00

importfs and exportfs improvements

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

View File

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