Added some missing methods to the devfs to avoid programs expecting them to be there breaking (such as df) and ordered them the same way as they are in the Scala filesystem component.

This commit is contained in:
Florian Nücke 2016-04-27 23:47:46 +02:00
parent e9dac6e06c
commit 00bc7e2cee

View File

@ -8,6 +8,38 @@ function proxy.getLabel()
return "devfs"
end
function proxy.setLabel(value)
error("drive does not support labeling")
end
function proxy.isReadOnly()
return false
end
function proxy.spaceTotal()
return 0
end
function proxy.spaceUsed()
return 0
end
function proxy.exists(path)
return not not proxy.points[path]
end
function proxy.size(path)
return 0
end
function proxy.isDirectory(path)
return false
end
function proxy.lastModified(path)
return fs.lastModified("/dev/")
end
function proxy.list()
local keys = {}
for k,v in pairs(proxy.points) do
@ -16,8 +48,8 @@ function proxy.list()
return keys
end
function proxy.exists(path)
return not not proxy.points[path]
function proxy.makeDirectory(path)
return false
end
function proxy.remove(path)
@ -26,26 +58,10 @@ function proxy.remove(path)
return true
end
function proxy.isDirectory(path)
function proxy.rename(from, to)
return false
end
function proxy.size(path)
return 0
end
function proxy.lastModified(path)
return fs.lastModified("/dev/")
end
function proxy.read(h,...)
return h:read(...)
end
function proxy.write(h,...)
return h:write(...)
end
proxy.close = nop
function proxy.open(path, mode)
@ -69,6 +85,18 @@ function proxy.open(path, mode)
return handle
end
function proxy.read(h,...)
return h:read(...)
end
function proxy.seek(h,...)
return h:seek(...)
end
function proxy.write(h,...)
return h:write(...)
end
function proxy.create(path, handle)
handle.close = handle.close or nop
proxy.points[path] = handle