[Yaffs] write operation returns incorrect value in case device is out of space

Todd Poynor tpoynor at mvista.com
Wed Jan 4 20:02:06 GMT 2006


Mikhail Ryleev wrote:
> 
> 
> On 12/22/05, *Todd Poynor* <tpoynor at mvista.com 
> <mailto:tpoynor at mvista.com>> wrote:
> 
>     Mikhail Ryleev wrote:
> 
>      > It also fixes a problem with partially written data that actually
>     should
>      > return the amount of data written.
> 
>     May be OK, most callers will simply treat as an error, but various other
>     commit_write implementations don't do this.  What code expects a partial
>     count return?
> 
>  
> For example it is called by generic_file_write routine which is an 
> implementation of "write" call. 
> Since it is that generic, we have to be extremely careful what we return 
> here. 
> As for partial count return,  if we change the state of the file, 
> advance file pointer or change the size of the file,
> we have to let the caller know that that happened. An alternative would 
> be to completely discard changes,
> probably it is much better but far more complex.     

OK, I see generic_file_buffered_write treats zero return as "wrote all 
bytes" and does process partial write returns.  Some commit_write 
implementations don't seem to return partial write status and some 
callers treat any non-zero return as an error (and return -1), so the 
intended use is a little murky.  I'll see if Charles wants me to patch 
this.  Thanks,


-- 
Todd



More information about the yaffs mailing list