00001 00012 #include <linux/module.h> 00013 #include <linux/ctype.h> 00014 #include <linux/parser.h> 00015 #include <linux/seq_file.h> 00016 #include <linux/slab.h> 00017 00018 #include "mountdata.h" 00019 #include "storage.h" 00020 #include "cache.h" 00021 00022 00023 00027 enum 00028 { 00029 OPT_MAX_BLOCK_SIZE, 00030 OPT_MAX_ENTRIES, 00031 OPT_ERROR 00032 }; 00033 00034 00038 static match_table_t tokens = 00039 { 00040 {OPT_MAX_BLOCK_SIZE, "max_block_size=%u"}, 00041 {OPT_MAX_ENTRIES, "max_entries=%u"}, 00042 {OPT_ERROR, NULL} 00043 }; 00044 00045 00046 00053 int mumufs_parse_opt( char * opt, 00054 struct mumu_mount_data * d ) 00055 { 00056 char * p; 00057 00058 d->max_block_size = DEFAULTMAXBLOCKSIZE; 00059 d->max_entries = DEFAULTMAXENTRIES; 00060 00061 while ( (p = strsep( &opt, "," )) != NULL ) 00062 { 00063 int token; 00064 int value; 00065 substring_t args[ MAX_OPT_ARGS ]; 00066 00067 00068 if ( !*p ) continue; 00069 00070 token = match_token( p, tokens, args ); 00071 switch ( token ) 00072 { 00073 case OPT_MAX_BLOCK_SIZE: 00074 if ( match_int( &args[0], &value ) ) return 0; 00075 d->max_block_size = value; 00076 break; 00077 00078 case OPT_MAX_ENTRIES: 00079 if ( match_int( &args[0], &value ) ) return 0; 00080 d->max_entries = value; 00081 break; 00082 00083 default: 00084 return 0; 00085 } 00086 } 00087 00088 return 1; 00089 } 00090 00091 00092 00099 int mumufs_show_options( struct seq_file * m, 00100 struct vfsmount * mnt ) 00101 { 00102 struct mumu_mount_data * d = (struct mumu_mount_data *)( mnt->mnt_sb->s_fs_info ); 00103 00104 seq_printf( m, ",max_block_size=%u", d->max_block_size ); 00105 seq_printf( m, ",max_entries=%u", d->max_entries ); 00106 00107 return 0; 00108 } 00109 00110 00111 00112 00118 int mumufs_init_mount_data( struct mumu_mount_data * d ) 00119 { 00120 d->mount = NULL; 00121 atomic_set( & d->number_of_entries, 0 ); 00122 return 0; 00123 } 00124 00125 00126 00132 int mumufs_umount_cleanup( struct super_block * sb ) 00133 { 00134 struct mumu_mount_data * d = (struct mumu_mount_data *)( sb->s_fs_info ); 00135 00136 d->mount = NULL; 00137 return 0; 00138 } 00139 00140