Class: RFuse::FuseDelegator

Inherits:
Fuse
  • Object
show all
Defined in:
lib/rfuse.rb

Overview

This class is useful to make your filesystem implementation debuggable and testable without needing to mount an actual filesystem or inherit from Fuse

Constant Summary collapse

FUSE_METHODS =

Available fuse methods -see http://fuse.sourceforge.net/doxygen/structfuse__operations.html Note :getdir and :utime are deprecated :ioctl, :poll are not implemented in the C extension

[ :getattr, :readlink, :getdir, :mknod, :mkdir,
:unlink, :rmdir, :symlink, :rename, :link,
:chmod, :chown, :truncate, :utime, :open,
:create, :read, :write, :statfs, :flush,
:release, :fsync, :setxattr, :getxattr, :listxattr,:removexattr,
:opendir, :readdir, :releasedir, :fsycndir,
:init, :destroy, :access, :ftruncate, :fgetattr, :lock,
:utimens, :bmap, :ioctl, :poll ]

Instance Method Summary collapse

Methods inherited from Fuse

#access, #bmap, #chmod, #chown, #create, #exit, #fd, #fgetattr, #flush, #fsync, #fsyncdir, #ftruncate, #getattr, #getdir, #getxattr, #init, #invalidate, #link, #listxattr, #lock, #loop, #mkdir, #mknod, #mounted?, #mountname, #open, #opendir, #process, #read, #readdir, #readlink, #release, #releasedir, #removexattr, #rename, #run, #setxattr, #sigterm, #statfs, #symlink, #trap_signals, #truncate, #unlink, #unmount, #utime, #utimens, #write

Constructor Details

#initialize(fuse_object, mountpoint, *options) ⇒ FuseDelegator

Create and mount a filesystem

Parameters:

  • fuse_object (Object)

    your filesystem object that responds to fuse methods

  • mountpoint (String)

    existing directory where the filesystem will be mounted

  • options (String...)

    fuse mount options (use "-h" to see a list)



473
474
475
476
477
478
479
# File 'lib/rfuse.rb', line 473

def initialize(fuse_object,mountpoint,*options)
    @fuse_delegate = fuse_object
    define_fuse_methods(fuse_object)
    @debug = false
    self.debug=$DEBUG
    super(mountpoint,options)
end

Instance Method Details

#debug=(value) ⇒ Boolean

Set debugging on or off

Parameters:

  • value (Boolean)

    enable or disable debugging

Returns:

  • (Boolean)

    the new debug value

Since:

  • 1.1.0



503
504
505
506
507
508
509
510
511
# File 'lib/rfuse.rb', line 503

def debug=(value)
    value = value ? true : false
    if @debug && !value
        $stderr.puts "=== #{ self }.debug=false"
    elsif !@debug && value
        $stderr.puts "=== #{ self }.debug=true"
    end
    @debug = value
end

#debug?Boolean

Note:

this is independent of the Fuse kernel module debugging enabled with the "-d" mount option

RFuse Debugging status

Returns:

  • (Boolean)

    whether debugging information should be printed to $stderr around each fuse method. Defaults to $DEBUG

See Also:

Since:

  • 1.1.0



495
496
497
# File 'lib/rfuse.rb', line 495

def debug?
    @debug
end

#sigusr1void

This method returns an undefined value.

USR1 sig handler - toggle debugging of fuse methods



483
484
485
# File 'lib/rfuse.rb', line 483

def sigusr1()
    self.debug=!@debug
end