<div>There are at least two separate cases here:</div>
<div> </div>
<div>1. device is out of space while writing an existing file. </div>
<div>
<div>This problem here is actually became worse with revision 1.32 of yaffs_fs.c that changed <strong> </strong></div></div>
<div>yaffs_commit_write routine to returns -1 (which is translated into EACESS errno) and at least is misleading. The attached patch fixes this problem while keeping desired effect of change 1.32. </div>
<div>It also fixes a problem with partially written data that actually should return the amount of data written.</div>
<div> </div>
<div>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.
</div>
<div> </div>
<div>M. </div>
<div> </div>
<div> </div>
<div> </div>
<div>--- yaffs_fs.c 2005-12-16 18:23:10.000000000 -0800<br>+++ ./new/yaffs_fs.c 2005-12-21 16:53:31.000000000 -0800<br>@@ -624,10 +624,9 @@<br> <br> T(YAFFS_TRACE_OS,<br> (KERN_DEBUG "yaffs_commit_write returning %d\n",
<br>- nWritten == nBytes ? 0 : -1));<br>-<br>- return nWritten == nBytes ? 0 : -1;<br>+ nWritten == nBytes ? 0 : nWritten));<br> <br>+ return nWritten == nBytes ? 0 : nWritten;<br> }<br> <br> static void yaffs_FillInodeFromObject(struct inode *inode, yaffs_Object * obj)
<br>@@ -785,7 +784,7 @@<br> }<br> yaffs_GrossUnlock(dev);<br> <br>- return nWritten != n ? -ENOSPC : nWritten;<br>+ return ( nWritten == n || nWritten > 0 ) ? nWritten : -ENOSPC;<br> }<br> <br> static int yaffs_readdir(struct file *f, void *dirent, filldir_t filldir)
<br> </div>