NAME

Fuse::Template::Sys - Moose role for system calls

DESCRIPTION

This role requires find_file() and log().

Documentation is mainly copy/paste from Fuse.

It should be possible to use this role in other projects as well. I might even seperate it out as a standalone distribution some day.

ATTRIBUTES

root

Holds a Fuse::Template::Root object.

METHODS

getattr

@stat = $self->getattr($virtual_path);

Return value is the same format as from stat($file).

$bool = $self->readlink($virtual_path); 

This is called when dereferencing symbolic links, to learn the target.

getdir

@files = $self->getdir($virtual_path);

Returns a list of filenames from the virtual dir.

This is used to obtain directory listings. Its opendir(), readdir(), filldir() and closedir() all in one call.

mknod

$errno = $self->mknod($virtual_path);

This method will always return -&POSIX::EROFS, since write support is not implemented.

This function is called for all non-directory, non-symlink nodes, not just devices.

mkdir

$errno = $self->mkdir($virtual_path, $mode);

This method will always return -&POSIX::EROFS, since write support is not implemented.

Called to create a directory.

$errno = $self->unlink($virtual_path);

This method will always return -&POSIX::EROFS, since write support is not implemented.

Called to remove a file, device, or symlink.

rmdir

$errno = $self->rmdir($virtual_path);

This method will always return -&POSIX::EROFS, since write support is not implemented.

Called to remove a directory.

$errno = $self->symlink($virtual_path, $symlink_name);

This method will always return -&POSIX::EROFS, since write support is not implemented.

Called to create a symbolic link.

rename

$errno = $self->rmdir($old_virtual_path, $new_virtual_path);

This method will always return -&POSIX::EROFS, since write support is not implemented.

Called to rename a file, and/or move a file from one directory to another.

$errno = $self->link($virtual_path, $hardlink_name);

This method will always return -&POSIX::EROFS, since write support is not implemented.

Called to create hard links.

chmod

$errno = $self->chmod($virtual_path, $mode);

This method will always return -&POSIX::EROFS, since write support is not implemented.

Called to change permissions on a file/directory/device/symlink.

chown

$errno = $self->chown($virtual_path, $uid, $gid);

This method will always return -&POSIX::EROFS, since write support is not implemented.

Called to change ownership of a file/directory/device/symlink.

truncate

$errno = $self->truncate($virtual_path, $offset);

This method will always return -&POSIX::EROFS, since write support is not implemented.

Called to truncate a file, at the given offset.

utime

$errno = $self->utime($virtual_path, $actime, $modtime);

This method will always return -&POSIX::EROFS, since write support is not implemented.

Called to change access/modification times for a file/directory/device/symlink.

open

$errno = $self->open($virtual_path, $mode);

Called to open a file.

read

$ret = $self->read($virtual_path, $buf_size, $offset);

$ret can be either $errno or data read.

Called in an attempt to fetch a portion of the file.

write

$ret = $self->write($virtual_path, $buf_size, $offset);

$ret can be either $errno or length of data read.

This method will always return -&POSIX::EROFS, since write support is not implemented.

Called in an attempt to write (or overwrite) a portion of the file.

statfs

@ret = $self->statfs;

@ret can be on of:

($namelen, $files, $files_free, $blocks, $blocks_avail, $blocksize)
-ENOANO()

flush

$errno = $self->flush($virtual_path);

Called to synchronise any cached data. This is called before the file is closed. It may be called multiple times before a file is closed.

release

$errno = $self->release($virtual_path, $flags);

Called to indicate that there are no more references to the file. Called once for every file with the same pathname and flags as were passed to open.

fsync

$int = $self->fsync($virtual_path, $flags);

Called to synchronise the file's contents. If flags is non-zero, only synchronise the user data. Otherwise synchronise the user and meta data.

setxattr

$errno = $self->setxattr(
             $virtual_path, $attr_name, $attr_value, $flags
         );

Called to set the value of the named extended attribute.

Will always return -EOPNOTSUPP() since write is not supported.

getxattr

$ret = $self->getxattr($virtual_path, $attr_name);

Called to get the value of the named extended attribute.

listxattr

@list = $self->listxattr;

Called to get the value of the named extended attribute.

removexattr

$errno = $self->removexattr($virtual_path, $attr_name);

This method will always return -&POSIX::EROFS, since write support is not implemented.

AUTHOR

See Fuse::Template