This is the mail archive of the
ecos-discuss@sources.redhat.com
mailing list for the eCos project.
Minor patch to redboot/.../fs/disk.c
- From: "Patrick Doyle" <wpd at delcomsys dot com>
- To: "eCos" <ecos-discuss at sources dot redhat dot com>
- Date: Thu, 14 Feb 2002 13:40:00 -0500
- Subject: [ECOS] Minor patch to redboot/.../fs/disk.c
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.
--wpd
Index: packages/redboot/current/ChangeLog
===================================================================
RCS file: /cvs/ecos/ecos/packages/redboot/current/ChangeLog,v
retrieving revision 1.53
diff -r1.53 ChangeLog
0a1,6
> 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
384c384
< 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