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_buf
getContext, getFSName, mount, umount
public static void main(java.lang.String[] args)
public int create(java.lang.String path, long mode, FuseFileInfo fi)
FuseFS
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.
create
in interface FuseFS
create
in class FuseStubFS
mode
- 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)
FuseFS
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.
getattr
in interface FuseFS
getattr
in class FuseStubFS
public int mkdir(java.lang.String path, long mode)
FuseFS
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|S_IFDIR
mkdir
in interface FuseFS
mkdir
in class FuseStubFS
mode
- 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)
FuseFS
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.
read
in interface FuseFS
read
in class FuseStubFS
public int readdir(java.lang.String path, jnr.ffi.Pointer buf, FuseFillDir filter, long offset, FuseFileInfo fi)
FuseFS
This 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 FuseFS
readdir
in class FuseStubFS
public int statfs(java.lang.String path, Statvfs stbuf)
FuseFS
The 'f_frsize', 'f_favail', 'f_fsid' and 'f_flag' fields are ignored
statfs
in interface FuseFS
statfs
in class FuseStubFS
public int rename(java.lang.String path, java.lang.String newName)
FuseFS
rename
in interface FuseFS
rename
in class FuseStubFS
public int rmdir(java.lang.String path)
FuseFS
rmdir
in interface FuseFS
rmdir
in class FuseStubFS
public int truncate(java.lang.String path, long offset)
FuseFS
truncate
in interface FuseFS
truncate
in class FuseStubFS
public int unlink(java.lang.String path)
FuseFS
unlink
in interface FuseFS
unlink
in class FuseStubFS
public int open(java.lang.String path, FuseFileInfo fi)
FuseFS
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.
open
in interface FuseFS
open
in class FuseStubFS
OpenFlags
public int write(java.lang.String path, jnr.ffi.Pointer buf, long size, long offset, FuseFileInfo fi)
FuseFS
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).
write
in interface FuseFS
write
in class FuseStubFS