*** empty log message ***
[yaffs/.git] / yaffs_fs.c
index 637f7fd4b2940c3589a3b9f46ca5db931a39746b..418f378bf2487a69abac6037c52e419e83a4891d 100644 (file)
@@ -28,7 +28,7 @@
  */
 
 
-const char *yaffs_fs_c_version = "$Id: yaffs_fs.c,v 1.28 2003-08-20 03:53:39 charles Exp $";
+const char *yaffs_fs_c_version = "$Id: yaffs_fs.c,v 1.30 2003-09-20 01:13:48 charles Exp $";
 extern const char *yaffs_guts_c_version;
 
 
@@ -538,7 +538,7 @@ static void yaffs_FillInodeFromObject(struct inode *inode, yaffs_Object *obj)
                inode->i_ctime = obj->st_ctime;
 #endif
                inode->i_size = yaffs_GetObjectFileLength(obj);
-               inode->i_blocks = (inode->i_size + inode->i_blksize - 1) >> inode->i_sb->s_blocksize_bits;
+               inode->i_blocks = (inode->i_size + 511) >> 9;
 
                inode->i_nlink = yaffs_GetObjectLinkCount(obj);
                
@@ -680,7 +680,7 @@ static ssize_t yaffs_file_write(struct file *f, const char *buf, size_t n, loff_
                if(ipos > inode->i_size)
                {
                        inode->i_size = ipos;
-                       inode->i_blocks = (ipos + inode->i_blksize - 1)/ inode->i_blksize;
+                       inode->i_blocks = (ipos + 511)>>9;
                        
                        T(YAFFS_TRACE_OS,(KERN_DEBUG"yaffs_file_write size updated to %d bytes, %d blocks\n",ipos,(int)(inode->i_blocks)));
                }
@@ -1247,7 +1247,13 @@ static struct super_block *yaffs_internal_read_super(int useRam, struct super_bl
                printk(KERN_DEBUG "yaffs: Attempting MTD mount on %u.%u, \"%s\"\n",
                 MAJOR(sb->s_dev),MINOR(sb->s_dev),kdevname(sb->s_dev));
                        
-               // Hope it's a NAND mtd
+               // Check it's an mtd device.....
+               if(MAJOR(sb->s_dev) != MTD_BLOCK_MAJOR)
+               {
+                       return NULL; // This isn't an mtd device
+               } 
+               
+               // Get the device
                mtd = get_mtd_device(NULL, MINOR(sb->s_dev));
                if (!mtd) 
                {
@@ -1255,6 +1261,7 @@ static struct super_block *yaffs_internal_read_super(int useRam, struct super_bl
                        return NULL;
                }
                
+               // Check it's NAND
                if(mtd->type != MTD_NANDFLASH)
                {
                        printk(KERN_DEBUG "yaffs: MTD device is not NAND it's type %d\n", mtd->type);