Преглед на файлове

added auto-rewind and an no-rewind node for tape-devfs

pull/1/head
XeonSquared преди 4 години
родител
ревизия
054f58609b
променени са 1 файла, в които са добавени 6 реда и са изтрити 1 реда
  1. +6
    -1
      service/tape-devfs.lua

+ 6
- 1
service/tape-devfs.lua Целия файл

@@ -3,6 +3,11 @@ 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)
td[addr] = counter
@@ -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]]))


Loading…
Отказ
Запис