Class: FFI::Libfuse::FuseContext
- Inherits:
-
Struct
- Object
- Struct
- FFI::Libfuse::FuseContext
- Includes:
- Accessors
- Defined in:
- lib/ffi/libfuse/fuse_context.rb
Overview
Context for each callback operation
Constant Summary collapse
- DEFAULT_CONTEXT =
{ uid: Process.uid, gid: Process.gid, umask: File.umask }.freeze
Instance Attribute Summary collapse
-
#gid ⇒ Integer
readonly
Group id of the calling process.
-
#pid ⇒ Integer
readonly
Process id of the calling thread.
-
#private_data ⇒ Object
readonly
Private filesystem data.
-
#uid ⇒ Integer
readonly
User id of the calling process.
-
#umask ⇒ Integer
Writable only for Fuse version < 28.
Class Method Summary collapse
-
.fuse_get_context ⇒ FuseContext
(also: get)
The context for the current filesystem operation.
- .overrides(hash = nil) ⇒ Object
Instance Method Summary collapse
- #interrupted? ⇒ Boolean
-
#mask(perms) ⇒ Object
Perms adjusted by #umask.
- #raise_interrupt ⇒ void
Methods included from Accessors
#ffi_attr_fill, #ffi_attr_reader_member, #ffi_attr_writer_member, #fill, #inspect, #to_h
Methods included from Accessors::ClassMethods
#attr_accessor, #attr_reader, #attr_writer, #ffi_attr_accessor, #ffi_attr_reader, #ffi_attr_reader_method, #ffi_attr_readers, #ffi_attr_writer, #ffi_attr_writer_method, #ffi_attr_writers, #ffi_bitflag_accessor, #ffi_bitflag_reader, #ffi_bitflag_writer, #ffi_public_attr_readers, #ffi_public_attr_writers
Instance Attribute Details
#gid ⇒ Integer (readonly)
Returns group id of the calling process.
|
# File 'lib/ffi/libfuse/fuse_context.rb', line 37
|
#pid ⇒ Integer (readonly)
Returns process id of the calling thread.
|
# File 'lib/ffi/libfuse/fuse_context.rb', line 40
|
#private_data ⇒ Object (readonly)
Returns private filesystem data.
|
# File 'lib/ffi/libfuse/fuse_context.rb', line 43
|
#uid ⇒ Integer (readonly)
Returns user id of the calling process.
|
# File 'lib/ffi/libfuse/fuse_context.rb', line 34
|
#umask ⇒ Integer
Writable only for Fuse version < 28
47 48 49 |
# File 'lib/ffi/libfuse/fuse_context.rb', line 47 def umask @umask ||= File.umask end |
Class Method Details
.fuse_get_context ⇒ FuseContext Also known as: get
if called outside a fuse callback the native FFI::Libfuse::FuseContext will have invalid values. See overrides
Returns the context for the current filesystem operation.
96 97 98 |
# File 'lib/ffi/libfuse/fuse_context.rb', line 96 def fuse_get_context Libfuse.fuse_get_context end |
.overrides(hash) { ... } ⇒ Object .overrides ⇒ Hash
83 84 85 86 87 88 89 90 91 92 |
# File 'lib/ffi/libfuse/fuse_context.rb', line 83 def overrides(hash = nil) return Thread.current[:fuse_context_overrides] ||= {} unless block_given? begin Thread.current[:fuse_context_overrides] = hash || DEFAULT_CONTEXT yield ensure Thread.current[:fuse_context_overrides] = nil end end |
Instance Method Details
#interrupted? ⇒ Boolean
54 55 56 |
# File 'lib/ffi/libfuse/fuse_context.rb', line 54 def interrupted? Libfuse.fuse_interrupted? end |
#mask(perms) ⇒ Object
Returns perms adjusted by #umask.
67 68 69 |
# File 'lib/ffi/libfuse/fuse_context.rb', line 67 def mask(perms) perms & ~umask end |
#raise_interrupt ⇒ void
This method returns an undefined value.
61 62 63 |
# File 'lib/ffi/libfuse/fuse_context.rb', line 61 def raise_interrupt Libfuse.raise_interrupt end |