[Yaffs] write operation returns incorrect value in case device
is out of space
Todd Poynor
tpoynor at mvista.com
Fri Dec 23 03:54:51 GMT 2005
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?
> 2. device is out of space while creating new object. In this case
> current code returns ENOMEM error code which is also misleading.
> Unfortunatly, I do not see a simple fix here, the structure of code is
> such that it is hard to diffirenciate out-of-memory vs. out-of-space
> situation here but I think ENOSPC would be better here because it is
> more likely to happen.
>
>...
> @@ -785,7 +784,7 @@
> }
> yaffs_GrossUnlock(dev);
>
> - return nWritten != n ? -ENOSPC : nWritten;
> + return ( nWritten == n || nWritten > 0 ) ? nWritten : -ENOSPC;
Can't match the code change to the description above, how was ENOMEM
returned before?
Is a check for nWritten < 0 (-ENOMEM) appropriate? Or else ( nWritten
== n || nWritten > 0 ) can simply be nWritten > 0 .
--
Todd
More information about the yaffs
mailing list