*** empty log message ***
[yaffs/.git] / yaffs_fs.c
index 8ef7da78edb5a84cc0f82adad3057136727edecc..b69330557865cd3918baa1252980bc9a914718dd 100644 (file)
  * Acknowledgements:
  * * Luc van OostenRyck for numerous patches.
  * * Nick Bane for numerous patches.
+ * * Andras Toth for mknod rdev issue.
  * * Some code bodily lifted from JFFS2.
  */
 
 
+const char *yaffs_fs_c_version = "$Id: yaffs_fs.c,v 1.16 2002-09-27 20:50:50 charles Exp $";
+
 #include <linux/config.h>
 #include <linux/kernel.h>
 #include <linux/module.h>
@@ -361,7 +364,7 @@ static int yaffs_readpage_nolock(struct file *f, struct page * pg)
        yaffs_Device *dev;
        
        T((KERN_DEBUG"yaffs_readpage at %08x, size %08x\n", 
-                     pg->index << PAGE_CACHE_SHIFT, PAGE_CACHE_SIZE));
+                     (unsigned)(pg->index << PAGE_CACHE_SHIFT), (unsigned)PAGE_CACHE_SIZE));
 
        obj  = yaffs_DentryToObject(f->f_dentry);
 
@@ -431,7 +434,7 @@ static int yaffs_commit_write(struct file *f, struct page *pg, unsigned offset,
        int nWritten;
        
        unsigned spos = pos;
-       unsigned saddr = addr;
+       unsigned saddr = (unsigned)addr;
 
        T((KERN_DEBUG"yaffs_commit_write addr %x pos %x nBytes %d\n",saddr,spos,nBytes));
        
@@ -613,7 +616,7 @@ static ssize_t yaffs_file_write(struct file *f, const char *buf, size_t n, loff_
                        inode->i_size = ipos;
                        inode->i_blocks = (ipos + inode->i_blksize - 1)/ inode->i_blksize;
                        
-                       T((KERN_DEBUG"yaffs_file_write size updated to %d bytes, %d blocks\n",ipos,inode->i_blocks));
+                       T((KERN_DEBUG"yaffs_file_write size updated to %d bytes, %d blocks\n",ipos,(int)(inode->i_blocks)));
                }
                
        }
@@ -704,7 +707,7 @@ static int yaffs_readdir(struct file *f, void *dirent, filldir_t filldir)
 /*
  * File creation. Allocate an inode, and we're done..
  */
-static int yaffs_mknod(struct inode *dir, struct dentry *dentry, int mode, int dev)
+static int yaffs_mknod(struct inode *dir, struct dentry *dentry, int mode, int rdev)
 {
        struct inode *inode;
        
@@ -727,7 +730,7 @@ static int yaffs_mknod(struct inode *dir, struct dentry *dentry, int mode, int d
        }
        
        T(("yaffs_mknod: making oject for %s, mode %x dev %x\n",
-                                       dentry->d_name.name, mode,dev));
+                                       dentry->d_name.name, mode,rdev));
 
        dev = parent->myDev;
        
@@ -738,7 +741,7 @@ static int yaffs_mknod(struct inode *dir, struct dentry *dentry, int mode, int d
                default:
                        // Special (socket, fifo, device...)
                        T((KERN_DEBUG"yaffs_mknod: making special\n"));
-                       obj = yaffs_MknodSpecial(parent,dentry->d_name.name,mode,current->uid, current->gid,dev);
+                       obj = yaffs_MknodSpecial(parent,dentry->d_name.name,mode,current->uid, current->gid,rdev);
                        break;
                case S_IFREG:   // file         
                        T((KERN_DEBUG"yaffs_mknod: making file\n"));
@@ -756,7 +759,7 @@ static int yaffs_mknod(struct inode *dir, struct dentry *dentry, int mode, int d
        
        if(obj)
        {
-               inode = yaffs_get_inode(dir->i_sb, mode, dev, obj);
+               inode = yaffs_get_inode(dir->i_sb, mode, rdev, obj);
                d_instantiate(dentry, inode);
                T((KERN_DEBUG"yaffs_mknod created object %d count = %d\n",obj->objectId,atomic_read(&inode->i_count)));
                error = 0;
@@ -802,13 +805,12 @@ static int yaffs_unlink(struct inode * dir, struct dentry *dentry)
        yaffs_Device *dev;
        
        
-       T((KERN_DEBUG"yaffs_unlink %d:%s\n",dir->i_ino,dentry->d_name.name));
+       T((KERN_DEBUG"yaffs_unlink %d:%s\n",(int)(dir->i_ino),dentry->d_name.name));
        
        dev = yaffs_InodeToObject(dir)->myDev;
        
        yaffs_GrossLock(dev);
        
-       nlinks = 
        
        retVal = yaffs_Unlink(yaffs_InodeToObject(dir),dentry->d_name.name);
        
@@ -930,6 +932,7 @@ static int yaffs_rename(struct inode * old_dir, struct dentry *old_dentry, struc
 
        yaffs_GrossLock(dev);
        
+       
        retVal =  yaffs_RenameObject(yaffs_InodeToObject(old_dir),old_dentry->d_name.name,
                                         yaffs_InodeToObject(new_dir),new_dentry->d_name.name);
        yaffs_GrossUnlock(dev);
@@ -1083,7 +1086,7 @@ static struct super_block *yaffs_internal_read_super(int useRam, struct super_bl
        sb->s_blocksize = PAGE_CACHE_SIZE;
        sb->s_blocksize_bits = PAGE_CACHE_SHIFT;
 #endif
-       T(("yaffs_read_super: %s block size %d\n", useRam ? "RAM" : "MTD",sb->s_blocksize));
+       T(("yaffs_read_super: %s block size %d\n", useRam ? "RAM" : "MTD",(int)(sb->s_blocksize)));
 
 #ifdef CONFIG_YAFFS_DISABLE_WRITE_VERIFY
        T(("yaffs: Write verification disabled. All guarantees null and void\n");
@@ -1144,13 +1147,13 @@ static struct super_block *yaffs_internal_read_super(int useRam, struct super_bl
                        return NULL;
                }
 
-               printk(KERN_DEBUG" erase %x\n",mtd->erase);
-               printk(KERN_DEBUG" read %x\n",mtd->read);
-               printk(KERN_DEBUG" write %x\n",mtd->write);
-               printk(KERN_DEBUG" readoob %x\n",mtd->read_oob);
-               printk(KERN_DEBUG" writeoob %x\n",mtd->write_oob);
-               printk(KERN_DEBUG" oobblock %x\n",mtd->oobblock);
-               printk(KERN_DEBUG" oobsize %x\n",mtd->oobsize);
+               //printk(KERN_DEBUG" erase %x\n",mtd->erase);
+               //printk(KERN_DEBUG" read %x\n",mtd->read);
+               //printk(KERN_DEBUG" write %x\n",mtd->write);
+               //printk(KERN_DEBUG" readoob %x\n",mtd->read_oob);
+               //printk(KERN_DEBUG" writeoob %x\n",mtd->write_oob);
+               //printk(KERN_DEBUG" oobblock %x\n",mtd->oobblock);
+               //printk(KERN_DEBUG" oobsize %x\n",mtd->oobsize);
 
 
                if(!mtd->erase ||
@@ -1281,6 +1284,10 @@ static char * yaffs_dump_dev(char *buf,yaffs_Device *dev,char *name)
        buf +=sprintf(buf,"garbageCollections. %d\n",dev->garbageCollections);
        buf +=sprintf(buf,"nRetriedWrites..... %d\n",dev->nRetriedWrites);
        buf +=sprintf(buf,"nRetireBlocks...... %d\n",dev->nRetiredBlocks);
+       buf +=sprintf(buf,"eccFixed........... %d\n",dev->eccFixed);
+       buf +=sprintf(buf,"eccUnfixed......... %d\n",dev->eccUnfixed);
+       buf +=sprintf(buf,"tagsEccFixed....... %d\n",dev->tagsEccFixed);
+       buf +=sprintf(buf,"tagsEccUnfixed..... %d\n",dev->tagsEccUnfixed);
        buf +=sprintf(buf,"cacheHits.......... %d\n",dev->cacheHits);
        buf +=sprintf(buf,"nDeletedFiles...... %d\n",dev->nDeletedFiles);
        buf +=sprintf(buf,"nUnlinkedFiles..... %d\n",dev->nUnlinkedFiles);
@@ -1357,7 +1364,7 @@ static int __init init_yaffs_fs(void)
     }
 
 #ifdef CONFIG_YAFFS_RAM_ENABLED
-
+#if 0
     my_proc_ram_write_entry = create_proc_entry("yaffs_ram",
                                            S_IRUGO | S_IFREG,
                                           &proc_root);
@@ -1370,6 +1377,8 @@ static int __init init_yaffs_fs(void)
     {
        my_proc_ram_write_entry->write_proc = yaffs_proc_ram_write;
     }
+#endif
+
     error = register_filesystem(&yaffs_ram_fs_type);
     if(error)
     {