projects
/
oweals
/
luci.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
| inline |
side by side
(parent:
fd7072d
)
* luci/libs/uvl: add new datatype "device"
author
Jo-Philipp Wich
<jow@openwrt.org>
Sun, 12 Oct 2008 22:24:41 +0000
(22:24 +0000)
committer
Jo-Philipp Wich
<jow@openwrt.org>
Sun, 12 Oct 2008 22:24:41 +0000
(22:24 +0000)
libs/uvl/luasrc/uvl/datatypes.lua
patch
|
blob
|
history
diff --git
a/libs/uvl/luasrc/uvl/datatypes.lua
b/libs/uvl/luasrc/uvl/datatypes.lua
index fc37fa3c6989dfa378760f4f8fc225aa4e7bc9fb..615e2946d4c3fdd74d9df62ed074070d10af9dfe 100644
(file)
--- a/
libs/uvl/luasrc/uvl/datatypes.lua
+++ b/
libs/uvl/luasrc/uvl/datatypes.lua
@@
-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