00001
00014 #ifndef FS_H_
00015 #define FS_H_
00016
00017 #include "fsc_device.h"
00018 #include "../parser/parser.h"
00019
00020
00025 #define RKFS_MAGIC 0xabcd
00026 #define RKFS_NAME "rkfs"
00027 #define RKFS_BLOCKSIZE 4096
00028 #define RKFS_BLOCKSIZE_BITS 10
00029
00033 #define RKFS_DIRECTORY_BASE 10000
00034 #define RKFS_ROOT_INODE RKFS_DIRECTORY_BASE + 1
00035
00039 #define RKFS_DEF_QUERY_OK 0
00040
00041 #define RKFS_DEF_QUERY_ERROR -1
00042
00043
00045 #define FILE_INODE_NUMBER 2
00046
00048 #define OUT_BUF_LENGTH MAX_BUFFER_LENGTH
00049
00050
00052 #define FS_DEBUG
00053
00054
00059 #undef FSPDEBUG
00060 #ifdef FS_DEBUG
00061
00062
00063 # ifdef __KERNEL__
00064
00065 # define FSPDEBUG(fmt, args...) printk( KERN_DEBUG "RKFS: " fmt, ## args)
00066 # define FSPINFO(fmt, args...) printk( KERN_INFO "RKFS: " fmt, ## args)
00067 # define FSPRETCMD() printk(KERN_DEBUG "RKFS: ret_command=(ver:'%s', cmd:'%s', prm:'%s', dta:'%s')\n", ret_command.version, ret_command.command, ret_command.param, ret_command.data)
00068
00069
00070 # else
00071
00072 # define FSPDEBUG(fmt, args...) fprintf(stderr, fmt, ## args)
00073 # define FSPINFO(fmt, args...) fprintf(stdout, fmt, ## args)
00074 # 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)
00075
00076 # endif
00077 #else
00078
00079 # define FSPDEBUG(fmt, args...)
00080 # define FSPINFO(fmt, args...)
00081 # define FSPRETCMD()
00082
00083 #endif
00084
00091 extern int rkfs_get_sb (struct file_system_type *fs_type, int flags, const char *devname,
00092 void *data, struct vfsmount *mnt);
00093 extern void rkfs_kill_sb(struct super_block *);
00094 extern void rkfs_super_read_inode(struct inode *inode);
00095 extern int rkfs_super_write_inode(struct inode *inode, int sync);
00096 extern void rkfs_super_delete_inode(struct inode *);
00097 extern struct dentry *rkfs_inode_lookup(struct inode *parent_inode, struct dentry *dentry,
00098 struct nameidata *);
00099 extern int rkfs_inode_create(struct inode *, struct dentry *, int mode,
00100 struct nameidata *);
00101 extern void rkfs_inode_truncate (struct inode * inode);
00102 extern int rkfs_inode_unlink (struct inode *,struct dentry *);
00103 extern int rkfs_inode_rename(struct inode * , struct dentry *, struct inode * , struct dentry *);
00104
00105
00114 extern int rkfs_file_open (struct inode *, struct file *);
00115 extern int rkfs_file_readdir(struct file *file, void *dirent, filldir_t filldir);
00116 extern int rkfs_file_release (struct inode *, struct file *);
00117 extern ssize_t rkfs_file_read(struct file *, char __user *, size_t, loff_t *);
00118 extern ssize_t rkfs_file_write(struct file *, const char __user *, size_t, loff_t *);
00119 extern loff_t rkfs_file_llseek (struct file * , loff_t , int );
00128 extern int rkfs_mkdir(struct inode *, struct dentry *, int);
00129 extern int rkfs_rmdir(struct inode *, struct dentry *);
00138 int rkfs_next_data_item(char **, char *);
00139 int rkfs_atoi(char*);
00147 extern struct super_operations rkfs_sops;
00148 extern struct inode_operations rkfs_iops;
00149 extern struct file_operations rkfs_fops;
00150 extern struct file_operations rkfs_dops;
00151 extern struct file_system_type rkfs;
00152 extern struct address_space_operations rkfs_aops;
00160 int query(const char* command, int command_lenght);
00161 void rkfs_deamon_test(void);
00162 int rkfs_next_data_item(char **com_data_pos, char *ret_buf);
00163 int rkfs_atoi(char* str);
00164 extern int result;
00165 extern struct_command ret_command;
00166 extern char out_buf[OUT_BUF_LENGTH];
00170 #endif
00171
00172