* luci/libs/uvl: add new datatype "device"
This commit is contained in:
parent
fd7072de2d
commit
725719c221
1 changed files with 16 additions and 0 deletions
|
@ -169,3 +169,19 @@ function file( val, seen )
|
|||
|
||||
return false
|
||||
end
|
||||
|
||||
function device( val, seen )
|
||||
local s = fs.stat( val )
|
||||
seen = seen or { }
|
||||
|
||||
if s and not seen[s.ino] then
|
||||
seen[s.ino] = true
|
||||
if s.type == "character device" or s.type == "block device" then
|
||||
return true
|
||||
elseif s.type == "link" then
|
||||
return device( fs.readlink(val), seen )
|
||||
end
|
||||
end
|
||||
|
||||
return false
|
||||
end
|
||||
|
|
Loading…
Reference in a new issue