fix last change

git-svn-id: svn://svn.code.sf.net/p/nuttx/code/trunk@235 42af7a65-404d-4744-a932-0658087f49c3
This commit is contained in:
patacongo 2007-05-20 16:38:49 +00:00
parent b22c9a9ab7
commit 36e02def6b
2 changed files with 11 additions and 13 deletions

@ -71,27 +71,22 @@ int close(int fd)
{
int ret = OK;
/* Get then nullify the operations to prohibit any other
* use of the driver while it is closing.
/* Close the driver. NOTES: (1) there is no semaphore protection
* here, the driver must be able to handle concurrent close and
* open operations. (2) The driver may have been opened numerous
* times (for different file descriptors) and must also handle
* being closed numerous times.
*/
struct file_operations *fops = inode->u.i_ops;
inode->u.i_ops = NULL;
/* At this point, there can be no other access to the underlying
* driver. We can safely close the driver as well.
*/
if (fops && fops->close)
if (inode->u.i_ops && inode->u.i_ops->close)
{
/* Perform the close operation (by the driver) */
int status = fops->close(fd);
int status = inode->u.i_ops->close(fd);
if (status < 0)
{
/* An error occurred while closing the driver */
inode->u.i_ops = fops;
*get_errno_ptr() = -status;
ret = ERROR;
}

@ -146,7 +146,10 @@ int open(const char *path, int oflags, ...)
return ERROR;
}
/* Perform the driver open operation */
/* Perform the driver open operation. NOTE that the open method may
* be called many times. The driver/mountpoint logic should handled this
* becuase it may also be closed that many times.
*/
status = OK;
if (inode->u.i_ops && inode->u.i_ops->open)