Module: FFI::Libfuse::Adapter::Fuse3Support::Prepend

Includes:
FFI::Libfuse::Adapter
Defined in:
lib/ffi/libfuse/adapter/fuse3_support.rb

Overview

The actual module methods that are prepended

Instance Method Summary collapse

Methods included from FFI::Libfuse::Adapter

#fuse_super_respond_to?

Instance Method Details

#chmod(*args) ⇒ Object



42
43
44
45
# File 'lib/ffi/libfuse/adapter/fuse3_support.rb', line 42

def chmod(*args)
  args.pop
  super
end

#chown(*args) ⇒ Object



37
38
39
40
# File 'lib/ffi/libfuse/adapter/fuse3_support.rb', line 37

def chown(*args)
  args.pop
  super
end

#fuse3_compat?Boolean

Inner adapters received Fuse2 compatible args

Returns:

  • (Boolean)


19
20
21
# File 'lib/ffi/libfuse/adapter/fuse3_support.rb', line 19

def fuse3_compat?
  false
end

#fuse_respond_to(fuse_callback) ⇒ Object



77
78
79
# File 'lib/ffi/libfuse/adapter/fuse3_support.rb', line 77

def fuse_respond_to(fuse_callback)
  super || (%i[truncate getattr].include?(fuse_callback) && fuse_super_respond_to?("f#{fuse_callback}"))
end

#getattr(*args) ⇒ Object



23
24
25
26
27
28
# File 'lib/ffi/libfuse/adapter/fuse3_support.rb', line 23

def getattr(*args)
  fi = args.pop
  return fgetattr(*args, fi) if fi && fuse_super_respond_to?(:fgetattr)

  super
end

#init(*args) ⇒ Object



56
57
58
59
60
61
# File 'lib/ffi/libfuse/adapter/fuse3_support.rb', line 56

def init(*args)
  args.pop

  # TODO: populate FuseConfig with output from fuse_flags/FuseConnInfo where appropriate
  super
end

#readdir(*args, &block) ⇒ Object



63
64
65
66
67
68
69
70
71
72
73
74
75
# File 'lib/ffi/libfuse/adapter/fuse3_support.rb', line 63

def readdir(*args, &block)
  # swallow the flag arg unknown to fuse 2
  args.pop

  args = args.map do |a|
    next a unless a.is_a?(FFI::Function)

    # wrap the filler proc for the extra flags argument
    proc { |buf, name, stat, off| a.call(buf, name, stat, off, 0) }
  end

  super
end

#truncate(*args) ⇒ Object



30
31
32
33
34
35
# File 'lib/ffi/libfuse/adapter/fuse3_support.rb', line 30

def truncate(*args)
  fi = args.pop
  return ftruncate(*args, fi) if fi && fuse_super_respond_to?(:ftruncate)

  super
end

#utimens(*args) ⇒ Object

TODO: Fuse3 deprecated flag utime_omit_ok - which meant that UTIME_OMIT and UTIME_NOW are passed through instead of ???? Strictly if the flag is not set this compat shim should convert utime now values to Time.now but there is no way to handle OMIT



51
52
53
54
# File 'lib/ffi/libfuse/adapter/fuse3_support.rb', line 51

def utimens(*args)
  args.pop
  super if defined?(super)
end