Class: FFI::Libfuse::FuseOperations

Inherits:
Struct
  • Object
show all
Includes:
FuseCallbacks
Defined in:
lib/ffi/libfuse/fuse_operations.rb

Overview

The file system operations as specified in libfuse.

All Callback methods are optional, but some are essential for a useful filesystem e.g. #getattr,#readdir

Almost all callback operations take a path which can be of any length and will return 0 for success or a negative Errno value on failure.

Constant Summary collapse

VOID_RETURN =

Callbacks that have no return value

%i[init destroy].freeze
MEANINGFUL_RETURN =

Callbacks that are expected to return meaningful positive integers

%i[read write write_buf lseek copy_file_range getxattr listxattr].freeze

FUSE Callbacks collapse

Class Method Summary collapse

Methods included from FuseCallbacks

#fuse_respond_to?, #fuse_wrappers

Methods included from Callbacks

#register

Constructor Details

#initialize(fuse_wrappers: [], fuse_flags: [], delegate: self) ⇒ FuseOperations

Returns a new instance of FuseOperations.

Build a FuseOperations struct and register callback methods

The methods to register are identified by delegate.FFI::Libfuse::FuseCallbacks#fuse_respond_to? if available otherwise delegate.respond_to? is used.

Parameters:

  • delegate (Object) (defaults to: self)

    delegate object that quacks like our abstract methods (after any wrappers)

    if not provided defaults to self, ie a subclass of FuseOperations that implements the otherwise abstract callback and configuration methods, or a naked FuseOperations that must be externally configured.

  • fuse_wrappers (Array) (defaults to: [])

    A list of fuse_wrappers (see Callbacks#register). Passed into delegate.FFI::Libfuse::FuseCallbacks#fuse_wrappers if available

  • fuse_flags (Array<Symbol>) (defaults to: [])

    list of configuration flags (Not used in Fuse3) concatenated #fuse_flags if available



938
939
940
941
942
943
944
945
946
947
948
# File 'lib/ffi/libfuse/fuse_operations.rb', line 938

def initialize(*args, fuse_wrappers: [], fuse_flags: [], delegate: self)
  super(*args) # FFI::Struct constructor
  return if args.any? # only configure if this is a new allocation

  initialize_callbacks(wrappers: fuse_wrappers, delegate: delegate)

  return unless FUSE_MAJOR_VERSION < 3

  fuse_flags.concat(delegate.fuse_flags) if delegate.respond_to?(:fuse_flags)
  send(:[]=, :flags, fuse_flags.uniq)
end

Class Method Details

.fuse_callbacksSet<Symbol>

Returns list of callback methods.

Returns:

  • (Set<Symbol>)

    list of callback methods



107
108
109
# File 'lib/ffi/libfuse/fuse_operations.rb', line 107

def fuse_callbacks
  @fuse_callbacks ||= Set.new(members - [:flags])
end

.meaningful_return?(fuse_callback) ⇒ Boolean

Returns true if fuse_callback expects a meaningful integer return.

Returns:

  • (Boolean)

    true if fuse_callback expects a meaningful integer return



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

def meaningful_return?(fuse_callback)
  MEANINGFUL_RETURN.include?(fuse_callback)
end

.path_arg_methods(fuse_callback) ⇒ Symbol

Helper to determine how to handle the path argument for a path callback

Examples:

def wrap_callback(fuse_method, *args)
    read, remove, add = FFI::Libfuse::FuseOperations.path_arg_methods(fuse_method)
    path = args.send(read)
    # ... do something with path

    path = args.send(remove)
    # ... do something to make an alternate path
    args.send(add, adjusted_path)
    delegate.send(fuse_methoed, *args)
end

Parameters:

  • fuse_callback (Symbol)

    callback method name (must be one of #path_callbacks)

Returns:

  • (Symbol, Symbol, Symbol)

    read, remove, add methods. [:last, :push, :pop] for :link, :symlink, :rename, [:first, :shift, :unshift] for everything else



102
103
104
# File 'lib/ffi/libfuse/fuse_operations.rb', line 102

def path_arg_methods(fuse_callback)
  CALLBACK_PATH_ARG_METHODS[fuse_callback]
end

.path_callbacksSet<Symbol>

Returns list of path callback methods.

Returns:

  • (Set<Symbol>)

    list of path callback methods



112
113
114
# File 'lib/ffi/libfuse/fuse_operations.rb', line 112

def path_callbacks
  @path_callbacks ||= fuse_callbacks - VOID_RETURN
end

.void_return?(fuse_callback) ⇒ Boolean

Returns true if fuse_callback expects a void return.

Returns:

  • (Boolean)

    true if fuse_callback expects a void return



82
83
84
# File 'lib/ffi/libfuse/fuse_operations.rb', line 82

def void_return?(fuse_callback)
  VOID_RETURN.include?(fuse_callback)
end

Instance Method Details

#access(path, mode) ⇒ Integer

This method is abstract.

Check file access permissions

This will be called for the access() system call. If the 'default_permissions' mount option is given, this method is not called.

This method is not called under Linux kernel versions 2.4.x

Parameters:

  • path (String)
  • mode (Integer)

Returns:

  • (Integer)

    0 for success or -ve errno

See Also:

  • access(2)


# File 'lib/ffi/libfuse/fuse_operations.rb', line 565

#bmap(path, blocksize, index) ⇒ Integer

This method is abstract.
Note:

This makes sense only for block device backed filesystem mounted with the 'blkdev' option

Map block index within file to block index within device

Parameters:

  • path (String)
  • blocksize (Integer)
  • index (FFI::Pointer)

    pointer to index result

Returns:

  • (Integer)

    0 success or -ve errno



# File 'lib/ffi/libfuse/fuse_operations.rb', line 683

#chmod(path, mode, fuse_file_info = nil) ⇒ Integer

This method is abstract.

Change the permission bits of a file

Parameters:

  • path (String)
  • mode (Integer)
  • fuse_file_info (FuseFileInfo) (defaults to: nil)

    (Fuse3 only)

Returns:

  • (Integer)

    0 for success or -ve errno



# File 'lib/ffi/libfuse/fuse_operations.rb', line 247

#chown(path, uid, gid, fuse_file_info = nil) ⇒ Integer

This method is abstract.

Change the owner and group of a file

Parameters:

  • path (String)
  • uid (Integer)
  • gid (Integer)
  • fuse_file_info (FuseFileInfo) (defaults to: nil)

    (Fuse3 only)

Returns:

  • (Integer)

    0 for success or -ve errno



# File 'lib/ffi/libfuse/fuse_operations.rb', line 260

#copy_file_range(path_in, fi_in, offset_in, path_out, fi_out, offset_out, size, flags) ⇒ Integer

This method is abstract.

Copy a range of data from one file to another

Performs an optimized copy between two file descriptors without the additional cost of transferring data through the FUSE kernel module to user space (glibc) and then back into the FUSE filesystem again.

In case this method is not implemented, glibc falls back to reading data from the source and writing to the destination. Effectively doing an inefficient copy of the data.

Parameters:

  • path_in (String)
  • fi_in (FuseFileInfo)
  • offset_in (Integer)
  • path_out (String)
  • fi_out (FuseFileInfo)
  • offset_out (Integer)
  • size (Integer)
  • flags (Array<Symbol>)

    (unused)

Returns:

  • (Integer)

    copied size or -ve errno



# File 'lib/ffi/libfuse/fuse_operations.rb', line 862

#create(path, mode, fuse_file_info) ⇒ Integer

This method is abstract.

Create and open a file

If the file does not exist, first create it with the specified mode, and then open it.

If this method is not implemented or under Linux kernel versions earlier than 2.6.15, the mknod() and open() methods will be called instead.

Parameters:

  • path (String)
  • mode (Integer)
  • fuse_file_info (FuseFileInfo)

Returns:

  • (Integer)

    0 for success or -ve errno



# File 'lib/ffi/libfuse/fuse_operations.rb', line 582

#destroy(obj) ⇒ Object

This method is abstract.

Clean up filesystem. Called on filesystem exit.

Parameters:

  • obj (Object)
    • the object passed from #init.


# File 'lib/ffi/libfuse/fuse_operations.rb', line 554

#fallocate(path, mode, offset, len, fuse_file_info) ⇒ Object

This method is abstract.

Allocates space for an open file

This function ensures that required space is allocated for specified file. If this function returns success then any subsequent write request to specified range is guaranteed not to fail because of lack of space on the file system media.

Parameters:

  • path (String)
  • mode (Array<Symbol>)

    allocation mode flags :keep_size :punch_hole :no_hide_stale :collapse_range :zero_range :insert_range :unshare_range see linux/falloc.h

  • offset (Integer)
  • len (Integer)

Returns:

  • 0 or -ve errno



# File 'lib/ffi/libfuse/fuse_operations.rb', line 835

#fgetattr(path, stat, fuse_file_info) ⇒ Integer

Deprecated.

in Fuse3 implement #getattr instead

Get attributes from an open file

This method is called instead of the getattr() method if the file information is available.

Currently this is only called after the create() method if that is implemented (see above). Later it may be called for invocations of fstat() too.

Parameters:

Returns:

  • (Integer)

    0 for success or -ve errno



# File 'lib/ffi/libfuse/fuse_operations.rb', line 618

#flock(path, fuse_file_info, op) ⇒ Object

This method is abstract.

Perform BSD file locking operation

@note: if this method is not implemented, the kernel will still allow file locking to work locally. Hence it is only interesting for network filesystem and similar.

Parameters:

  • path (String)
  • fuse_file_info (FuseFileInfo)

    Additionally fi->owner will be set to a value unique to this open file. This same value will be supplied to #release when the file is released.

  • op (Array<Symbol>)

    the lock operation The op argument will contain one of :lock_sh, :lock_ex, or :lock_un Nonblocking requests also include :lock_nb

Returns:

  • 0 or -ve errno

See Also:

  • flock(2)


# File 'lib/ffi/libfuse/fuse_operations.rb', line 815

#flush(path, fuse_file_info) ⇒ Integer

Possibly flush cached data

BIG NOTE: This is not equivalent to fsync(). It's not a request to sync dirty data.

Flush is called on each close() of a file descriptor. So if a filesystem wants to return write errors in close() and the file has cached dirty data, this is a good place to write back data and return any errors. Since many applications ignore close() errors this is not always useful.

NOTE: The flush() method may be called more than once for each open(). This happens if more than one file descriptor refers to an opened file due to dup(), dup2() or fork() calls. It is not possible to determine if a flush is final, so each flush should be treated equally. Multiple write-flush sequences are relatively rare, so this shouldn't be a problem.

Filesystems shouldn't assume that flush will always be called after some writes, or that if will be called at all.

Parameters:

Returns:

  • (Integer)

    0 for success or -ve errno



# File 'lib/ffi/libfuse/fuse_operations.rb', line 361

#fsync(path, datasync, fuse_file_info) ⇒ Integer

Synchronize file contents

Parameters:

  • path (String)
  • datasync (Integer)

    If non-zero, then only the user data should be flushed, not the meta data.

  • fuse_file_info (FuseFileInfo)

Returns:

  • (Integer)

    0 for success or -ve errno



# File 'lib/ffi/libfuse/fuse_operations.rb', line 404

#fsyncdir(path, datasync, fuse_file_info) ⇒ Integer

Synchronize directory contents

Parameters:

  • path (String)
  • datasync (Integer)

    If non-zero, then only the user data should be flushed, not the meta data

  • fuse_file_info (FuseFileInfo)

Returns:

  • (Integer)

    0 for success or -ve errno



# File 'lib/ffi/libfuse/fuse_operations.rb', line 522

#ftruncate(path, offset, fuse_file_info) ⇒ Integer

Deprecated.

in Fuse3 implement #truncate instead

This method is abstract.

Change the size of an open file

This method is called instead of the truncate() method if the truncation was invoked from an ftruncate() system call.

If this method is not implemented or under Linux kernel versions earlier than 2.6.15, the truncate() method will be called instead.

Parameters:

  • path (String)
  • offset (Integer)
  • fuse_file_info (FuseFileInfo)

Returns:

  • (Integer)

    0 for success or -ve errno



# File 'lib/ffi/libfuse/fuse_operations.rb', line 599

#fuse_flagsArray<Symbol>

Deprecated.

in Fuse3 use fuse_config object in #init

This method is abstract.
Note:

Not available in Fuse3

Configuration method to set fuse flags

  • :nullpath_ok

Flag indicating that the filesystem can accept a NULL path as the first argument for the following operations: read, write, flush, release, fsync, readdir, releasedir, fsyncdir, ftruncate, fgetattr, lock, ioctl and poll

If this flag is set these operations continue to work on unlinked files even if "-ohard_remove" option was specified.

  • :nopath

Flag indicating that the path need not be calculated for the following operations: read, write, flush, release, fsync, readdir, releasedir, fsyncdir, ftruncate, fgetattr, lock, ioctl and poll

Closely related to flag_nullpath_ok, but if this flag is set then the path will not be calculaged even if the file wasn't unlinked. However the path can still be non-NULL if it needs to be calculated for some other reason.

  • :utime_omit_ok

Flag indicating that the filesystem accepts special UTIME_NOW and UTIME_OMIT values in its utimens operation.

Returns:

  • (Array<Symbol>)

    a list of flags to set capabilities



# File 'lib/ffi/libfuse/fuse_operations.rb', line 698

#getattr(path, stat, fuse_file_info = nil) ⇒ Integer

This method is abstract.

Get file attributes.

Similar to stat(). The 'st_dev' and 'st_blksize' fields are ignored. The 'st_ino' field is ignored except if the 'use_ino' mount option is given.

Parameters:

  • path (String)
  • stat (Stat)

    to be filled with result information

  • fuse_file_info (FuseFileInfo) (defaults to: nil)

    will always be nil if the file is not currently open, but may also be nil if the file is open.

Returns:

  • (Integer)

    0 for success or -ve Errno value



# File 'lib/ffi/libfuse/fuse_operations.rb', line 127

#getdirObject

Deprecated.

use #readdir instead



# File 'lib/ffi/libfuse/fuse_operations.rb', line 161

#getxattr(path, name, buf, size) ⇒ Integer

This method is abstract.

Get extended attributes

Parameters:

  • path (String)
  • name (String)
  • buf (FFI::Pointer)
  • size (Integer)

Returns:

  • (Integer)

See Also:

  • getxattr(2)


# File 'lib/ffi/libfuse/fuse_operations.rb', line 430

#init(fuse_conn_info, fuse_config = nil) ⇒ Object

This method is abstract.

Initialize filesystem

Parameters:

  • fuse_conn_info (FuseConnInfo)
  • fuse_config (FuseConfig|nil) (defaults to: nil)

    only provided for fuse3 and later

Returns:

  • (Object)

    The return value will passed in the private_data field of fuse_context to all file operations and as a parameter to the destroy() method.



# File 'lib/ffi/libfuse/fuse_operations.rb', line 533

#ioctl(path, cmd, arg, fuse_file_info, flags, data) ⇒ Object

This method is abstract.

Ioctl The size and direction of data is determined by IOC*() decoding of cmd. For _IOC_NONE, data will be NULL, for _IOC_WRITE data is out area, for _IOC_READ in area and if both are set in/out area. In all non-NULL cases, the area is of _IOC_SIZE(cmd) bytes.

Parameters:

  • path (String)
  • cmd (Integer)
  • arg (FFI::Pointer)
  • fuse_file_info (FuseFileInfo)
  • flags (Array<Symbol>)
    • :compat 32bit compat ioctl on 64bit machine
    • :unrestricted not restricted to well-formed ioctls, retry allowed (lowlevel fuse)
    • :retry retry with new iovecs (lowlevel fuse)
    • :dir is a directory file handle
  • data (FFI::Pointer)


# File 'lib/ffi/libfuse/fuse_operations.rb', line 734

This method is abstract.

Create a hard link to a file

Parameters:

  • target (String)
  • path (String)

Returns:

  • (Integer)

    0 for success or -ve errno

See Also:

  • rename(2)


# File 'lib/ffi/libfuse/fuse_operations.rb', line 236

#listxattr(path, buf, size) ⇒ Integer

This method is abstract.

List extended attributes

Parameters:

  • path (String)
  • buf (FFI::Pointer)
  • size (Integer)

Returns:

  • (Integer)

See Also:

  • listxattr(2)


# File 'lib/ffi/libfuse/fuse_operations.rb', line 443

#lock(path, fuse_file_info, cmd, flock) ⇒ Integer

This method is abstract.
Note:

if this method is not implemented, the kernel will still allow file locking to work locally. Hence it

Perform POSIX file locking operation For :f_getlk operation, the library will first check currently held locks, and if a conflicting lock is found it will return information without calling this method. This ensures, that for local locks the pid field is correctly filled in. The results may not be accurate in case of race conditions and in the presence of hard links, but its unlikely that an application would rely on accurate GETLK results in these cases. If a conflicting lock is not found, this method will be called, and the filesystem may fill out l_pid by a meaningful value, or it may leave this field zero.

For :f_setlk and :f_setlkw the pid field will be set to the pid of the process performing the locking operation.

is only interesting for network filesystem and similar.

Parameters:

  • path (String)
  • fuse_file_info (FuseFileInfo)

    For checking lock ownership, the 'fuse_file_info->owner' argument must be used.

  • cmd (Symbol)

    either :getlck, :setlck or :setlkw.

  • flock (Flock)

    For the meaning of fields in 'struct flock' see the man page for fcntl(2). The whence field will always be set to :seek_set.

Returns:

  • (Integer)

    0 for success or -ve errno



# File 'lib/ffi/libfuse/fuse_operations.rb', line 635

#lseek(path, offset, whence, fuse_file_info) ⇒ Integer

This method is abstract.

Find next data or hole after the specified offset

Parameters:

  • path (String)
  • offset (Integer)
  • whence (Symbol)

    either :seek_set ,:seek_cur, :seek_end, :seek_data, :seek_hole

Returns:

  • (Integer)

    the found offset in bytes from the beginning of the file or -ve errno

See Also:

  • lseek(2)


# File 'lib/ffi/libfuse/fuse_operations.rb', line 893

#mkdir(path, mode) ⇒ Integer

This method is abstract.

Create a directory

Note that the mode argument may not have the type specification bits set, i.e. S_ISDIR(mode) can be false. To obtain the correct directory type bits use mode | Stat::S_IFDIR

Parameters:

  • path (String)
  • mode (Integer)

Returns:

  • (Integer)

    0 for success or -ve errno



# File 'lib/ffi/libfuse/fuse_operations.rb', line 181

#mknod(path, mode, dev) ⇒ Integer

Create a file node

This is called for creation of all non-directory, non-symlink nodes. If the filesystem defines a create() method, then for regular files that will be called instead.

Parameters:

  • path (String)
  • mode (Integer)
  • dev (Integer)

Returns:

  • (Integer)

    0 for success or -ve errno



# File 'lib/ffi/libfuse/fuse_operations.rb', line 167

#open(path, fuse_file_info) ⇒ Integer

This method is abstract.

File open operation

No creation (O_CREAT, O_EXCL) and by default also no truncation (O_TRUNC) flags will be passed to open(). If an application specifies O_TRUNC, fuse first calls truncate() and then open(). Only if 'atomic_o_trunc' has been specified and kernel version is 2.6.24 or later, O_TRUNC is passed on to open.

Unless the 'default_permissions' mount option is given, open should check if the operation is permitted for the given flags.

Optionally open may also return an arbitrary filehandle in the fuse_file_info structure, which will be passed to all file operations.

Parameters:

Returns:

  • (Integer)

    0 for success or -ve errno



# File 'lib/ffi/libfuse/fuse_operations.rb', line 291

#opendir(path, fuse_file_info) ⇒ Object

This method is abstract.

Open directory

Unless the 'default_permissions' mount option is given, this method should check if opendir is permitted for this directory. Optionally opendir may also return an arbitrary filehandle in the fuse_file_info structure, which will be passed to readdir, releasedir and fsyncdir.



# File 'lib/ffi/libfuse/fuse_operations.rb', line 468

#poll(path, fuse_file_info, ph, reventsp) ⇒ Integer

This method is abstract.

Poll for IO readiness events

Parameters:

  • path (String)
  • fuse_file_info (FuseFileInfo)
  • ph (FusePollHandle|nil)

    If ph is set, the client should notify when IO readiness events occur by calling FFI::Libfuse::FusePollHandle#notify_poll (possibly asynchronously)

    Regardless of the number of times poll is received, single notification is enough to clear all. Notifying more times incurs overhead but doesnt harm correctness.

  • reventsp (FFI::Pointer)

    return events

Returns:

  • (Integer)

    0 for success, -ve for error

See Also:

  • poll(2)


# File 'lib/ffi/libfuse/fuse_operations.rb', line 757

#read(path, buf, size, offset, fuse_file_info) ⇒ Integer

This method is abstract.

Read data from an open file

Parameters:

  • path (String)
  • buf (FFI::Pointer)
  • size (Integer)
  • offset (Integer)
  • fuse_file_info (FuseFileInfo)

Returns:

  • (Integer)

    Read should return exactly the number of bytes requested except on EOF or error, otherwise the rest of the data will be substituted with zeroes. An exception to this is when the 'direct_io' mount option is specified, in which case the return value of the read system call will reflect the return value of this operation.



# File 'lib/ffi/libfuse/fuse_operations.rb', line 313

#read_buf(path, bufp, size, offset, fuse_file_info) ⇒ Object

This method is abstract.

Similar to the #read method, but data is stored and returned in a generic buffer.

No actual copying of data has to take place, the source file descriptor may simply be stored in the buffer for later data transfer.

Parameters:

Returns:

  • 0 success or -ve errno



# File 'lib/ffi/libfuse/fuse_operations.rb', line 795

#readdir(path, buffer, filler, offset, fuse_file_info, fuse_readdir_flag = 0) ⇒ Integer

This method is abstract.

Read directory

The filesystem may choose between two modes of operation:

1) The readdir implementation ignores the offset parameter, and passes zero to the filler function's offset. The filler function will not return '1' (unless an error happens), so the whole directory is read in a single readdir operation.

2) The readdir implementation keeps track of the offsets of the directory entries. It uses the offset parameter and always passes non-zero offset to the filler function. When the buffer is full (or an error happens) the filler function will return '1'.

Parameters:

  • path (String)
  • buffer (FFI::Pointer)
  • filler (Proc<FFI::Pointer,String,Stat,Integer,Integer=0>)

    the filler function to be called for each directory entry, ie filler.call(buffer,next_name,next_stat,next_offset, fuse_fill_dir_flag)

  • offset (Integer)

    the starting offset

  • fuse_file_info (FuseFileInfo)
  • fuse_readdir_flag (Symbol) (defaults to: 0)

    (Fuse3 only)

Returns:

  • (Integer)

    0 on success or -ve errno



# File 'lib/ffi/libfuse/fuse_operations.rb', line 483

This method is abstract.

Resolve the target of a symbolic link

Parameters:

  • path (String)
  • target_buffer (FFI::Pointer)

    The buffer should be filled with a null terminated string. The buffer size argument includes the space for the terminating null character. If the linkname is too long to fit in the buffer, it should be truncated.

  • buffer_size (Integer)

Returns:

  • (Integer)

    0 for success.



# File 'lib/ffi/libfuse/fuse_operations.rb', line 144

#release(path, fuse_file_info) ⇒ Integer

Release an open file

Release is called when there are no more references to an open file: all file descriptors are closed and all memory mappings are unmapped.

For every open() call there will be exactly one release() call with the same flags and file descriptor. It is possible to have a file opened more than once, in which case only the last release will mean, that no more reads \/ writes will happen on the file.

Parameters:

Returns:

  • (Integer)

    The return value of release is ignored.



# File 'lib/ffi/libfuse/fuse_operations.rb', line 386

#releasedir(path, fuse_file_info) ⇒ Integer

Release directory

Parameters:

Returns:

  • (Integer)

    0 for success or -ve errno



# File 'lib/ffi/libfuse/fuse_operations.rb', line 513

#removexattr(path, name) ⇒ Integer

This method is abstract.

Remove extended attributes

Parameters:

  • path (String)
  • name (String)

Returns:

  • (Integer)

    0 on success or -ve errno

See Also:

  • removexattr(2)


# File 'lib/ffi/libfuse/fuse_operations.rb', line 455

#rename(from_path, to_path) ⇒ Integer

This method is abstract.

Rename a file

Parameters:

  • from_path (String)
  • to_path (String)

Returns:

  • (Integer)

    0 for success or -ve errno



# File 'lib/ffi/libfuse/fuse_operations.rb', line 225

#rmdir(path) ⇒ Integer

This method is abstract.

Remove a directory

Parameters:

  • path (String)

Returns:

  • (Integer)

    0 for success or -ve errno



# File 'lib/ffi/libfuse/fuse_operations.rb', line 205

#setxattr(path, name, data, size, flags) ⇒ Integer

This method is abstract.

Set extended attributes

Parameters:

  • path (String)
  • name (String)
  • data (String)
  • size (Integer)
  • flags (Symbol|Integer)

    (:xattr_create or :xattr_replace)

Returns:

  • (Integer)

    0 for success or -ve errno

See Also:

  • setxattr(2)


# File 'lib/ffi/libfuse/fuse_operations.rb', line 416

#statfs(path, statvfs) ⇒ Integer

This method is abstract.

Get file system statistics

Parameters:

  • path (String)
  • statvfs (StatVfs)

    result struct Note 'frsize', 'favail', 'fsid' and 'flag' fields are ignored

Returns:

  • (Integer)

    0 for success or -ve errno



# File 'lib/ffi/libfuse/fuse_operations.rb', line 348

This method is abstract.

Create a symbolic link

Parameters:

  • target (String)
  • path (String)

Returns:

  • (Integer)

    0 for success or -ve errno



# File 'lib/ffi/libfuse/fuse_operations.rb', line 215

#truncate(path, offset, fuse_file_info = nil) ⇒ Integer

This method is abstract.

Change the size of a file

Parameters:

  • path (String)
  • offset (Integer)
  • fuse_file_info (FuseFileInfo) (defaults to: nil)

    (Fuse3 only)

Returns:

  • (Integer)

    0 for success or -ve errno



# File 'lib/ffi/libfuse/fuse_operations.rb', line 274

This method is abstract.

Remove a file

Parameters:

  • path (String)

Returns:

  • (Integer)

    0 for success or -ve errno



# File 'lib/ffi/libfuse/fuse_operations.rb', line 195

#utimens(path, time_specs, fuse_file_info = nil) ⇒ Integer

This method is abstract.

Change the access and modification times of a file with nanosecond resolution

This supersedes the old utime() interface. New applications should use this.

Parameters:

  • path (String)
  • time_specs (Array<Stat::TimeSpec>)

    atime,mtime

  • fuse_file_info (FuseFileInfo) (defaults to: nil)

    (only since Fuse3)

Returns:

  • (Integer)

    0 for success or -ve errno

See Also:

  • utimensat(2)


# File 'lib/ffi/libfuse/fuse_operations.rb', line 665

#write(path, data, size, offset, fuse_file_info) ⇒ Integer

This method is abstract.

Write data to an open file

Parameters:

  • path (String)
  • data (FFI::Pointer)
  • size (Integer)
  • offset (Integer)
  • fuse_file_info (FuseFileInfo)

Returns:

  • (Integer)

    Write should return exactly the number of bytes requested except on error. An exception to this is when the 'direct_io' mount option is specified (see read operation).



# File 'lib/ffi/libfuse/fuse_operations.rb', line 331

#write_buf(path, buf, offset, fuse_file_info) ⇒ Integer

This method is abstract.

Write contents of buffer to an open file

Similar to the #write method, but data is supplied in a generic buffer. Use FFI::Libfuse::FuseBufVec#copy_to_fd to copy data to an open file descriptor, or FFI::Libfuse::FuseBufVec#copy_to_str to extract string data from the buffer

Parameters:

Returns:

  • (Integer)

    the number of bytes written or -ve errno



# File 'lib/ffi/libfuse/fuse_operations.rb', line 777