Class: RFuse::Fuse
- Inherits:
-
Object
- Object
- RFuse::Fuse
- Defined in:
- ext/rfuse/rfuse.c,
lib/rfuse.rb,
ext/rfuse/rfuse.c
Overview
A FUSE filesystem - extend this class implementing the various abstract methods to provide your filesystem.
All file operations take a Context and a path as well as any other necessary parameters
Mount your filesystem by creating an instance of your subclass and call #loop to begin processing
Direct Known Subclasses
Instance Method Summary collapse
-
#access(context, path, mode) ⇒ void
abstract
Check access permissions.
-
#bmap(context, path, blocksize, index) ⇒ Integer
abstract
Map block index within file to block index within device.
-
#chmod(context, path, mode) ⇒ void
abstract
Change file permissions.
-
#chown(context, path, uid, gid) ⇒ void
abstract
Change file ownership.
-
#create(context, path, mode, ffi) ⇒ void
abstract
Create and open a file.
- #destroy ⇒ Object
-
#exit ⇒ Object
Stop processing #loop eg called from Signal handlers, or some other monitoring thread.
-
#fd ⇒ Integer
/dev/fuse file descriptor for use with IO.select and #process.
-
#fgetattr(context, path, ffi) ⇒ Stat
abstract
Get attributes of an open file.
-
#flush(context, path, ffi) ⇒ void
abstract
Possibly flush cached data.
-
#fsync(context, path, datasync, ffi) ⇒ void
abstract
Synchronize file contents.
-
#fsyncdir(context, path, datasync, ffi) ⇒ void
abstract
Sync directory.
-
#ftruncate(context, path, size, ffi) ⇒ void
abstract
Change the size of an open file.
-
#getattr(context, path) ⇒ Stat
abstract
Get file attributes.
-
#getdir ⇒ Object
abstract
deprecated
Deprecated.
see #readdir
-
#getxattr(context, path, name) ⇒ String
abstract
Get extended attribute.
-
#init(info) ⇒ void
abstract
Called when filesystem is initialised.
-
#initialize(mountpoint, *options) ⇒ Object
constructor
initialize and mount the filesystem.
-
#invalidate(path) ⇒ Object
deprecated
Deprecated.
obsolete in FUSE itself
-
#link(context, from, to) ⇒ void
abstract
Create a hard link to file.
-
#listxattr(context, path) ⇒ Array<String>
abstract
List extended attributes.
-
#lock(context, path, ffi, cmd, flock) ⇒ void
abstract
Perform POSIX file locking operation.
-
#loop ⇒ void
Main processing loop.
-
#mkdir(context, path, mode) ⇒ void
abstract
Create a directory.
-
#mknod(context, path, mode, major, minor) ⇒ Object
abstract
Create a file node @return.
-
#mounted? ⇒ Boolean
Is the filesystem successfully mounted.
-
#mountname ⇒ String
(also: #mountpoint)
Directory where this filesystem is mounted.
-
#open(context, path, ffi) ⇒ void
abstract
File open operation.
-
#opendir(context, path, name) ⇒ void
abstract
Open directory.
-
#process ⇒ Integer
Process one fuse command from the kernel.
-
#read(context, path, size, offset, ffi) ⇒ String
abstract
Read data from an open file.
-
#readdir(context, path, filler, offset, ffi) ⇒ void
abstract
List contents of a directory.
-
#readlink(context, path, size) ⇒ String
abstract
Resolve target of symbolic link.
-
#release(context, path, ffi) ⇒ void
abstract
Release an open file.
-
#releasedir(context, path, ffi) ⇒ void
abstract
Release directory.
-
#removexattr(context, path, name) ⇒ void
abstract
Remove extended attribute.
-
#rename(context, from, to) ⇒ void
abstract
Rename the file, directory, or other object “from” to the target “to”.
-
#setxattr(context, path, name, data, flags) ⇒ void
abstract
Set extended attributes.
-
#statfs(context, path) ⇒ StatVfs
abstract
Get file system statistics.
-
#symlink(context, to, from) ⇒ void
abstract
Create a symbolic link.
-
#truncate(context, path, offset) ⇒ void
abstract
Change the size of a file.
-
#unlink(context, path) ⇒ void
abstract
Remove a file.
-
#unmount ⇒ Object
Unmount filesystem.
-
#utime(context, path, actime, modtime) ⇒ void
abstract
deprecated
Deprecated.
See #utimens
-
#utimens(context, path, actime, modtime) ⇒ void
abstract
Change access/modification times of a file.
-
#write(context, path, data, offset, ffi) ⇒ Integer
abstract
Write data to an open file.
Constructor Details
#initialize(mountpoint, *options) ⇒ Object
initialize and mount the filesystem
1780 1781 1782 1783 1784 1785 1786 1787 1788 1789 1790 1791 1792 1793 1794 1795 1796 1797 1798 1799 1800 1801 1802 1803 1804 1805 1806 1807 1808 1809 1810 1811 1812 1813 1814 1815 1816 1817 1818 1819 1820 1821 1822 1823 1824 1825 1826 1827 1828 1829 1830 1831 1832 1833 1834 1835 1836 1837 1838 1839 1840 1841 1842 1843 1844 1845 1846 1847 1848 1849 1850 1851 1852 1853 1854 1855 1856 1857 1858 1859 1860 1861 1862 1863 1864 1865 1866 1867 1868 1869 1870 1871 1872 1873 1874 1875 1876 1877 1878 1879 1880 1881 1882 1883 1884 1885 1886 1887 1888 1889 1890 1891 1892 1893 1894 1895 1896 1897 1898 1899 1900 1901 1902 1903 |
# File 'ext/rfuse/rfuse.c', line 1780
static VALUE rf_initialize(
VALUE self,
VALUE mountpoint_obj,
VALUE opts)
{
VALUE mountpoint;
struct intern_fuse *inf;
int init_result;
struct fuse_args *args;
//Allow things like Pathname to be sent as a mountpoint
mountpoint = rb_obj_as_string(mountpoint_obj);
Check_Type(opts, T_ARRAY);
Data_Get_Struct(self,struct intern_fuse,inf);
inf->mountpoint = strdup(StringValueCStr(mountpoint));
args = rarray2fuseargs(opts);
if (RESPOND_TO(self,"getattr"))
inf->fuse_op.getattr = rf_getattr;
if (RESPOND_TO(self,"readlink"))
inf->fuse_op.readlink = rf_readlink;
if (RESPOND_TO(self,"getdir"))
inf->fuse_op.getdir = rf_getdir; // Deprecated
if (RESPOND_TO(self,"mknod"))
inf->fuse_op.mknod = rf_mknod;
if (RESPOND_TO(self,"mkdir"))
inf->fuse_op.mkdir = rf_mkdir;
if (RESPOND_TO(self,"unlink"))
inf->fuse_op.unlink = rf_unlink;
if (RESPOND_TO(self,"rmdir"))
inf->fuse_op.rmdir = rf_rmdir;
if (RESPOND_TO(self,"symlink"))
inf->fuse_op.symlink = rf_symlink;
if (RESPOND_TO(self,"rename"))
inf->fuse_op.rename = rf_rename;
if (RESPOND_TO(self,"link"))
inf->fuse_op.link = rf_link;
if (RESPOND_TO(self,"chmod"))
inf->fuse_op.chmod = rf_chmod;
if (RESPOND_TO(self,"chown"))
inf->fuse_op.chown = rf_chown;
if (RESPOND_TO(self,"truncate"))
inf->fuse_op.truncate = rf_truncate;
if (RESPOND_TO(self,"utime"))
inf->fuse_op.utime = rf_utime; // Deprecated
if (RESPOND_TO(self,"open")) {
inf->fuse_op.open = rf_open;
inf->fuse_op.release = rf_release_ffi; // remove open file reference
}
if (RESPOND_TO(self,"create")) {
inf->fuse_op.create = rf_create;
inf->fuse_op.release = rf_release_ffi; // remove open file reference
}
if (RESPOND_TO(self,"read"))
inf->fuse_op.read = rf_read;
if (RESPOND_TO(self,"write"))
inf->fuse_op.write = rf_write;
if (RESPOND_TO(self,"statfs"))
inf->fuse_op.statfs = rf_statfs;
if (RESPOND_TO(self,"flush"))
inf->fuse_op.flush = rf_flush;
if (RESPOND_TO(self,"release"))
inf->fuse_op.release = rf_release;
if (RESPOND_TO(self,"fsync"))
inf->fuse_op.fsync = rf_fsync;
if (RESPOND_TO(self,"setxattr"))
inf->fuse_op.setxattr = rf_setxattr;
if (RESPOND_TO(self,"getxattr"))
inf->fuse_op.getxattr = rf_getxattr;
if (RESPOND_TO(self,"listxattr"))
inf->fuse_op.listxattr = rf_listxattr;
if (RESPOND_TO(self,"removexattr"))
inf->fuse_op.removexattr = rf_removexattr;
if (RESPOND_TO(self,"opendir")) {
inf->fuse_op.opendir = rf_opendir;
inf->fuse_op.release = rf_release_ffi; // remove open file reference
}
if (RESPOND_TO(self,"readdir"))
inf->fuse_op.readdir = rf_readdir;
if (RESPOND_TO(self,"releasedir"))
inf->fuse_op.releasedir = rf_releasedir;
if (RESPOND_TO(self,"fsyncdir"))
inf->fuse_op.fsyncdir = rf_fsyncdir;
if (RESPOND_TO(self,"init"))
inf->fuse_op.init = rf_init;
if (RESPOND_TO(self,"access"))
inf->fuse_op.access = rf_access;
if (RESPOND_TO(self,"ftruncate"))
inf->fuse_op.ftruncate = rf_ftruncate;
if (RESPOND_TO(self,"fgetattr"))
inf->fuse_op.fgetattr = rf_fgetattr;
if (RESPOND_TO(self,"lock"))
inf->fuse_op.lock = rf_lock;
if (RESPOND_TO(self,"utimens"))
inf->fuse_op.utimens = rf_utimens;
if (RESPOND_TO(self,"bmap"))
inf->fuse_op.bmap = rf_bmap;
#ifdef RFUSE_BROKEN
if (RESPOND_TO(self,"ioctl"))
inf->fuse_op.ioctl = rf_ioctl;
if (RESPOND_TO(self,"poll"))
inf->fuse_op.poll = rf_poll;
#endif
// init_result indicates not mounted, but so does inf->fuse == NULL
// raise exceptions only if we try to use the mount
// can test with mounted?
// Note we are storing this Ruby object as the FUSE user_data
init_result = intern_fuse_init(inf, args, (void *) self);
//Create the open files hash where we cache FileInfo objects
if (init_result == 0) {
VALUE open_files_hash;
open_files_hash=rb_hash_new();
rb_iv_set(self,"@open_files",open_files_hash);
rb_funcall(self,rb_intern("ruby_initialize"),0);
}
return self;
}
|
Instance Method Details
#access(context, path, mode) ⇒ void
Fuse operation access
This method returns an undefined value.
Check access permissions
1288 1289 1290 1291 |
# File 'ext/rfuse/rfuse.c', line 1288
static VALUE unsafe_access(VALUE* args)
{
return rb_funcall3(args[0],rb_intern("access"),3,&args[1]);
}
|
#bmap(context, path, blocksize, index) ⇒ Integer
Fuse operation bmap
Map block index within file to block index within device
Note: This makes sense only for block device backed filesystems mounted with the ‘blkdev’ option
1558 1559 1560 1561 |
# File 'ext/rfuse/rfuse.c', line 1558
static VALUE unsafe_bmap(VALUE *args)
{
return rb_funcall3(args[0],rb_intern("bmap"),4,&args[1]);
}
|
#chmod(context, path, mode) ⇒ void
Fuse operation chmod
This method returns an undefined value.
Change file permissions
601 602 603 604 |
# File 'ext/rfuse/rfuse.c', line 601
static VALUE unsafe_chmod(VALUE *args)
{
return rb_funcall3(args[0],rb_intern("chmod"),3,&args[1]);
}
|
#chown(context, path, uid, gid) ⇒ void
Fuse operation chown
This method returns an undefined value.
Change file ownership
569 570 571 572 |
# File 'ext/rfuse/rfuse.c', line 569
static VALUE unsafe_chown(VALUE *args)
{
return rb_funcall3(args[0],rb_intern("chown"),4,&args[1]);
}
|
#create(context, path, mode, ffi) ⇒ void
Fuse operation create
This method returns an undefined value.
Create and open a file
If the file does not exist, first create it with the specified mode, and then open it.
1322 1323 1324 1325 |
# File 'ext/rfuse/rfuse.c', line 1322
static VALUE unsafe_create(VALUE* args)
{
return rb_funcall3(args[0],rb_intern("create"),4,&args[1]);
}
|
#destroy ⇒ Object
#exit ⇒ Object
Stop processing #loop eg called from Signal handlers, or some other monitoring thread
170 171 172 |
# File 'lib/rfuse.rb', line 170 def exit @pw.putc(0) end |
#fd ⇒ Integer
Returns /dev/fuse file descriptor for use with IO.select and #process.
1738 1739 1740 1741 1742 1743 1744 1745 1746 1747 1748 |
# File 'ext/rfuse/rfuse.c', line 1738
VALUE rf_fd(VALUE self)
{
struct intern_fuse *inf;
Data_Get_Struct(self,struct intern_fuse,inf);
if (inf->fuse == NULL) {
rb_raise(eRFuse_Error,"FUSE not mounted");
return Qnil;
} else {
return INT2NUM(intern_fuse_fd(inf));
}
}
|
#fgetattr(context, path, ffi) ⇒ Stat
Fuse operation fgetattr
Get attributes of an open file
1393 1394 1395 1396 |
# File 'ext/rfuse/rfuse.c', line 1393
static VALUE unsafe_fgetattr(VALUE *args)
{
return rb_funcall3(args[0],rb_intern("fgetattr"),3,&args[1]);
}
|
#flush(context, path, ffi) ⇒ void
Fuse operation flush
This method returns an undefined value.
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.
471 472 473 474 |
# File 'ext/rfuse/rfuse.c', line 471
static VALUE unsafe_flush(VALUE *args)
{
return rb_funcall3(args[0],rb_intern("flush"),3,&args[1]);
}
|
#fsync(context, path, datasync, ffi) ⇒ void
Fuse operation fsync
This method returns an undefined value.
Synchronize file contents
428 429 430 |
# File 'ext/rfuse/rfuse.c', line 428 static VALUE unsafe_fsync(VALUE *args) { return rb_funcall3(args[0],rb_intern("fsync"),4,&args[1]); } |
#fsyncdir(context, path, datasync, ffi) ⇒ void
Fuse operation fsyncdir
This method returns an undefined value.
Sync directory
1192 1193 1194 1195 |
# File 'ext/rfuse/rfuse.c', line 1192
static VALUE unsafe_fsyncdir(VALUE *args)
{
return rb_funcall(args[0],rb_intern("fsyncdir"),4,&args[1]);
}
|
#ftruncate(context, path, size, ffi) ⇒ void
Fuse operation ftruncate
This method returns an undefined value.
Change the size of an open file
1358 1359 1360 1361 |
# File 'ext/rfuse/rfuse.c', line 1358
static VALUE unsafe_ftruncate(VALUE* args)
{
return rb_funcall3(args[0],rb_intern("ftruncate"),4,&args[1]);
}
|
#getattr(context, path) ⇒ Stat
Fuse operation getattr
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.
267 268 269 270 |
# File 'ext/rfuse/rfuse.c', line 267
static VALUE unsafe_getattr(VALUE *args)
{
return rb_funcall3(args[0],rb_intern("getattr"),2,&args[1]);
}
|
#getdir ⇒ Object
see #readdir
Fuse operation getdir
179 180 181 182 |
# File 'ext/rfuse/rfuse.c', line 179
static VALUE unsafe_getdir(VALUE *args)
{
return rb_funcall3(args[0],rb_intern("getdir"),3,&args[1]);
}
|
#getxattr(context, path, name) ⇒ String
Fuse operation getxattr
Get extended attribute
994 995 996 997 998 999 1000 |
# File 'ext/rfuse/rfuse.c', line 994
static VALUE unsafe_getxattr(VALUE *args)
{
VALUE res;
res = rb_funcall3(args[0],rb_intern("getxattr"),3,&args[1]);
//TODO - exception won't should that we're calling getxattr
return StringValue(res);
}
|
#init(info) ⇒ void
Fuse Operation init
This method returns an undefined value.
Called when filesystem is initialised
1221 1222 1223 1224 |
# File 'ext/rfuse/rfuse.c', line 1221
static VALUE unsafe_init(VALUE* args)
{
return rb_funcall3(args[0],rb_intern("init"),2,&args[1]);
}
|
#invalidate(path) ⇒ Object
obsolete in FUSE itself
1727 1728 1729 1730 1731 1732 |
# File 'ext/rfuse/rfuse.c', line 1727
VALUE rf_invalidate(VALUE self,VALUE path)
{
struct intern_fuse *inf;
Data_Get_Struct(self,struct intern_fuse,inf);
return fuse_invalidate(inf->fuse,StringValueCStr(path));
}
|
#link(context, from, to) ⇒ void
Fuse operation link
This method returns an undefined value.
Create a hard link to file
759 760 761 762 |
# File 'ext/rfuse/rfuse.c', line 759
static VALUE unsafe_link(VALUE *args)
{
return rb_funcall3(args[0],rb_intern("link"),3,&args[1]);
}
|
#listxattr(context, path) ⇒ Array<String>
Fuse operation listxattr
List extended attributes
1042 1043 1044 1045 1046 1047 1048 1049 1050 |
# File 'ext/rfuse/rfuse.c', line 1042
static VALUE unsafe_listxattr(VALUE *args)
{
VALUE res;
res = rb_funcall3(args[0],rb_intern("listxattr"),2,&args[1]);
//We'll let Ruby do the hard work of creating a String
//separated by NULLs
return rb_funcall(mRFuse,rb_intern("packxattr"),1,res);
}
|
#lock(context, path, ffi, cmd, flock) ⇒ void
Fuse operation lock
Some of the attributes of the flock struct should be writable
This method returns an undefined value.
Perform POSIX file locking operation
The cmd argument will be either F_GETLK, F_SETLK or F_SETLKW.
For the meaning of fields in ‘struct flock’ see the man page for fcntl(2). The l_whence field will always be set to SEEK_SET.
For checking lock ownership, the FileInfo#owner argument must be used. (NOT YET IMPLEMENTED)
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 l_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 it’s unlikly 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 l_pid field will be set to the pid of the process performing the 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 filesystems and similar.
1448 1449 1450 1451 |
# File 'ext/rfuse/rfuse.c', line 1448
static VALUE unsafe_lock(VALUE *args)
{
return rb_funcall3(args[0],rb_intern("lock"),5,&args[1]);
}
|
#loop ⇒ void
This method returns an undefined value.
Main processing loop
Use #exit to stop processing (or externally call fusermount -u)
Other ruby threads can continue while loop is running, however no thread can operate on the filesystem itself (ie with File or Dir methods)
136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 |
# File 'lib/rfuse.rb', line 136 def loop() raise RFuse::Error, "Already running!" if @running raise RFuse::Error, "FUSE not mounted" unless mounted? @running = true while @running do begin ready, ignore, errors = IO.select([@fuse_io,@pr],[],[@fuse_io]) if ready.include?(@pr) @pr.getc @running = false elsif errors.include?(@fuse_io) @running = false raise RFuse::Error, "FUSE error" elsif ready.include?(@fuse_io) if process() < 0 # Fuse has been unmounted externally # TODO: mounted? should now return false # fuse_exited? is not true... @running = false end end rescue Interrupt #oh well... end end end |
#mkdir(context, path, mode) ⇒ void
Fuse operation mkdir
This method returns an undefined value.
Create a directory
312 313 314 315 |
# File 'ext/rfuse/rfuse.c', line 312
static VALUE unsafe_mkdir(VALUE *args)
{
return rb_funcall3(args[0],rb_intern("mkdir"),3,&args[1]);
}
|
#mknod(context, path, mode, major, minor) ⇒ Object
230 231 232 233 |
# File 'ext/rfuse/rfuse.c', line 230
static VALUE unsafe_mknod(VALUE *args)
{
return rb_funcall3(args[0],rb_intern("mknod"),5,&args[1]);
}
|
#mounted? ⇒ Boolean
Is the filesystem successfully mounted
1678 1679 1680 1681 1682 1683 1684 1685 |
# File 'ext/rfuse/rfuse.c', line 1678
static VALUE rf_mounted(VALUE self)
{
struct intern_fuse *inf;
Data_Get_Struct(self,struct intern_fuse,inf);
// Never mounted, unmounted via fusermount, or via rf_unmount
return (inf->fuse == NULL || fuse_exited(inf->fuse) ) ? Qfalse : Qtrue;
}
|
#mountname ⇒ String Also known as: mountpoint
Returns directory where this filesystem is mounted.
1711 1712 1713 1714 1715 1716 1717 1718 1719 1720 1721 1722 |
# File 'ext/rfuse/rfuse.c', line 1711
VALUE rf_mountname(VALUE self)
{
struct intern_fuse *inf;
VALUE result;
Data_Get_Struct(self,struct intern_fuse,inf);
result = rb_str_new2(inf->mountpoint);
rb_filesystem_encode(result);
return result;
}
|
#open(context, path, ffi) ⇒ void
Fuse operation open
This method returns an undefined value.
File open operation
347 348 349 350 |
# File 'ext/rfuse/rfuse.c', line 347
static VALUE unsafe_open(VALUE *args)
{
return rb_funcall3(args[0],rb_intern("open"),3,&args[1]);
}
|
#opendir(context, path, name) ⇒ void
Fuse operation opendir
This method returns an undefined value.
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 available to #readdir, #fsyncdir, #releasedir.
1126 1127 1128 1129 |
# File 'ext/rfuse/rfuse.c', line 1126
static VALUE unsafe_opendir(VALUE *args)
{
return rb_funcall3(args[0],rb_intern("opendir"),3,&args[1]);
}
|
#process ⇒ Integer
Process one fuse command from the kernel
1756 1757 1758 1759 1760 1761 1762 1763 1764 1765 1766 |
# File 'ext/rfuse/rfuse.c', line 1756
VALUE rf_process(VALUE self)
{
struct intern_fuse *inf;
Data_Get_Struct(self,struct intern_fuse,inf);
if (inf->fuse == NULL) {
rb_raise(eRFuse_Error,"FUSE not mounted");
return Qnil;
} else {
return INT2NUM(intern_fuse_process(inf));
}
}
|
#read(context, path, size, offset, ffi) ⇒ String
Fuse operation read
Read data from an open file
794 795 796 797 798 799 800 801 802 |
# File 'ext/rfuse/rfuse.c', line 794
static VALUE unsafe_read(VALUE *args)
{
VALUE res;
res = rb_funcall3(args[0],rb_intern("read"),5,&args[1]);
//TODO If res does not implement to_str then you'll get an exception here that
//is hard to debug
return StringValue(res);
}
|
#readdir(context, path, filler, offset, ffi) ⇒ void
Fuse operation readdir
the API for the filler could be more ruby like - eg yield
This method returns an undefined value.
List contents of a directory
101 102 103 104 |
# File 'ext/rfuse/rfuse.c', line 101
static VALUE unsafe_readdir(VALUE *args)
{
return rb_funcall3(args[0],rb_intern("readdir"),5,&args[1]);
}
|
#readlink(context, path, size) ⇒ String
Fuse operation readlink
Resolve target of symbolic link
146 147 148 149 |
# File 'ext/rfuse/rfuse.c', line 146
static VALUE unsafe_readlink(VALUE *args)
{
return rb_funcall3(args[0],rb_intern("readlink"),3,&args[1]);
}
|
#release(context, path, ffi) ⇒ void
Fuse operation release
This method returns an undefined value.
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.
394 395 396 397 |
# File 'ext/rfuse/rfuse.c', line 394
static VALUE unsafe_release(VALUE *args)
{
return rb_funcall3(args[0],rb_intern("release"),3,&args[1]);
}
|
#releasedir(context, path, ffi) ⇒ void
Fuse operation releasedir
This method returns an undefined value.
Release directory
1157 1158 1159 1160 1161 |
# File 'ext/rfuse/rfuse.c', line 1157
static VALUE unsafe_releasedir(VALUE *args)
{
return rb_funcall(args[0],rb_intern("releasedir"),3,&args[1]);
}
|
#removexattr(context, path, name) ⇒ void
Fuse operation removexattr
This method returns an undefined value.
Remove extended attribute
1092 1093 1094 1095 |
# File 'ext/rfuse/rfuse.c', line 1092
static VALUE unsafe_removexattr(VALUE *args)
{
return rb_funcall3(args[0],rb_intern("removexattr"),3,&args[1]);
}
|
#rename(context, from, to) ⇒ void
Fuse operation rename
This method returns an undefined value.
Rename the file, directory, or other object “from” to the target “to”. Note that the source and target don’t have to be in the same directory, so it may be necessary to move the source to an entirely new directory. See rename(2) for full details.
725 726 727 728 |
# File 'ext/rfuse/rfuse.c', line 725
static VALUE unsafe_rename(VALUE *args)
{
return rb_funcall3(args[0],rb_intern("rename"),3,&args[1]);
}
|
#setxattr(context, path, name, data, flags) ⇒ void
Fuse operation setxattr
This method returns an undefined value.
Set extended attributes
957 958 959 960 |
# File 'ext/rfuse/rfuse.c', line 957
static VALUE unsafe_setxattr(VALUE *args)
{
return rb_funcall3(args[0],rb_intern("setxattr"),5,&args[1]);
}
|
#statfs(context, path) ⇒ StatVfs
Fuse operation statfs
Get file system statistics
The ‘f_frsize’, ‘f_favail’, ‘f_fsid’ and ‘f_flag’ fields are ignored
914 915 916 917 |
# File 'ext/rfuse/rfuse.c', line 914
static VALUE unsafe_statfs(VALUE *args)
{
return rb_funcall3(args[0],rb_intern("statfs"),2,&args[1]);
}
|
#symlink(context, to, from) ⇒ void
Fuse operation symlink
This method returns an undefined value.
Create a symbolic link
Create a symbolic link named “from” which, when evaluated, will lead to “to”.
692 693 694 |
# File 'ext/rfuse/rfuse.c', line 692 static VALUE unsafe_symlink(VALUE *args){ return rb_funcall3(args[0],rb_intern("symlink"),3,&args[1]); } |
#truncate(context, path, offset) ⇒ void
Fuse operation truncate
This method returns an undefined value.
Change the size of a file
501 502 503 504 |
# File 'ext/rfuse/rfuse.c', line 501
static VALUE unsafe_truncate(VALUE *args)
{
return rb_funcall3(args[0],rb_intern("truncate"),3,&args[1]);
}
|
#unlink(context, path) ⇒ void
Fuse operation unlink
This method returns an undefined value.
Remove a file
631 632 633 634 |
# File 'ext/rfuse/rfuse.c', line 631
static VALUE unsafe_unlink(VALUE *args)
{
return rb_funcall3(args[0],rb_intern("unlink"),2,&args[1]);
}
|
#unmount ⇒ Object
Unmount filesystem
1690 1691 1692 1693 1694 1695 1696 1697 1698 1699 1700 1701 1702 1703 1704 1705 1706 |
# File 'ext/rfuse/rfuse.c', line 1690
VALUE rf_unmount(VALUE self)
{
struct intern_fuse *inf;
Data_Get_Struct(self,struct intern_fuse,inf);
rb_funcall(self,rb_intern("ruby_unmount"),0);
if (inf->fuse != NULL) {
fuse_exit(inf->fuse);
}
if (inf->fc != NULL) {
fuse_unmount(inf->mountpoint, inf->fc);
inf->fc = NULL;
}
return Qnil;
}
|
#utime(context, path, actime, modtime) ⇒ void
534 535 536 537 |
# File 'ext/rfuse/rfuse.c', line 534
static VALUE unsafe_utime(VALUE *args)
{
return rb_funcall3(args[0],rb_intern("utime"),4,&args[1]);
}
|
#utimens(context, path, actime, modtime) ⇒ void
Fuse operation utimens
This method returns an undefined value.
Change access/modification times of a file
1509 1510 1511 1512 |
# File 'ext/rfuse/rfuse.c', line 1509
static VALUE unsafe_utimens(VALUE *args)
{
return rb_funcall3(args[0],rb_intern("utimens"),4,&args[1]);
}
|
#write(context, path, data, offset, ffi) ⇒ Integer
Fuse operation write
Write data to an open file
870 871 872 873 |
# File 'ext/rfuse/rfuse.c', line 870
static VALUE unsafe_write(VALUE *args)
{
return rb_funcall3(args[0],rb_intern("write"),5,&args[1]);
}
|