public class MemoryFS extends FuseStubFS
fuseOperations, libFuse, mounted, mountPoint| Constructor and Description |
|---|
MemoryFS() |
| Modifier and Type | Method and Description |
|---|---|
int |
create(java.lang.String path,
long mode,
FuseFileInfo fi)
Create and open a file
|
int |
getattr(java.lang.String path,
FileStat stat)
Get file attributes.
|
static void |
main(java.lang.String[] args) |
int |
mkdir(java.lang.String path,
long mode)
Create a directory
|
int |
open(java.lang.String path,
FuseFileInfo fi)
File open operation
|
int |
read(java.lang.String path,
jnr.ffi.Pointer buf,
long size,
long offset,
FuseFileInfo fi)
Read data from an open file
|
int |
readdir(java.lang.String path,
jnr.ffi.Pointer buf,
FuseFillDir filter,
long offset,
FuseFileInfo fi)
Read directory
|
int |
rename(java.lang.String path,
java.lang.String newName)
Rename a file
|
int |
rmdir(java.lang.String path)
Remove a directory
|
int |
statfs(java.lang.String path,
Statvfs stbuf)
Get file system statistics
|
int |
truncate(java.lang.String path,
long offset)
Change the size of a file
|
int |
unlink(java.lang.String path)
Remove a file
|
int |
write(java.lang.String path,
jnr.ffi.Pointer buf,
long size,
long offset,
FuseFileInfo fi)
Write data to an open file
|
access, bmap, chmod, chown, destroy, fallocate, fgetattr, flock, flush, fsync, fsyncdir, ftruncate, getxattr, init, ioctl, link, listxattr, lock, mknod, opendir, poll, read_buf, readlink, release, releasedir, removexattr, setxattr, symlink, utimens, write_bufgetContext, getFSName, mount, umountpublic static void main(java.lang.String[] args)
public int create(java.lang.String path,
long mode,
FuseFileInfo fi)
FuseFSIf 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.
create in interface FuseFScreate in class FuseStubFSmode - The argument mode specifies the permissions to use in case a new file
is created. See ru.serce.jnrfuse.struct.FileStat flagspublic int getattr(java.lang.String path,
FileStat stat)
FuseFSSimilar 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.
getattr in interface FuseFSgetattr in class FuseStubFSpublic int mkdir(java.lang.String path,
long mode)
FuseFSNote 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|S_IFDIR
mkdir in interface FuseFSmkdir in class FuseStubFSmode - The argument mode specifies the permissions to use in case a new file
is created. @see ru.serce.jnrfuse.struct.FileStat flagspublic int read(java.lang.String path,
jnr.ffi.Pointer buf,
long size,
long offset,
FuseFileInfo fi)
FuseFSRead 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.
read in interface FuseFSread in class FuseStubFSpublic int readdir(java.lang.String path,
jnr.ffi.Pointer buf,
FuseFillDir filter,
long offset,
FuseFileInfo fi)
FuseFSThis supersedes the old getdir() interface. New applications should use this.
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. This works just like the old getdir() method.
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'.
readdir in interface FuseFSreaddir in class FuseStubFSpublic int statfs(java.lang.String path,
Statvfs stbuf)
FuseFSThe 'f_frsize', 'f_favail', 'f_fsid' and 'f_flag' fields are ignored
statfs in interface FuseFSstatfs in class FuseStubFSpublic int rename(java.lang.String path,
java.lang.String newName)
FuseFSrename in interface FuseFSrename in class FuseStubFSpublic int rmdir(java.lang.String path)
FuseFSrmdir in interface FuseFSrmdir in class FuseStubFSpublic int truncate(java.lang.String path,
long offset)
FuseFStruncate in interface FuseFStruncate in class FuseStubFSpublic int unlink(java.lang.String path)
FuseFSunlink in interface FuseFSunlink in class FuseStubFSpublic int open(java.lang.String path,
FuseFileInfo fi)
FuseFSNo 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.
open in interface FuseFSopen in class FuseStubFSOpenFlagspublic int write(java.lang.String path,
jnr.ffi.Pointer buf,
long size,
long offset,
FuseFileInfo fi)
FuseFSWrite 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).
write in interface FuseFSwrite in class FuseStubFS