org.basex.fuse
Class DeepFuse

java.lang.Object
  extended by org.basex.fuse.DeepFuse
Direct Known Subclasses:
DeepFS

public abstract class DeepFuse
extends java.lang.Object

Interface to filesystem in userspace framework.

Author:
Workgroup DBIS, University of Konstanz 2005-09, ISC License, Alexander Holupirek, alex@holupirek.de

Constructor Summary
DeepFuse()
           
 
Method Summary
abstract  int access(java.lang.String path, int mode)
          Check file access permissions.
abstract  int bmap(java.lang.String path, long blocksize, long idx)
          Map block index within file to block index within device.
abstract  int chmod(java.lang.String path, int mode)
          Change the permission bits of a file.
abstract  int chown(java.lang.String path, int uid, int gid)
          Change the owner and group of a file.
abstract  int create(java.lang.String path, int mode)
          Create and open a file.
abstract  int destroy()
          Clean up filesystem.
abstract  int fgetattr(java.lang.String path)
          Get attributes from an open file.
abstract  int flush(java.lang.String path)
          Possibly flush cached data.
abstract  int fsync(java.lang.String path)
          Synchronize file contents.
abstract  int fsyncdir(java.lang.String path)
          Synchronize directory contents.
abstract  int ftruncate(java.lang.String path, long off)
          Change the size of an open file.
abstract  int getattr(java.lang.String path)
          Get file attributes.
abstract  int getxattr(java.lang.String path)
          Get extended attributes.
abstract  int link(java.lang.String name1, java.lang.String name2)
          Create a hard link to a file.
abstract  int listxattr(java.lang.String path)
          List extended attributes.
abstract  int lock(java.lang.String path, int cmd)
          Perform POSIX file locking operation.
abstract  int mkdir(java.lang.String path, int mode)
          Create a directory.
abstract  int mknod(java.lang.String path, int mode, int dev)
          Create a file node.
abstract  int open(java.lang.String path)
          File open operation.
abstract  int opendir(java.lang.String path)
          Open directory.
abstract  byte[] read(java.lang.String path, int length, int offset)
          Read data from an open file.
abstract  java.lang.String readdir(java.lang.String path, int offset)
          Read directory.
abstract  java.lang.String readlink(java.lang.String path)
          Read the target of a symbolic link.
abstract  int release(java.lang.String path)
          Release an open file.
abstract  int releasedir(java.lang.String path)
          Release directory.
abstract  int removexattr(java.lang.String path)
          Remove extended attributes.
abstract  int rename(java.lang.String from, java.lang.String to)
          Rename a file.
abstract  int rmdir(java.lang.String path)
          Remove a directory file.
abstract  int setxattr(java.lang.String path)
          Set extended attributes.
abstract  int statfs(java.lang.String path)
          Get file system statistics.
abstract  int symlink(java.lang.String from, java.lang.String to)
          Make symbolic link to a file.
abstract  int truncate(java.lang.String path, long off)
          Change the size of a file.
abstract  int unlink(java.lang.String path)
          Remove a file.
abstract  int utimens(java.lang.String path)
          Change the access and modification times of a file with nanosecond resolution.
abstract  int write(java.lang.String path, int length, int offset, byte[] data)
          Write data to an open file.
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

DeepFuse

public DeepFuse()
Method Detail

getattr

public abstract int getattr(java.lang.String path)
Get file attributes.

Parameters:
path - to the file the stat information is requested for
Returns:
int id of node/inode of the requested file

readlink

public abstract java.lang.String readlink(java.lang.String path)
Read the target of a symbolic link.

Parameters:
path - to the link
Returns:
String link target

mknod

public abstract int mknod(java.lang.String path,
                          int mode,
                          int dev)
Create a file node. This is called for creation of all non-directory, non-symlink nodes. If the filesystem defines a create() method, then for regular files that will be called instead.

Parameters:
path - name of the file to be created.
mode - specifies both the permissions to use and the type of node to be created.
dev - If the file type is S_IFCHR or S_IFBLK then dev specifies the major and minor numbers of the newly created device special file; otherwise it is ignored.
Returns:
zero on success, or -1 if an error occurred (in which case, errno is set appropriately).

mkdir

public abstract int mkdir(java.lang.String path,
                          int mode)
Create a directory.

Parameters:
path - to directory to be created
mode - permissions for directory
Returns:
node id, or -1 if an error occurred (in which case, errno is set appropriately).

unlink

public abstract int unlink(java.lang.String path)
Remove a file.

Parameters:
path - to file to be removed
Returns:
zero on success, or -1 if an error occurred (in which case, errno is set appropriately).

rmdir

public abstract int rmdir(java.lang.String path)
Remove a directory file.

Parameters:
path - to file to be removed
Returns:
zero on success, or -1 if an error occurred (in which case, errno is set appropriately).

symlink

public abstract int symlink(java.lang.String from,
                            java.lang.String to)
Make symbolic link to a file.

Parameters:
from - link source
to - link target
Returns:
zero on success, or -1 if an error occurred (in which case, errno is set appropriately).

rename

public abstract int rename(java.lang.String from,
                           java.lang.String to)
Rename a file.

Parameters:
from - path to file to be renamed
to - new name
Returns:
zero on success, or -1 if an error occurred (in which case, errno is set appropriately).

link

public abstract int link(java.lang.String name1,
                         java.lang.String name2)
Create a hard link to a file.

Parameters:
name1 - link source
name2 - link target
Returns:
zero on success, or -1 if an error occurred (in which case, errno is set appropriately).

chmod

public abstract int chmod(java.lang.String path,
                          int mode)
Change the permission bits of a file.

Parameters:
path - name of the file
mode - permissions to be set
Returns:
zero on success, or -1 if an error occurred

chown

public abstract int chown(java.lang.String path,
                          int uid,
                          int gid)
Change the owner and group of a file.

Parameters:
path - name of the file
uid - owner
gid - group
Returns:
zero on success, or -1 if an error occurred

truncate

public abstract int truncate(java.lang.String path,
                             long off)
Change the size of a file.

Parameters:
path - name of the file
off - size to be set
Returns:
zero on success, or -1 if an error occurred

open

public abstract int open(java.lang.String path)
File open operation.

Parameters:
path - name of the file
Returns:
zero on success, or -1 if an error occurred

read

public abstract byte[] read(java.lang.String path,
                            int length,
                            int offset)
Read data from an open file.

Parameters:
path - name of the file
length - number of bytes to read
offset - from which to read
Returns:
zero on success, or -1 if an error occurred

write

public abstract int write(java.lang.String path,
                          int length,
                          int offset,
                          byte[] data)
Write data to an open file.

Parameters:
path - name of the file
length - number of bytes to write
offset - from which to write
data - buffer from which to write
Returns:
zero on success, or -1 if an error occurred

statfs

public abstract int statfs(java.lang.String path)
Get file system statistics.

Parameters:
path - name of the file
Returns:
zero on success, or -1 if an error occurred

flush

public abstract int flush(java.lang.String path)
Possibly flush cached data. BIG NOTE: This is not equivalent to fsync(). It's not a request to sync dirty data.

Parameters:
path - name of the file
Returns:
zero on success, or -1 if an error occurred

release

public abstract int release(java.lang.String path)
Release an open file.

Parameters:
path - name of the file
Returns:
zero on success, or -1 if an error occurred

fsync

public abstract int fsync(java.lang.String path)
Synchronize file contents.

Parameters:
path - name of the file
Returns:
zero on success, or -1 if an error occurred

setxattr

public abstract int setxattr(java.lang.String path)
Set extended attributes.

Parameters:
path - name of the file
Returns:
zero on success, or -1 if an error occurred

getxattr

public abstract int getxattr(java.lang.String path)
Get extended attributes.

Parameters:
path - name of the file
Returns:
zero on success, or -1 if an error occurred

listxattr

public abstract int listxattr(java.lang.String path)
List extended attributes.

Parameters:
path - name of the file
Returns:
zero on success, or -1 if an error occurred

removexattr

public abstract int removexattr(java.lang.String path)
Remove extended attributes.

Parameters:
path - name of the file
Returns:
zero on success, or -1 if an error occurred

opendir

public abstract int opendir(java.lang.String path)
Open directory.

Parameters:
path - name of the file
Returns:
the number of directories or -1 if an error occurred

readdir

public abstract java.lang.String readdir(java.lang.String path,
                                         int offset)
Read directory.

Parameters:
path - name of the directory to read
offset - of directory entry requested
Returns:
name of directory entry or null on failure

releasedir

public abstract int releasedir(java.lang.String path)
Release directory.

Parameters:
path - name of the file
Returns:
zero on success, or -1 if an error occurred

fsyncdir

public abstract int fsyncdir(java.lang.String path)
Synchronize directory contents.

Parameters:
path - name of the file
Returns:
zero on success, or -1 if an error occurred

destroy

public abstract int destroy()
Clean up filesystem. Called on filesystem exit.

Returns:
zero on success, or -1 if an error occurred

access

public abstract int access(java.lang.String path,
                           int mode)
Check file access permissions.

Parameters:
path - name of the file
mode - permission to check
Returns:
zero on success, or -1 if an error occurred

create

public abstract int create(java.lang.String path,
                           int mode)
Create and open a file.

Parameters:
path - for the file to be created
mode - of file (directory, regular file ..., permission bits)
Returns:
int id of newly created file or -1 on failure

ftruncate

public abstract int ftruncate(java.lang.String path,
                              long off)
Change the size of an open file.

Parameters:
path - name of the file
off - new file size
Returns:
zero on success, or -1 if an error occurred

fgetattr

public abstract int fgetattr(java.lang.String path)
Get attributes from an open file. This method is called instead of the getattr() method if the file information is available.

Parameters:
path - name of the file
Returns:
zero on success, or -1 if an error occurred

lock

public abstract int lock(java.lang.String path,
                         int cmd)
Perform POSIX file locking operation.

Parameters:
path - name of the file
cmd - locking command id
Returns:
zero on success, or -1 if an error occurred

utimens

public abstract int utimens(java.lang.String path)
Change the access and modification times of a file with nanosecond resolution.

Parameters:
path - name of the file
Returns:
zero on success, or -1 if an error occurred

bmap

public abstract int bmap(java.lang.String path,
                         long blocksize,
                         long idx)
Map block index within file to block index within device.

Parameters:
path - name of the file
blocksize - block size
idx - block index
Returns:
zero on success, or -1 if an error occurred