[ECOS] Minor patch to redboot/.../fs/disk.c

Patrick Doyle wpd@delcomsys.com
Thu Feb 14 10:41:00 GMT 2002

I was playing with RedBoot (x86 on a PC) a couple of days ago and noticed
that I could not load the simple "hello" example from the hard disk on my
PC.  I decided this was a little curious, poked around, and found out that I
could not load S-record file nor the binary file.  I eventually tracked the
problem down to the fact that the load process was truncating the last part
of the file as it read it in from disk.  Appended is a patch to fix this.

Basically, 'disk_stream_read()' was returning an error code if it was unable
to read the entire block requested.  I changed this so that it returns an
error code only when the file system returns an error code, otherwise, it
returns the number of bytes read.


Index: packages/redboot/current/ChangeLog
RCS file: /cvs/ecos/ecos/packages/redboot/current/ChangeLog,v
retrieving revision 1.53
diff -r1.53 ChangeLog
> 2002-02-14  Patrick Doyle  <wpd@delcomsys.com>
> 	* src/fs/disk.c (disk_stream_read): Modified to return the number
> 	of bytes read instead of -1 when such number is less than was
> 	requested.
Index: packages/redboot/current/src/fs/disk.c
RCS file: /cvs/ecos/ecos/packages/redboot/current/src/fs/disk.c,v
retrieving revision 1.6
diff -r1.6 disk.c
<     if ((nread = (file_part->funs->read)(fileptr, buf, size)) != size) {
>     if ((nread = (file_part->funs->read)(fileptr, buf, size)) < 0) {

Before posting, please read the FAQ: http://sources.redhat.com/fom/ecos
and search the list archive: http://sources.redhat.com/ml/ecos-discuss

More information about the Ecos-discuss mailing list