1
1
mirror of https://git.shadowkat.net/izaya/OC-PsychOS2.git synced 2024-11-15 01:07:02 -05:00

make fsmanager's mount function externally accessible

This commit is contained in:
XeonSquared 2023-08-07 12:54:25 +10:00
parent 82decfabf9
commit 00d4472f91

View File

@ -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]])