declaration of structures used by VFS | |
super_operations | rkfs_sops |
inode_operations | rkfs_iops |
file_operations | rkfs_fops |
file_operations | rkfs_dops |
file_system_type | rkfs |
address_space_operations | rkfs_aops |
different variables use by MySQLFS | |
int | result |
struct_command | ret_command |
char | out_buf [OUT_BUF_LENGTH] |
int | query (const char *command, int command_lenght) |
Function to send message to deamon. | |
void | rkfs_deamon_test (void) |
Function for testing deamon. | |
declaration of functions defines in fs_inode.c | |
| |
int | rkfs_get_sb (struct file_system_type *fs_type, int flags, const char *devname, void *data, struct vfsmount *mnt) |
Function to get super block. | |
void | rkfs_kill_sb (struct super_block *) |
Kill super block. | |
void | rkfs_super_read_inode (struct inode *inode) |
Super read inode. | |
int | rkfs_super_write_inode (struct inode *inode, int sync) |
Super write inode. | |
void | rkfs_super_delete_inode (struct inode *) |
Delete inode. | |
dentry * | rkfs_inode_lookup (struct inode *parent_inode, struct dentry *dentry, struct nameidata *) |
Inode lookup. | |
int | rkfs_inode_create (struct inode *, struct dentry *, int mode, struct nameidata *) |
Inode create. | |
void | rkfs_inode_truncate (struct inode *inode) |
Truncate inode. | |
int | rkfs_inode_unlink (struct inode *, struct dentry *) |
Inode unlink. | |
int | rkfs_inode_rename (struct inode *, struct dentry *, struct inode *, struct dentry *) |
Remame. | |
declaration of functions defines in fs_file.c | |
| |
int | rkfs_file_open (struct inode *, struct file *) |
Function for open file. | |
int | rkfs_file_readdir (struct file *file, void *dirent, filldir_t filldir) |
Read dir. | |
int | rkfs_file_release (struct inode *, struct file *) |
Function for release file. | |
ssize_t | rkfs_file_read (struct file *, char __user *, size_t, loff_t *) |
Function for read from file. | |
ssize_t | rkfs_file_write (struct file *, const char __user *, size_t, loff_t *) |
Function for write to file. | |
loff_t | rkfs_file_llseek (struct file *, loff_t, int) |
Lseek. | |
declaration of functions defines in fs_dir.c | |
| |
int | rkfs_mkdir (struct inode *, struct dentry *, int) |
Function for make new directory. | |
int | rkfs_rmdir (struct inode *, struct dentry *) |
Function for remove directory. | |
declaration of functions defines in fs_lib.c | |
| |
int | rkfs_next_data_item (char **, char *) |
Read next data item from a answer received from a deamon. | |
int | rkfs_atoi (char *) |
Atoi function. | |
File system constants | |
#define | RKFS_MAGIC 0xabcd |
#define | RKFS_NAME "rkfs" |
#define | RKFS_BLOCKSIZE 4096 |
#define | RKFS_BLOCKSIZE_BITS 10 |
#define | RKFS_DIRECTORY_BASE 10000 |
#define | RKFS_ROOT_INODE RKFS_DIRECTORY_BASE + 1 |
Macros to help debugging | |
#define | FSPDEBUG(fmt, args...) fprintf(stderr, fmt, ## args) |
#define | FSPINFO(fmt, args...) fprintf(stdout, fmt, ## args) |
#define | FSPRETCMD() fprintf (stderr, "RKFS: ret_command=(ver:'%s', cmd:'%s', prm:'%s', dta:'%s')\n", ret_command.version, ret_command.command, ret_command.param, ret_command.data) |
Defines | |
#define | RKFS_DEF_QUERY_OK 0 |
#define | RKFS_DEF_QUERY_ERROR -1 |
#define | FILE_INODE_NUMBER 2 |
#define | OUT_BUF_LENGTH MAX_BUFFER_LENGTH |
#define | FS_DEBUG |
#define FILE_INODE_NUMBER 2 |
#define FS_DEBUG |
#define OUT_BUF_LENGTH MAX_BUFFER_LENGTH |
#define RKFS_DEF_QUERY_ERROR -1 |
#define RKFS_DEF_QUERY_OK 0 |
query return constant OK
Definition at line 39 of file rkfs.h.
Referenced by query(), rkfs_file_read(), rkfs_file_write(), rkfs_inode_create(), rkfs_inode_lookup(), rkfs_inode_rename(), rkfs_inode_truncate(), rkfs_inode_unlink(), rkfs_mkdir(), rkfs_rmdir(), and rkfs_super_read_inode().
#define RKFS_DIRECTORY_BASE 10000 |
int query | ( | const char * | command, | |
int | command_length | |||
) |
Function to send message to deamon.
Send message to deamon, accept answer message and parse it.
command | command to be executed by deamon | |
command_length | length of command without trailing zero |
Definition at line 185 of file fs_main.c.
References fsc_query(), FSPDEBUG, out_buf, OUT_BUF_LENGTH, parse_message(), result, ret_command, RKFS_DEF_QUERY_ERROR, and RKFS_DEF_QUERY_OK.
Referenced by fsd_add_block(), fsd_clear_file(), fsd_create(), fsd_dir_exists(), fsd_dir_info(), fsd_dir_name_exists(), fsd_file_exists(), fsd_file_info(), fsd_file_name_exists(), fsd_get_block(), fsd_lookup(), fsd_mkdir(), fsd_move_file(), fsd_read_dir(), fsd_read_inode(), fsd_remove_dir(), fsd_remove_file(), fsd_rename_dir(), fsd_rename_file(), fsd_replace_block(), fsd_truncate_file(), rkfs_deamon_test(), rkfs_file_read(), rkfs_file_readdir(), rkfs_file_write(), rkfs_inode_create(), rkfs_inode_lookup(), rkfs_inode_rename(), rkfs_inode_truncate(), rkfs_inode_unlink(), rkfs_mkdir(), rkfs_rmdir(), and rkfs_super_read_inode().
int rkfs_atoi | ( | char * | str | ) |
Atoi function.
Converts string to Integer.
str | string to be converted. |
Definition at line 307 of file fs_main.c.
References result.
Referenced by rkfs_file_readdir(), rkfs_inode_create(), rkfs_inode_lookup(), rkfs_inode_rename(), rkfs_mkdir(), and rkfs_super_read_inode().
void rkfs_deamon_test | ( | void | ) |
Function for testing deamon.
Send various messages to deamon. Function is used only for testing. This time is not used at any place in the project, but we still leave it here, it can be used in future when we make some changes in deamon. This function is only for debugging purposis.
Definition at line 214 of file fs_main.c.
References query().
loff_t rkfs_file_llseek | ( | struct file * | file, | |
loff_t | offset, | |||
int | origin | |||
) |
Lseek.
Impelementation of lseek handler of VFS call ...
file | Pointer to a file structure representing file to be read from. | |
offset | Where to seek. | |
origin | Start point of seek call. |
1 OK.
Definition at line 417 of file fs_file.c.
References FSPDEBUG.
int rkfs_file_open | ( | struct inode * | inode, | |
struct file * | file | |||
) |
ssize_t rkfs_file_read | ( | struct file * | filp, | |
char __user * | buf, | |||
size_t | count, | |||
loff_t * | ppos | |||
) |
Function for read from file.
Read up to count bytes from file represented by file structure pointed by filp.
filp | Pointer to a file structure to be readen from. | |
buf | Whereto place readen data. | |
count | Maximum amount of readen bytes. | |
ppos | Position in file. |
Definition at line 65 of file fs_file.c.
References CMD_ER_NR, struct_command::command_nr, struct_command::data, FSPDEBUG, MAX_QUERY_LENGTH, query(), ret_command, RKFS_BLOCKSIZE, and RKFS_DEF_QUERY_OK.
int rkfs_file_readdir | ( | struct file * | file, | |
void * | dirent, | |||
filldir_t | filldir | |||
) |
Read dir.
Impelementation of readdir handler of VFS call ...
file | Pointer to a file structure epresenting directory to read. | |
dirent | Dirent to filled. | |
filldir | pointer to a Function for filling a dirent. |
1 OK.
Definition at line 348 of file fs_file.c.
References CMD_OK_NR, struct_command::command_nr, struct_command::data, FSPDEBUG, MAX_ID_LENGTH, MAX_NAME_LENGTH, MAX_QUERY_LENGTH, struct_command::param, query(), ret_command, rkfs_atoi(), and rkfs_next_data_item().
int rkfs_file_release | ( | struct inode * | ino, | |
struct file * | file | |||
) |
ssize_t rkfs_file_write | ( | struct file * | filp, | |
const char __user * | buf, | |||
size_t | count, | |||
loff_t * | ppos | |||
) |
Function for write to file.
Write up to count bytes from buf to file repesente by file structure poited by filp.
filp | Pointer to a to file structure. | |
buf | Buffer for incoming data. | |
count | Maximum amount of bytes to written to the file. | |
ppos | Position in the file. |
Definition at line 147 of file fs_file.c.
References CMD_ER_NR, struct_command::command_nr, struct_command::data, FSPDEBUG, MAX_QUERY_LENGTH, struct_command::param, query(), ret_command, RKFS_BLOCKSIZE, RKFS_DEF_QUERY_OK, and rkfs_inode_truncate().
int rkfs_get_sb | ( | struct file_system_type * | fs_type, | |
int | flags, | |||
const char * | devname, | |||
void * | data, | |||
struct vfsmount * | mnt | |||
) |
Function to get super block.
Get super block
fs_type | Type of fs to ne mounted. | |
flags | Flags. | |
devname | Name of device to be mounted. | |
data | Ignored. | |
mnt |
Definition at line 165 of file fs_inode.c.
int rkfs_inode_create | ( | struct inode * | dir, | |
struct dentry * | dirdentry, | |||
int | mode, | |||
struct nameidata * | nd | |||
) |
Inode create.
Creates an inode.
dir | Where to create an inode. | |
dirdentry | Information about newly created item. | |
mode | Mode of inode. | |
nd | Ignored. |
Definition at line 400 of file fs_inode.c.
References CMD_ER_NR, struct_command::command_nr, FSPDEBUG, MAX_QUERY_LENGTH, struct_command::param, query(), ret_command, rkfs_atoi(), RKFS_DEF_QUERY_OK, rkfs_fops, and rkfs_iops.
struct dentry* rkfs_inode_lookup | ( | struct inode * | parent_inode, | |
struct dentry * | dentry, | |||
struct nameidata * | nameidata | |||
) |
Inode lookup.
Inode lookup.
parent_inode | Inode of parent Inode, where we try to find entry. | |
dentry | Dentry to look for. | |
nameidata | Ignored. |
Error.
Definition at line 350 of file fs_inode.c.
References CMD_ER_NR, struct_command::command_nr, struct_command::data, FSPDEBUG, MAX_ID_LENGTH, MAX_QUERY_LENGTH, query(), ret_command, rkfs_atoi(), RKFS_DEF_QUERY_OK, and rkfs_next_data_item().
int rkfs_inode_rename | ( | struct inode * | old_dir, | |
struct dentry * | old_dentry, | |||
struct inode * | new_dir, | |||
struct dentry * | new_dentry | |||
) |
Remame.
Remanes directory.
old_dir | Old directory, where the renamed file is placed. | |
old_dentry | Name of item to be renamed. | |
new_dir | Inode to truncated. | |
new_dentry | Inode to truncated. |
Definition at line 537 of file fs_inode.c.
References CMD_ER_NR, struct_command::command_nr, struct_command::data, FSPDEBUG, MAX_QUERY_LENGTH, MAX_SIZE_LENGTH, struct_command::param, query(), ret_command, rkfs_atoi(), RKFS_DEF_QUERY_OK, and rkfs_next_data_item().
void rkfs_inode_truncate | ( | struct inode * | inode | ) |
Truncate inode.
Truncates an inode.
inode | Inode to truncated. |
Definition at line 486 of file fs_inode.c.
References CMD_ER_NR, struct_command::command_nr, FSPDEBUG, MAX_QUERY_LENGTH, query(), ret_command, and RKFS_DEF_QUERY_OK.
Referenced by rkfs_file_write().
int rkfs_inode_unlink | ( | struct inode * | dir, | |
struct dentry * | dentry | |||
) |
Inode unlink.
Unlink the inode. Superblock operation.
dir | Where to find unlinked file. | |
dentry | Directory entry to be unlinked. |
Definition at line 298 of file fs_inode.c.
References CMD_ER_NR, struct_command::command_nr, FSPDEBUG, MAX_QUERY_LENGTH, query(), ret_command, and RKFS_DEF_QUERY_OK.
void rkfs_kill_sb | ( | struct super_block * | super | ) |
Kill super block.
Kill super the superblock.
super | Super block to be killed. |
Definition at line 194 of file fs_inode.c.
References FSPDEBUG.
int rkfs_mkdir | ( | struct inode * | dir, | |
struct dentry * | dentry, | |||
int | mode | |||
) |
Function for make new directory.
Create new directory in parent directory specified by dir parametr
dir | Directory, where new dir should be created. | |
dentry | Dentry representing name of directory, which should be created. | |
mode | Mode of new directory. |
Definition at line 64 of file fs_dir.c.
References CMD_ER_NR, struct_command::command_nr, MAX_QUERY_LENGTH, struct_command::param, query(), ret_command, rkfs_atoi(), RKFS_DEF_QUERY_OK, rkfs_dops, and rkfs_iops.
int rkfs_next_data_item | ( | char ** | com_data_pos, | |
char * | ret_buf | |||
) |
Read next data item from a answer received from a deamon.
Message used for parsing data from message.
com_data_pos | Position where we stop parcing last time. | |
ret_buf | buffer for returned item |
Definition at line 281 of file fs_main.c.
Referenced by rkfs_file_readdir(), rkfs_inode_lookup(), rkfs_inode_rename(), and rkfs_super_read_inode().
int rkfs_rmdir | ( | struct inode * | dir, | |
struct dentry * | dentry | |||
) |
Function for remove directory.
Remove directory specified in dentry
dir | Dir from which should be dir removed. | |
dentry | Dentry representing name of directory, which should be removed. |
Definition at line 124 of file fs_dir.c.
References CMD_ER_NR, struct_command::command_nr, FSPDEBUG, MAX_QUERY_LENGTH, query(), ret_command, and RKFS_DEF_QUERY_OK.
void rkfs_super_delete_inode | ( | struct inode * | inode | ) |
Delete inode.
Deletes an inode.
inode | Pointer to inode structure to be deleted. |
Definition at line 332 of file fs_inode.c.
References FSPDEBUG.
void rkfs_super_read_inode | ( | struct inode * | inode | ) |
Super read inode.
Reads inode inode. Super block operation.
inode | Pointer to inode structure to be readen to. |
Definition at line 208 of file fs_inode.c.
References CMD_ER_NR, struct_command::command_nr, struct_command::data, FSPDEBUG, FSPRETCMD, MAX_QUERY_LENGTH, MAX_SIZE_LENGTH, struct_command::param, query(), ret_command, rkfs_atoi(), RKFS_DEF_QUERY_OK, rkfs_dops, rkfs_fops, rkfs_iops, and rkfs_next_data_item().
int rkfs_super_write_inode | ( | struct inode * | inode, | |
int | wait | |||
) |
Super write inode.
Super write inode, fuction is not used.
inode | Inode to be written. | |
wait | Ignored. |
Definition at line 281 of file fs_inode.c.
References FSPDEBUG.
char out_buf[OUT_BUF_LENGTH] |
int result |
variable for storing result form function query
Definition at line 161 of file fs_main.c.
Referenced by __fsc_query__(), fsc_query(), fsd_chardevice_read(), fsd_chardevice_write(), main(), query(), rkfs_atoi(), and rkfs_get_sb().
structure for storing parsed command
Definition at line 164 of file fs_main.c.
Referenced by query(), rkfs_file_read(), rkfs_file_readdir(), rkfs_file_write(), rkfs_inode_create(), rkfs_inode_lookup(), rkfs_inode_rename(), rkfs_inode_truncate(), rkfs_inode_unlink(), rkfs_mkdir(), rkfs_rmdir(), and rkfs_super_read_inode().
struct file_system_type rkfs |
struct file_operations rkfs_dops |
dir operations structure
Definition at line 46 of file fs_dir.c.
Referenced by rkfs_mkdir(), and rkfs_super_read_inode().
struct file_operations rkfs_fops |
file operations structure
Definition at line 42 of file fs_file.c.
Referenced by rkfs_inode_create(), and rkfs_super_read_inode().
struct inode_operations rkfs_iops |
inode operations structure
Definition at line 56 of file fs_inode.c.
Referenced by rkfs_inode_create(), rkfs_mkdir(), and rkfs_super_read_inode().
struct super_operations rkfs_sops |
super block operations structure
Definition at line 47 of file fs_inode.c.