make fsmanager's mount function externally accessible
This commit is contained in:
parent
82decfabf9
commit
00d4472f91
@ -1,7 +1,8 @@
|
|||||||
local fsmanager = {}
|
local fsmanager = {}
|
||||||
fsmanager.filesystems = {}
|
fsmanager.filesystems = {}
|
||||||
local run = true
|
local run = true
|
||||||
local function mount(addr)
|
|
||||||
|
local function fsmanager.mount(addr)
|
||||||
dest = "/" .. (component.invoke(addr,"getLabel") or "mnt/"..addr:sub(1,3))
|
dest = "/" .. (component.invoke(addr,"getLabel") or "mnt/"..addr:sub(1,3))
|
||||||
syslog("Mounting "..addr.." to "..dest)
|
syslog("Mounting "..addr.." to "..dest)
|
||||||
fs.makeDirectory(dest)
|
fs.makeDirectory(dest)
|
||||||
@ -22,7 +23,7 @@ function fsmanager.start()
|
|||||||
while run do
|
while run do
|
||||||
local tE = {coroutine.yield()}
|
local tE = {coroutine.yield()}
|
||||||
if tE[1] == "component_added" and tE[3] == "filesystem" then
|
if tE[1] == "component_added" and tE[3] == "filesystem" then
|
||||||
mount(tE[2])
|
fsmanager.mount(tE[2])
|
||||||
elseif tE[1] == "component_removed" and fsmanager.filesystems[tE[2]] and tE[3] == "filesystem" then
|
elseif tE[1] == "component_removed" and fsmanager.filesystems[tE[2]] and tE[3] == "filesystem" then
|
||||||
syslog("Unmounting "..tE[2].." from "..fsmanager.filesystems[tE[2]])
|
syslog("Unmounting "..tE[2].." from "..fsmanager.filesystems[tE[2]])
|
||||||
fs.umount(fsmanager.filesystems[tE[2]])
|
fs.umount(fsmanager.filesystems[tE[2]])
|
||||||
|
Loading…
Reference in New Issue
Block a user