*** empty log message ***
authorcharles <charles>
Wed, 19 Feb 2003 00:29:54 +0000 (00:29 +0000)
committercharles <charles>
Wed, 19 Feb 2003 00:29:54 +0000 (00:29 +0000)
direct/dtest.c
direct/yaffscfg.c
direct/yaffsfs.c
yaffsdev.proj

index 7f6963823aebe1aa1540fe8b3a809fa0d58e682f..965d808e113b8b1425ca2e6cd89a36133d07e05b 100644 (file)
@@ -286,6 +286,7 @@ int main(int argc, char *argv[])
        yaffs_mount("/boot");
        yaffs_mount("/data");
        yaffs_mount("/flash");
+       yaffs_mount("/ram");
        
        printf("\nDirectory look-up of /boot\n");
        dumpDir("/boot");
@@ -294,14 +295,17 @@ int main(int argc, char *argv[])
        printf("\nDirectory look-up of /flash\n");
        dumpDir("/flash");
 
-       leave_unlinked_file("/flash",20000,0);
-       leave_unlinked_file("/data",20000,0);
+       //leave_unlinked_file("/flash",20000,0);
+       //leave_unlinked_file("/data",20000,0);
+       
+       leave_unlinked_file("/ram",20,0);
+       
 
        f = yaffs_open("/boot/b1", O_RDONLY,0);
        
        printf("open /boot/b1 readonly, f=%d\n",f);
        
-       f = yaffs_open("/boot/b1", O_CREAT,0);
+       f = yaffs_open("/boot/b1", O_CREAT,S_IREAD | S_IWRITE);
        
        printf("open /boot/b1 O_CREAT, f=%d\n",f);
        
@@ -323,12 +327,12 @@ int main(int argc, char *argv[])
        r = yaffs_write(f,"world",3);
        printf("write %d attempted to write to a writeable file\n",r);
        
-       r= yaffs_lseek(f,SEEK_END,0);
+       r= yaffs_lseek(f,0,SEEK_END);
        printf("seek end %d\n",r);
        memset(buffer,0,20);
        r = yaffs_read(f,buffer,10);
        printf("read %d \"%s\"\n",r,buffer);
-       r= yaffs_lseek(f,SEEK_SET,0);
+       r= yaffs_lseek(f,0,SEEK_SET);
        printf("seek set %d\n",r);
        memset(buffer,0,20);
        r = yaffs_read(f,buffer,10);
@@ -336,7 +340,16 @@ int main(int argc, char *argv[])
        memset(buffer,0,20);
        r = yaffs_read(f,buffer,10);
        printf("read %d \"%s\"\n",r,buffer);
-       
+
+       // Check values reading at end.
+       // A read past end of file should return 0 for 0 bytes read.
+               
+       r= yaffs_lseek(f,0,SEEK_END);
+       r = yaffs_read(f,buffer,10);
+       printf("read at end returned  %d\n",r); 
+       r= yaffs_lseek(f,500,SEEK_END);
+       r = yaffs_read(f,buffer,10);
+       printf("read past end returned  %d\n",r);       
        
        r = yaffs_close(f);
        
index 466b381135a64051553b9a5e19a7e8be27175a09..83f22775837e281f440c460da9bf0d16535a86a3 100644 (file)
@@ -73,7 +73,7 @@ int yaffs_StartUp(void)
        // /ram
        ramDev.nBytesPerChunk = YAFFS_BYTES_PER_CHUNK;
        ramDev.nChunksPerBlock = YAFFS_CHUNKS_PER_BLOCK;
-       ramDev.nReservedBlocks = 1; // Set this smaller for RAM
+       ramDev.nReservedBlocks = 2; // Set this smaller for RAM
        ramDev.startBlock = 1; // Can't use block 0
        ramDev.endBlock = 127; // Last block in 2MB.    
        ramDev.useNANDECC = 1;
index 8f2f06e82ff7f0cefc71a645fa3a21ee84d528ca..6fc0c8263f40f1992907995e94a1b2fe16e19d36 100644 (file)
@@ -25,7 +25,7 @@
 #endif
 
 
-const char *yaffsfs_c_version="$Id: yaffsfs.c,v 1.2 2003-01-31 00:57:35 charles Exp $";
+const char *yaffsfs_c_version="$Id: yaffsfs.c,v 1.3 2003-02-19 00:29:55 charles Exp $";
 
 // configurationList is the list of devices that are supported
 static yaffsfs_DeviceConfiguration *yaffsfs_configurationList;
@@ -546,7 +546,7 @@ int yaffs_read(int fd, void *buf, unsigned int nbyte)
                }
                else
                {
-                       //todo error
+                       nRead = 0;
                }
                
        }
index fa40e294daa7c7730fda1cf8e35ce49bf0e8c1f3..968816228bc6f770e3d929d6d03b7e6ee04d691d 100644 (file)
Binary files a/yaffsdev.proj and b/yaffsdev.proj differ