def getattr(ctx,path)
return wrap_context(ctx,__method__,path) if ctx
uid = Process.uid
gid = Process.gid
if path == "/" || @root.directory?(path)
write_test_path = (path == "/" ? "" : path) + CHECK_FILE
mode = (@root.can_mkdir?(write_test_path) || @root.can_write?(write_test_path)) ? 0777 : 0555
atime,mtime,ctime = @root.times(path)
return RFuse::Stat.directory(mode,{ :uid => uid, :gid => gid, :nlink => 1, :atime => atime, :mtime => mtime, :ctime => ctime })
elsif @created_files.has_key?(path)
return @created_files[path]
elsif @root.file?(path)
mode = 0444
mode |= 0222 if @root.can_write?(path)
mode |= 0111 if @root.executable?(path)
size = size(path)
atime,mtime,ctime = @root.times(path)
return RFuse::Stat.file(mode,{ :uid => uid, :gid => gid, :size => size, :atime => atime, :mtime => mtime, :ctime => ctime })
else
raise Errno::ENOENT.new(path)
end
end