ShingledFS 2.0
SMR-AwareFUSE-basedFileSystem
|
Macros, data structures and function prototypes pertaining to the Shingled File System. More...
Go to the source code of this file.
Defines | |
#define | MAX_FILENAME_LEN 255 |
Maximum length for the name of a file. | |
Functions | |
void * | shingledfs_init (struct fuse_conn_info *conn) |
Initializes the Shingled File System, preparing it for usage. | |
int | shingledfs_mkdir (const char *path, mode_t mode) |
Creates a new directory. | |
int | shingledfs_rmdir (const char *path) |
Removes a directory. | |
int | shingledfs_opendir (const char *path, struct fuse_file_info *fi) |
Opens the specified directory. | |
int | shingledfs_readdir (const char *path, void *buf, fuse_fill_dir_t filler, off_t offset, struct fuse_file_info *fi) |
Reads the list of files in the specified directory. | |
int | shingledfs_releasedir (const char *path, struct fuse_file_info *fi) |
Closes the open directory. | |
int | shingledfs_mknod (const char *path, mode_t mode, dev_t dev) |
Creates a new file node. | |
int | shingledfs_open (const char *path, struct fuse_file_info *fi) |
Opens the specified file. | |
int | shingledfs_read (const char *path, char *buf, size_t size, off_t offset, struct fuse_file_info *fi) |
Reads data from an open file. | |
int | shingledfs_write (const char *path, const char *buf, size_t size, off_t offset, struct fuse_file_info *fi) |
Write data to an open file. | |
int | shingledfs_flush (const char *path, struct fuse_file_info *fi) |
Flushes file contents to disk. | |
int | shingledfs_release (const char *path, struct fuse_file_info *fi) |
Closes an open file. | |
int | shingledfs_rename (const char *path, const char *path_new) |
Renames a file. | |
int | shingledfs_unlink (const char *path) |
Deletes a file. | |
int | shingledfs_truncate (const char *path, off_t offset) |
Truncates the file at the specified offset. | |
int | shingledfs_getattr (const char *path, struct stat *statbuf) |
Truncates the file at the specified offset. | |
int | shingledfs_fgetattr (const char *path, struct stat *statbuf, struct fuse_file_info *fi) |
Retrieves the attributes for the specified file. | |
int | shingledfs_setxattr (const char *path, const char *name, const char *value, size_t size, int flags) |
Sets the extended attributes. | |
int | shingledfs_getxattr (const char *path, const char *name, char *value, size_t size) |
Retrieves the value associated with an extended attribute. | |
int | shingledfs_listxattr (const char *path, char *list, size_t size) |
Retrieves the list of extended attributes. | |
int | shingledfs_removexattr (const char *path, const char *name) |
Removes an extended attribute. | |
int | shingledfs_access (const char *path, int mask) |
Returns the access mask for the specified path. | |
int | shingledfs_utime (const char *path, struct utimbuf *tv) |
Sets the access and/or modification times of the specified file. | |
int | shingledfs_chmod (const char *path, mode_t mode) |
Changes the permission bits of a file. | |
int | shingledfs_chown (const char *path, uid_t uid, gid_t gid) |
Changes the owner and group of a file. | |
int | shingledfs_symlink (const char *path, const char *path_target) |
Creates a symbolic link. | |
int | shingledfs_readlink (const char *path, char *buf, size_t size) |
Reads the target of a symbolic link. | |
int | shingledfs_link (const char *path, const char *path_target) |
Creates a hard link. | |
int | shingledfs_statfs (const char *path, struct statvfs *statv) |
Returns ShingledFS file system statistics. |
Macros, data structures and function prototypes pertaining to the Shingled File System.
Definition in file shingledfs.h.
int shingledfs_access | ( | const char * | path, |
int | mask | ||
) |
Returns the access mask for the specified path.
path | Path to the file whose access permissions are to be checked |
mask | Permissions to check for |
Definition at line 1084 of file fuseops.c.
References translate_path(), and xattr_get().
int shingledfs_chmod | ( | const char * | path, |
mode_t | mode | ||
) |
Changes the permission bits of a file.
path | Path to the file whose permission bits are to be changed |
mode | The new permission bits to be set |
Definition at line 1190 of file fuseops.c.
References translate_path(), xattr_get(), and xattr_set().
int shingledfs_chown | ( | const char * | path, |
uid_t | uid, | ||
gid_t | gid | ||
) |
Changes the owner and group of a file.
path | Path to the file whose owner and group is to be changed |
uid | The UID of the user who is the new owner of the file |
gid | The GID of the group that can access the file |
Definition at line 1238 of file fuseops.c.
References translate_path(), xattr_get(), and xattr_set().
int shingledfs_fgetattr | ( | const char * | path, |
struct stat * | statbuf, | ||
struct fuse_file_info * | fi | ||
) |
Retrieves the attributes for the specified file.
This function relies on the file descriptor of an open file, passed in the fuse_file_info structure.
As per documentation in fuse/fuse.h, this is currently only called after create(), but may later be used for invocations of fstat() as well.
path | Path to the file whose attributes are to be retrived |
statbuf | Buffer to hold the retrieved stats |
file_info | fuse_file_info structure from the call to open() |
int shingledfs_flush | ( | const char * | path, |
struct fuse_file_info * | fi | ||
) |
Flushes file contents to disk.
For ShingledFS, this function does nothing! We want to write file contents to disk on close(), not before that!
path | Path to the open file. |
file_info | FUSE structure created when the file was opened. |
int shingledfs_getattr | ( | const char * | path, |
struct stat * | statbuf | ||
) |
Truncates the file at the specified offset.
This function relies on the file descriptor of an open file, passed in the fuse_file_info structure.
path | Path to the file whose attributes are to be retrived |
offset | Offset into the file to truncate at |
file_info | fuse_file_info structure from the call to open() or create() |
path | Path to the file whose attributes are to be retrived |
statbuf | Buffer to hold the retrieved stats |
Definition at line 841 of file fuseops.c.
References translate_path(), and xattr_get().
int shingledfs_getxattr | ( | const char * | path, |
const char * | name, | ||
char * | value, | ||
size_t | size | ||
) |
Retrieves the value associated with an extended attribute.
path | Path to the file whose extended attribute are to be retrieved |
name | Name of the extended attribute to retrieve |
value | Buffer to hold the value of the extended attribute |
size | Size of the data in the buffer |
Definition at line 971 of file fuseops.c.
References translate_path(), and xattr_get().
void* shingledfs_init | ( | struct fuse_conn_info * | conn | ) |
Initializes the Shingled File System, preparing it for usage.
conn | FUSE structure detailing connection information |
Definition at line 50 of file fuseops.c.
References bc_init(), init_inodebitmap(), init_inodelist(), read_edi_parameters(), and shingledfs_data.
int shingledfs_link | ( | const char * | path, |
const char * | path_target | ||
) |
Creates a hard link.
path | Path to the hard link to be created |
path_target | Path to the target of the symbolic link |
Definition at line 1364 of file fuseops.c.
References translate_path(), xattr_get(), and xattr_set().
int shingledfs_listxattr | ( | const char * | path, |
char * | list, | ||
size_t | size | ||
) |
Retrieves the list of extended attributes.
path | Path to the file whose extended attributes are to be set |
list | Buffer to hold the list of extended attributes |
size | Size of the data in the buffer |
Definition at line 1014 of file fuseops.c.
References translate_path().
int shingledfs_mkdir | ( | const char * | path, |
mode_t | mode | ||
) |
Creates a new directory.
Documentation in fuse/fuse.h mentions that the mode bit for the directory may not have been set. So it should be ORed with S_IFDIR to ensure that correct directory mode is setup.
path | Path to the new directory |
mode | Permissions to set for the newly created directory |
Definition at line 114 of file fuseops.c.
References translate_path().
int shingledfs_mknod | ( | const char * | path, |
mode_t | mode, | ||
dev_t | dev | ||
) |
Creates a new file node.
This function calls mknod() to create the requested file along with its Attribute Replication file, into which the attributes of the file are stored.
This function is called by FUSE to create non-directory non-symlink nodes. If create() is defined, then that is called. However, create() only works in Linux kernel after 2.6.15. So it was better to implement the mknod() function instead of create().
path | Path to the file to create |
mode | Access mode specifications for the newly created file |
file_info | fuse_file_info structure from the call to opendir() |
Definition at line 317 of file fuseops.c.
References translate_path(), xattr_path(), and xattr_set().
int shingledfs_open | ( | const char * | path, |
struct fuse_file_info * | fi | ||
) |
Opens the specified file.
Essentially, this function just calls
path | Path to the file to create |
file_info | fuse_file_info structure to store file-related data |
Definition at line 383 of file fuseops.c.
References bc_open(), and translate_path().
int shingledfs_opendir | ( | const char * | path, |
struct fuse_file_info * | fi | ||
) |
Opens the specified directory.
path | Path to the directory to open |
fi | FUSE File Info structure to store the Directory Pointer |
Definition at line 170 of file fuseops.c.
References translate_path().
int shingledfs_read | ( | const char * | path, |
char * | buf, | ||
size_t | size, | ||
off_t | offset, | ||
struct fuse_file_info * | fi | ||
) |
Reads data from an open file.
path | Path to the open file. |
buf | Buffer to hold the data read from the file. |
size | Size of the data to read from the file (in bytes) |
offset | Offset into the file from where the data is to be read. |
file_info | FUSE structure created when the file was opened. |
int shingledfs_readdir | ( | const char * | path, |
void * | buf, | ||
fuse_fill_dir_t | filler, | ||
off_t | offset, | ||
struct fuse_file_info * | fi | ||
) |
Reads the list of files in the specified directory.
This function filters out all ShingledFS internal files.
path | Path to the directory |
buf | Buffer to hold the list of files in the directory |
fill_dir | Pointer to function that will fill out the buffer |
offset | |
file_info | fuse_file_info structure from the call to opendir() |
Definition at line 210 of file fuseops.c.
References FILE_PREFIX.
int shingledfs_readlink | ( | const char * | path, |
char * | buf, | ||
size_t | size | ||
) |
Reads the target of a symbolic link.
path | Path to the symbolic link whose target is to be determined |
buf | Buffer to hold the target path |
size | Size of the buffer |
Definition at line 1320 of file fuseops.c.
References translate_path().
int shingledfs_release | ( | const char * | path, |
struct fuse_file_info * | fi | ||
) |
Closes an open file.
path | Path to the file to close |
file_info | fuse_file_info structure to store file-related data |
Definition at line 540 of file fuseops.c.
References bc_close(), and translate_path().
int shingledfs_releasedir | ( | const char * | path, |
struct fuse_file_info * | fi | ||
) |
Closes the open directory.
path | Path to the directory to close |
fi | fuse_file_info structure storing the Directory Pointer from opendir |
Definition at line 263 of file fuseops.c.
References translate_path().
int shingledfs_removexattr | ( | const char * | path, |
const char * | name | ||
) |
Removes an extended attribute.
path | Path to the file whose extended attributes are to be removed |
name | Name of the extended attribute to update |
Definition at line 1047 of file fuseops.c.
References translate_path().
int shingledfs_rename | ( | const char * | path, |
const char * | path_new | ||
) |
Renames a file.
path | Path to the file to be renamed |
path_new | Path to the renamed file |
Definition at line 571 of file fuseops.c.
References bc_generate_tmpFS_path(), bc_rename(), translate_path(), and xattr_path().
int shingledfs_rmdir | ( | const char * | path | ) |
Removes a directory.
path | Path to the directory to be removed |
Definition at line 142 of file fuseops.c.
References translate_path().
int shingledfs_setxattr | ( | const char * | path, |
const char * | name, | ||
const char * | value, | ||
size_t | size, | ||
int | flags | ||
) |
Sets the extended attributes.
path | Path to the file whose extended attribute is to be set |
name | Name of the extended attribute to update |
value | Buffer holding the value to be set for the extended attribute |
size | Size of the data in the buffer |
flags | Flags to refine operation semantics |
Definition at line 930 of file fuseops.c.
References translate_path(), and xattr_set().
int shingledfs_statfs | ( | const char * | path, |
struct statvfs * | statv | ||
) |
Returns ShingledFS file system statistics.
path | Path to any file on ShingledFS |
statv | Buffer to hold the statistics returned |
Definition at line 1415 of file fuseops.c.
References translate_path().
int shingledfs_symlink | ( | const char * | path, |
const char * | path_target | ||
) |
Creates a symbolic link.
path | Path to the symbolic link to be created |
path_target | Path to the target of the symbolic link |
Definition at line 1287 of file fuseops.c.
References translate_path().
int shingledfs_truncate | ( | const char * | path, |
off_t | offset | ||
) |
Truncates the file at the specified offset.
path | Path to the file to be truncated |
offset | Offset into the file to truncate at |
Definition at line 722 of file fuseops.c.
References translate_path(), xattr_get(), and xattr_set().
int shingledfs_unlink | ( | const char * | path | ) |
Deletes a file.
This function deletes the file and its attribute replication file, if any.
path | Path to the file to be deleted |
Definition at line 648 of file fuseops.c.
References bc_unlink(), inode_unlink(), translate_path(), xattr_get(), and xattr_path().
int shingledfs_utime | ( | const char * | path, |
struct utimbuf * | tv | ||
) |
Sets the access and/or modification times of the specified file.
path | Path to the file to create utimebuf structure containing the new timestamps |
Definition at line 1143 of file fuseops.c.
References translate_path(), xattr_get(), and xattr_set().
int shingledfs_write | ( | const char * | path, |
const char * | buf, | ||
size_t | size, | ||
off_t | offset, | ||
struct fuse_file_info * | fi | ||
) |
Write data to an open file.
If the write() fails, this function checks to see if the device is full; i.e. tmpFS is out of space. If this is the case, then
path | Path to the open file. |
buf | Buffer holding the data to be written. |
size | Size of the data to be written (in bytes). |
offset | Offset into the file where the data is to be written. |
file_info | FUSE structure created when the file was opened. |
Definition at line 464 of file fuseops.c.
References bc_clean().