This is the mail archive of the mailing list for the eCos project.

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: FAT FS enhancements

Andrew Lunn wrote:

Great. I've made a few minor changes:

cyg/fs/fat/fatfs.h -> cyg/fs/fat.h

That was the directory you had told me to put it in. I did not think that was correct. Just following directions.

Check the email archive:

Ok, I cannot read. Yes you were correct. However the reason I picked that path is I thought that was what my email said. My bad.

You did not change fileio1.c test-case to match this change.

OK. missed that, i will apply your fix. Strange thing was i ran the test case and did not see an obvious failure. [ Goes and runs the test again]. Nope, the test does not fail! Could you see if you can find out why it does not fail? I will hold off applying the fix until it does fail.


I think I know what the problem is. the file system functions do not actually return their error codes. They return -1, and set errno. EPERM happens to be 1, which when I first ran this, I assumed that it was just a sign problems, and reversed my signs in the checks. Attached is an attempt at a patch. However, I still can't get my home target to access the HD, so I cannot test it. I can test it on Monday and give you the results.


Index: fs/fat/current/ChangeLog
RCS file: /cvs/ecos/ecos/packages/fs/fat/current/ChangeLog,v
retrieving revision 1.4
diff -u -5 -w -r1.4 ChangeLog
--- fs/fat/current/ChangeLog	22 Oct 2004 14:10:21 -0000	1.4
+++ fs/fat/current/ChangeLog	23 Oct 2004 23:22:31 -0000
@@ -1,5 +1,9 @@
+2004-10-23  David Brennan  <>
+	* tests/fileio1.c: fixed check for return value for attribute tests.
 2004-10-17  David Brennan  <>
 	* src/fatfs.c:
 	* src/fatfs_supp.c:
 	* include/fatfs.h (NEW):
Index: fs/fat/current/tests/fileio1.c
RCS file: /cvs/ecos/ecos/packages/fs/fat/current/tests/fileio1.c,v
retrieving revision 1.3
diff -u -5 -w -r1.3 fileio1.c
--- fs/fat/current/tests/fileio1.c	22 Oct 2004 14:10:23 -0000	1.3
+++ fs/fat/current/tests/fileio1.c	23 Oct 2004 23:22:31 -0000
@@ -698,22 +698,22 @@
     checkattrib( "/foo", S_FATFS_RDONLY );
     // Verify we cannot unlink a read-only file
     diag_printf("<INFO>: unlink /foo\n");
     err = unlink( "/foo" );
-    if( err != -EPERM ) SHOW_RESULT( unlink, err );
+    if( (err != -1) || (errno != EPERM) ) SHOW_RESULT( unlink, err );
     // Verify we cannot rename a read-only file
     diag_printf("<INFO>: rename /foo bundy\n");
     err = rename( "/foo", "bundy" );
-    if( err != -EPERM ) SHOW_RESULT( rename, err );
+    if( (err != -1) || (errno != EPERM) ) SHOW_RESULT( rename, err );
     // Verify we cannot open read-only file for writing
     int fd;
     diag_printf("<INFO>: create file /foo\n");
     fd = open( "/foo", O_WRONLY );
-    if( err != -EPERM ) SHOW_RESULT( rename, err );
+    if( (err != -1) || (errno != EACCES) ) SHOW_RESULT( open, err );
     if( err > 0 ) close(fd);
     // Make it Normal
     diag_printf("<INFO>: attrib -H /foo\n");
     err = cyg_fs_set_attrib( "/foo", 0 );

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]