changeset 1272:548125f9b000

+ * src/romfs.c (romfs_mount): If a mount fails, make sure we leave + all state information in such a way we can try again.
author asl
date Sat, 04 Oct 2003 19:30:17 +0000
parents 8eb2d0d3c498
children ff92dea1b818
files packages/fs/rom/current/ChangeLog packages/fs/rom/current/src/romfs.c
diffstat 2 files changed, 13 insertions(+), 5 deletions(-) [+]
line wrap: on
line diff
--- a/packages/fs/rom/current/ChangeLog
+++ b/packages/fs/rom/current/ChangeLog
@@ -1,3 +1,8 @@
+2003-09-25  Oyvind Harboe <oyvind.harboe@zylin.com>
+
+	* src/romfs.c (romfs_mount): If a mount fails, make sure we leave
+	all state information in such a way we can try again.
+
 2003-07-10  Andrew Lunn  <andrew.lunn@ascom.ch>
         
 	* support/mk_romfs.c: S_I[RWX]{USR|GRP|OTH} etc changed to match
--- a/packages/fs/rom/current/src/romfs.c
+++ b/packages/fs/rom/current/src/romfs.c
@@ -588,28 +588,30 @@ static int romfs_pathconf( romfs_node *n
 
 static int romfs_mount    ( cyg_fstab_entry *fste, cyg_mtab_entry *mte )
 {
-    romfs_disk *disk;
+    romfs_disk *disk=NULL;
     
     if ( !mte->data ) {
 	// If the image address was not in the MTE data word,
 	if ( mte->devname && mte->devname[0] ) {
 	    // And there's something in the 'hardware device' field,
 	    // then read the address from there.
-	    sscanf( mte->devname, "%p", (char**)&mte->data );
+	    sscanf( mte->devname, "%p", (char**)&disk );
 	}
+    } else {
+        disk = (romfs_disk *)mte->data;
     }
 
-    if ( !mte->data ) {
+    if ( !disk ) {
 	// If still no address, try the FSTAB entry data word
 	mte->data = fste->data;
     }
 
-    if ( !mte->data ) {
+    if ( !disk ) {
 	// If still no address, give up...
 	return ENOENT;
     }
 
-    disk = (romfs_disk *)mte->data;
+
     
     // Check the ROMFS magic number to ensure that there's really an fs.
     if ( disk->magic == ROMFS_CIGAM ) {
@@ -622,6 +624,7 @@ static int romfs_mount    ( cyg_fstab_en
 
     mte->root = (cyg_dir)&disk->node[0];
     
+    mte->data = (CYG_ADDRWORD)disk;
     return ENOERR;
 }