Compare commits

...

2 Commits

Author SHA1 Message Date
77ceb65be6 service/tape-iofs.lua
added a service to make an iofs node for each tape drive attached to the system, as /iofs/tapeN
2019-07-21 17:46:16 +10:00
8e3ee7bcb2 never mind no reading files line by line in fs.read 2019-07-21 17:45:22 +10:00
2 changed files with 8 additions and 11 deletions

View File

@ -29,19 +29,8 @@ for k,v in pairs({"makeDirectory","exists","isDirectory","list","lastModified","
end
local function fread(self,length)
length = length or "*l"
if length == "*a" then
length = math.huge
elseif length == "*l" then
local rstr, lstr = "", ""
while true do
lstr = fs.mounts[self.fs].read(self.fid,1)
if lstr == "\n" or not lstr then
break
end
rstr = rstr .. lstr
end
return rstr
end
if type(length) == "number" then
local rstr, lstr = "", ""

8
service/tape-iofs.lua Normal file
View File

@ -0,0 +1,8 @@
local counter = 0
for addr in component.list("tape_drive") do
iofs.register("tape"..tonumber(counter),function()
local tape = component.proxy(addr)
return tape.read, tape.write, function() end, tape.seek
end)
counter = counter + 1
end