def open(ctx,path,ffi)
return wrap_context(ctx,__method__,path,ffi) if ctx
fh = FileHandle.new(path,ffi.flags)
if (FuseFS::RFUSEFS_COMPATIBILITY)
fh.raw = @root.raw_open(path,fh.raw_mode,true)
else
fh.raw = @root.raw_open(path,fh.raw_mode)
end
unless fh.raw
if fh.rdonly?
fh.contents = @root.read_file(path)
elsif fh.writing?
unless @root.can_write?(path)
raise Errno::EACCES.new(path)
end
if @created_files.has_key?(path)
fh.create
else
if fh.rdwr? || fh.append?
fh.contents = @root.read_file(path)
else
fh.contents = ""
end
end
else
raise Errno::ENOPERM.new(path)
end
end
ffi.fh=fh
end