lib/fuse/rfusefs-fuse.rb
def open(ctx,path,ffi)
        return wrap_context(ctx,__method__,path,ffi) if ctx
        fh = FileHandle.new(path,ffi.flags)

        #Save the value return from raw_open to be passed back in raw_read/write etc..
        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 #wronly && !append
                #We should get a truncate 0, but might as well play it safe
                fh.contents = ""
              end
            end
          else
            raise Errno::ENOPERM.new(path)
          end
        end

        #If we get this far, save our filehandle in the FUSE structure
        ffi.fh=fh
      end
# Open. Create a FileHandler and store in fuse file info
# This will be returned to us in read/write
# No O_CREATE (mknod first?), no O_TRUNC (truncate first)
Open. Create a FileHandler and store in fuse file info
This will be returned to us in read/write
No O_CREATE (mknod first?), no O_TRUNC (truncate first)
Open . Create a FileHandler and store in fuse file info This will be returned to us in read / write No O_CREATE ( mknod first? ) no O_TRUNC ( truncate first )
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
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
Open.
Open .
#Save the value return from raw_open to be passed back in raw_read/write etc.. #wronly && !append #We should get a truncate 0, but might as well play it safe #If we get this far, save our filehandle in the FUSE structure
ctx
path
ffi