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" return "devfs"
end 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() function proxy.list()
local keys = {} local keys = {}
for k,v in pairs(proxy.points) do for k,v in pairs(proxy.points) do
@ -16,8 +48,8 @@ function proxy.list()
return keys return keys
end end
function proxy.exists(path) function proxy.makeDirectory(path)
return not not proxy.points[path] return false
end end
function proxy.remove(path) function proxy.remove(path)
@ -26,26 +58,10 @@ function proxy.remove(path)
return true return true
end end
function proxy.isDirectory(path) function proxy.rename(from, to)
return false return false
end 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 proxy.close = nop
function proxy.open(path, mode) function proxy.open(path, mode)
@ -69,6 +85,18 @@ function proxy.open(path, mode)
return handle return handle
end 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) function proxy.create(path, handle)
handle.close = handle.close or nop handle.close = handle.close or nop
proxy.points[path] = handle proxy.points[path] = handle