X-Git-Url: https://yaffs.net/gitweb/?a=blobdiff_plain;f=yaffs_fs.c;h=e572301f5d1956a3b81970bb4f3bf7a07e52f26c;hb=b01cbe54d4bb2d6c64c94ab987884bb1e117b36b;hp=15c27832ef4f233db22e3f97470610522bdacb8c;hpb=b0b91352fff81d01d34fd562629ce199c255cdd6;p=yaffs2.git diff --git a/yaffs_fs.c b/yaffs_fs.c index 15c2783..e572301 100644 --- a/yaffs_fs.c +++ b/yaffs_fs.c @@ -32,7 +32,7 @@ */ const char *yaffs_fs_c_version = - "$Id: yaffs_fs.c,v 1.60 2007-05-15 20:07:40 charles Exp $"; + "$Id: yaffs_fs.c,v 1.63 2007-09-19 20:35:40 imcd Exp $"; extern const char *yaffs_guts_c_version; #include @@ -89,13 +89,23 @@ extern const char *yaffs_guts_c_version; #include "yportenv.h" #include "yaffs_guts.h" -unsigned yaffs_traceMask = YAFFS_TRACE_BAD_BLOCKS - /* | 0xFFFFFFFF */; - #include #include "yaffs_mtdif.h" +#include "yaffs_mtdif1.h" #include "yaffs_mtdif2.h" +unsigned int yaffs_traceMask = YAFFS_TRACE_BAD_BLOCKS; +unsigned int yaffs_wr_attempts = YAFFS_WR_ATTEMPTS; + +/* Module Parameters */ +#if (LINUX_VERSION_CODE > KERNEL_VERSION(2,5,0)) +module_param(yaffs_traceMask,uint,0644); +module_param(yaffs_wr_attempts,uint,0644); +#else +MODULE_PARM(yaffs_traceMask,"i"); +MODULE_PARM(yaffs_wr_attempts,"i"); +#endif + /*#define T(x) printk x */ #if (LINUX_VERSION_CODE > KERNEL_VERSION(2,6,18)) @@ -203,24 +213,45 @@ static struct address_space_operations yaffs_file_address_operations = { .commit_write = yaffs_commit_write, }; +#if (LINUX_VERSION_CODE > KERNEL_VERSION(2,6,22)) +static struct file_operations yaffs_file_operations = { + .read = do_sync_read, + .write = do_sync_write, + .aio_read = generic_file_aio_read, + .aio_write = generic_file_aio_write, + .mmap = generic_file_mmap, + .flush = yaffs_file_flush, + .fsync = yaffs_sync_object, + .splice_read = generic_file_splice_read, + .splice_write = generic_file_splice_write, +}; + +#elif (LINUX_VERSION_CODE > KERNEL_VERSION(2,6,18)) + static struct file_operations yaffs_file_operations = { -#if (LINUX_VERSION_CODE > KERNEL_VERSION(2,6,18)) .read = do_sync_read, .write = do_sync_write, .aio_read = generic_file_aio_read, .aio_write = generic_file_aio_write, + .mmap = generic_file_mmap, + .flush = yaffs_file_flush, + .fsync = yaffs_sync_object, + .sendfile = generic_file_sendfile, +}; + #else + +static struct file_operations yaffs_file_operations = { .read = generic_file_read, .write = generic_file_write, -#endif .mmap = generic_file_mmap, .flush = yaffs_file_flush, .fsync = yaffs_sync_object, #if (LINUX_VERSION_CODE > KERNEL_VERSION(2,5,0)) .sendfile = generic_file_sendfile, #endif - }; +#endif static struct inode_operations yaffs_file_inode_operations = { .setattr = yaffs_setattr, @@ -1420,6 +1451,7 @@ static void yaffs_read_inode(struct inode *inode) static LIST_HEAD(yaffs_dev_list); +#if 0 // not used static int yaffs_remount_fs(struct super_block *sb, int *flags, char *data) { yaffs_Device *dev = yaffs_SuperToDevice(sb); @@ -1448,6 +1480,7 @@ static int yaffs_remount_fs(struct super_block *sb, int *flags, char *data) return 0; } +#endif static void yaffs_put_super(struct super_block *sb) { @@ -1778,8 +1811,18 @@ static struct super_block *yaffs_internal_read_super(int yaffsVersion, dev->startBlock = 0; dev->endBlock = nBlocks - 1; } else { +#if (LINUX_VERSION_CODE > KERNEL_VERSION(2,6,17)) + /* use the MTD interface in yaffs_mtdif1.c */ + dev->writeChunkWithTagsToNAND = + nandmtd1_WriteChunkWithTagsToNAND; + dev->readChunkWithTagsFromNAND = + nandmtd1_ReadChunkWithTagsFromNAND; + dev->markNANDBlockBad = nandmtd1_MarkNANDBlockBad; + dev->queryNANDBlock = nandmtd1_QueryNANDBlock; +#else dev->writeChunkToNAND = nandmtd_WriteChunkToNAND; dev->readChunkFromNAND = nandmtd_ReadChunkFromNAND; +#endif dev->isYaffs2 = 0; } /* ... and common functions */ @@ -2075,7 +2118,7 @@ static int yaffs_proc_write(struct file *file, const char *buf, unsigned rg = 0, mask_bitfield; char *end; char *mask_name; - char *x; + const char *x; char substring[MAX_MASK_NAME_LENGTH+1]; int i; int done = 0; @@ -2108,6 +2151,7 @@ static int yaffs_proc_write(struct file *file, const char *buf, if (end > buf + pos) { mask_name = "numeral"; len = end - (buf + pos); + pos += len; done = 0; } else { for(x = buf + pos, i = 0; @@ -2117,8 +2161,6 @@ static int yaffs_proc_write(struct file *file, const char *buf, substring[i] = '\0'; for (i = 0; mask_flags[i].mask_name != NULL; i++) { - //len = strlen(mask_flags[i].mask_name); - //if (strncmp(buf + pos, mask_flags[i].mask_name, len) == 0) { if(strcmp(substring,mask_flags[i].mask_name) == 0){ mask_name = mask_flags[i].mask_name; mask_bitfield = mask_flags[i].mask_bitfield; @@ -2129,7 +2171,6 @@ static int yaffs_proc_write(struct file *file, const char *buf, } if (mask_name != NULL) { - // pos += len; done = 0; switch(add) { case '-':