forked from izaya/OC-PsychOS2
added auto-rewind and an no-rewind node for tape-devfs
This commit is contained in:
parent
0d01b03ddc
commit
054f58609b
@ -2,6 +2,11 @@ local counter = 0
|
|||||||
local td = {}
|
local td = {}
|
||||||
local function addNode(addr)
|
local function addNode(addr)
|
||||||
devfs.register("tape"..tonumber(counter),function()
|
devfs.register("tape"..tonumber(counter),function()
|
||||||
|
local tape = component.proxy(addr)
|
||||||
|
tape.seek(-math.huge)
|
||||||
|
return tape.read, tape.write, function() end, tape.seek
|
||||||
|
end)
|
||||||
|
devfs.register("tapen"..tonumber(counter),function()
|
||||||
local tape = component.proxy(addr)
|
local tape = component.proxy(addr)
|
||||||
return tape.read, tape.write, function() end, tape.seek
|
return tape.read, tape.write, function() end, tape.seek
|
||||||
end)
|
end)
|
||||||
@ -14,7 +19,7 @@ end
|
|||||||
while true do
|
while true do
|
||||||
local tE = {coroutine.yield()}
|
local tE = {coroutine.yield()}
|
||||||
if tE[1] == "component_added" and tE[3] == "tape_drive" then
|
if tE[1] == "component_added" and tE[3] == "tape_drive" then
|
||||||
addNode[tE[2]]
|
addNode(tE[2])
|
||||||
elseif tE[1] == "component_removed" and tE[3] == "tape_drive" then
|
elseif tE[1] == "component_removed" and tE[3] == "tape_drive" then
|
||||||
if td[tE[2]] then
|
if td[tE[2]] then
|
||||||
fs.remove("/dev/tape"..tostring(td[tE[2]]))
|
fs.remove("/dev/tape"..tostring(td[tE[2]]))
|
||||||
|
Loading…
Reference in New Issue
Block a user