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 ⇒ void
abstract
Cleanup filesystem.
-
#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_obj, opts) ⇒ 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, size, offset, ffi) ⇒ Integer
abstract
Write data to an open file.
Constructor Details
#initialize(mountpoint_obj, opts) ⇒ Object
initialize and mount the filesystem
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 1904 1905 1906 1907 1908 1909 1910 1911 1912 1913 1914 1915 1916 1917 1918 1919 1920 1921 1922 1923 1924 1925 1926 1927 1928 1929 1930 1931 1932 1933 1934 1935 1936 1937 1938 1939 1940 1941 1942 1943 1944 1945 1946 1947 1948 1949 1950 1951 1952 1953 1954 1955 1956 1957 1958 1959 1960 1961 1962 1963 1964 1965 1966 1967 1968 1969 1970 1971 1972 1973 1974 1975 1976 1977 1978 1979 1980 1981 1982 1983 1984 |
# File 'ext/rfuse/rfuse.c', line 1859
static VALUE rf_initialize(
VALUE self,
VALUE mountpoint_obj,
VALUE opts)
{
//Allow things like Pathname to be sent as a mountpoint
VALUE mountpoint = rb_obj_as_string(mountpoint_obj);
Check_Type(opts, T_ARRAY);
struct intern_fuse *inf;
Data_Get_Struct(self,struct intern_fuse,inf);
inf->mountpoint = strdup(StringValueCStr(mountpoint));
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,"destroy"))
// inf->fuse_op.destroy = rf_destroy;
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;
/*
if (RESPOND_TO(self,"ioctl"))
inf->fuse_op.ioctl = rf_ioctl;
if (RESPOND_TO(self,"poll"))
inf->fuse_op.poll = rf_poll;
*/
struct fuse_args *args = rarray2fuseargs(opts);
//Store our fuse object in user_data, this will be returned to use in the
//session context
void* user_data = self;
int init_result;
// 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?
init_result = intern_fuse_init(inf, args, user_data);
//Create the open files hash where we cache FileInfo objects
VALUE open_files_hash;
if (init_result == 0) {
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
1372 1373 1374 1375 |
# File 'ext/rfuse/rfuse.c', line 1372
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
1643 1644 1645 1646 |
# File 'ext/rfuse/rfuse.c', line 1643
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
648 649 650 651 |
# File 'ext/rfuse/rfuse.c', line 648
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
615 616 617 618 |
# File 'ext/rfuse/rfuse.c', line 615
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.
1407 1408 1409 1410 |
# File 'ext/rfuse/rfuse.c', line 1407
static VALUE unsafe_create(VALUE* args)
{
return rb_funcall3(args[0],rb_intern("create"),4,&args[1]);
}
|
#destroy ⇒ void
Fuse Operation destroy
This method returns an undefined value.
Cleanup filesystem
Called at filesystem exit - which itself is triggered when this fuse object is garbage collected, so not sure it is actually safe to call this
1342 1343 1344 1345 |
# File 'ext/rfuse/rfuse.c', line 1342
static VALUE unsafe_destroy(VALUE* args)
{
return rb_funcall3(args[0],rb_intern("destroy"),1,&args[1]);
}
|
#exit ⇒ Object
Stop processing #loop eg called from Signal handlers, or some other monitoring thread
68 69 70 |
# File 'lib/rfuse.rb', line 68 def exit @pw.putc(0) end |
#fd ⇒ Integer
Returns /dev/fuse file descriptor for use with IO.select and #process.
1818 1819 1820 1821 1822 1823 1824 1825 1826 1827 1828 |
# File 'ext/rfuse/rfuse.c', line 1818
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
1480 1481 1482 1483 |
# File 'ext/rfuse/rfuse.c', line 1480
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.
514 515 516 517 |
# File 'ext/rfuse/rfuse.c', line 514
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
463 464 465 |
# File 'ext/rfuse/rfuse.c', line 463 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
1240 1241 1242 1243 |
# File 'ext/rfuse/rfuse.c', line 1240
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
1444 1445 1446 1447 |
# File 'ext/rfuse/rfuse.c', line 1444
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.
280 281 282 283 |
# File 'ext/rfuse/rfuse.c', line 280
static VALUE unsafe_getattr(VALUE *args)
{
return rb_funcall3(args[0],rb_intern("getattr"),2,&args[1]);
}
|
#getdir ⇒ Object
see #readdir
Fuse operation getdir
190 191 192 193 |
# File 'ext/rfuse/rfuse.c', line 190
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
1048 1049 1050 1051 1052 1053 1054 |
# File 'ext/rfuse/rfuse.c', line 1048
static VALUE unsafe_getxattr(VALUE *args)
{
VALUE res;
res = rb_funcall3(args[0],rb_intern("getxattr"),3,&args[1]);
return StringValue(res);
}
|
#init(info) ⇒ void
Fuse Operation init
This method returns an undefined value.
Called when filesystem is initialised
1270 1271 1272 1273 |
# File 'ext/rfuse/rfuse.c', line 1270
static VALUE unsafe_init(VALUE* args)
{
return rb_funcall3(args[0],rb_intern("init"),2,&args[1]);
}
|
#invalidate(path) ⇒ Object
obsolete in FUSE itself
1807 1808 1809 1810 1811 1812 |
# File 'ext/rfuse/rfuse.c', line 1807
VALUE rf_invalidate(VALUE self,VALUE path)
{
struct intern_fuse *inf;
Data_Get_Struct(self,struct intern_fuse,inf);
return fuse_invalidate(inf->fuse,STR2CSTR(path));
}
|
#link(context, from, to) ⇒ void
Fuse operation link
This method returns an undefined value.
Create a hard link to file
811 812 813 814 |
# File 'ext/rfuse/rfuse.c', line 811
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
1092 1093 1094 1095 1096 1097 1098 1099 1100 |
# File 'ext/rfuse/rfuse.c', line 1092
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
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.
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.
1534 1535 1536 1537 |
# File 'ext/rfuse/rfuse.c', line 1534
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)
34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 |
# File 'lib/rfuse.rb', line 34 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
325 326 327 328 |
# File 'ext/rfuse/rfuse.c', line 325
static VALUE unsafe_mkdir(VALUE *args)
{
return rb_funcall3(args[0],rb_intern("mkdir"),3,&args[1]);
}
|
#mknod(context, path, mode, major, minor) ⇒ Object
242 243 244 245 |
# File 'ext/rfuse/rfuse.c', line 242
static VALUE unsafe_mknod(VALUE *args)
{
return rb_funcall3(args[0],rb_intern("mknod"),5,&args[1]);
}
|
#mounted? ⇒ Boolean
Is the filesystem successfully mounted
1761 1762 1763 1764 1765 1766 1767 1768 |
# File 'ext/rfuse/rfuse.c', line 1761
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.
1794 1795 1796 1797 1798 1799 1800 1801 1802 |
# File 'ext/rfuse/rfuse.c', line 1794
VALUE rf_mountname(VALUE self)
{
struct intern_fuse *inf;
Data_Get_Struct(self,struct intern_fuse,inf);
VALUE 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
368 369 370 371 |
# File 'ext/rfuse/rfuse.c', line 368
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.
1172 1173 1174 1175 |
# File 'ext/rfuse/rfuse.c', line 1172
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
1836 1837 1838 1839 1840 1841 1842 1843 1844 1845 1846 |
# File 'ext/rfuse/rfuse.c', line 1836
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
847 848 849 850 851 852 853 854 |
# File 'ext/rfuse/rfuse.c', line 847
static VALUE unsafe_read(VALUE *args)
{
VALUE res;
res = rb_funcall3(args[0],rb_intern("read"),5,&args[1]);
return StringValue(res);
}
|
#readdir(context, path, filler, offset, ffi) ⇒ void
Fuse operation readdir
This method returns an undefined value.
List contents of a directory
111 112 113 114 |
# File 'ext/rfuse/rfuse.c', line 111
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
157 158 159 160 |
# File 'ext/rfuse/rfuse.c', line 157
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.
421 422 423 424 |
# File 'ext/rfuse/rfuse.c', line 421
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
1204 1205 1206 1207 1208 |
# File 'ext/rfuse/rfuse.c', line 1204
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
1137 1138 1139 1140 |
# File 'ext/rfuse/rfuse.c', line 1137
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.
776 777 778 779 |
# File 'ext/rfuse/rfuse.c', line 776
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
1010 1011 1012 1013 |
# File 'ext/rfuse/rfuse.c', line 1010
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
967 968 969 970 |
# File 'ext/rfuse/rfuse.c', line 967
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”.
742 743 744 |
# File 'ext/rfuse/rfuse.c', line 742 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
545 546 547 548 |
# File 'ext/rfuse/rfuse.c', line 545
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
679 680 681 682 |
# File 'ext/rfuse/rfuse.c', line 679
static VALUE unsafe_unlink(VALUE *args)
{
return rb_funcall3(args[0],rb_intern("unlink"),2,&args[1]);
}
|
#unmount ⇒ Object
Unmount filesystem
1773 1774 1775 1776 1777 1778 1779 1780 1781 1782 1783 1784 1785 1786 1787 1788 1789 |
# File 'ext/rfuse/rfuse.c', line 1773
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
579 580 581 582 |
# File 'ext/rfuse/rfuse.c', line 579
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
1593 1594 1595 1596 |
# File 'ext/rfuse/rfuse.c', line 1593
static VALUE unsafe_utimens(VALUE *args)
{
return rb_funcall3(args[0],rb_intern("utimens"),4,&args[1]);
}
|
#write(context, path, size, offset, ffi) ⇒ Integer
Fuse operation write
Write data to an open file
923 924 925 926 |
# File 'ext/rfuse/rfuse.c', line 923
static VALUE unsafe_write(VALUE *args)
{
return rb_funcall3(args[0],rb_intern("write"),5,&args[1]);
}
|