From 054f58609bb7f92c77720474332d9c933d000078 Mon Sep 17 00:00:00 2001 From: XeonSquared Date: Sun, 22 Dec 2019 01:35:55 +1100 Subject: [PATCH] added auto-rewind and an no-rewind node for tape-devfs --- service/tape-devfs.lua | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/service/tape-devfs.lua b/service/tape-devfs.lua index 3fd0421..3a24678 100644 --- a/service/tape-devfs.lua +++ b/service/tape-devfs.lua @@ -2,6 +2,11 @@ local counter = 0 local td = {} local function addNode(addr) 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) return tape.read, tape.write, function() end, tape.seek end) @@ -14,7 +19,7 @@ end while true do local tE = {coroutine.yield()} 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 if td[tE[2]] then fs.remove("/dev/tape"..tostring(td[tE[2]]))