fs: Remove the unused nx_dup to prefer file_dup for kernel

Signed-off-by: Xiang Xiao <xiaoxiang@xiaomi.com>
This commit is contained in:
Xiang Xiao 2022-10-26 17:28:39 +08:00 committed by Petro Karashchenko
parent cf21319d3a
commit b22cc1e2b8
2 changed files with 19 additions and 57 deletions

View File

@ -77,42 +77,6 @@ int file_dup(FAR struct file *filep, int minfd)
return fd2;
}
/****************************************************************************
* Name: nx_dup
*
* Description:
* nx_dup() is similar to the standard 'dup' interface except that is
* not a cancellation point and it does not modify the errno variable.
*
* nx_dup() is an internal NuttX interface and should not be called from
* applications.
*
* Returned Value:
* The new file descriptor is returned on success; a negated errno value is
* returned on any failure.
*
****************************************************************************/
int nx_dup(int fd)
{
FAR struct file *filep;
int ret;
/* Get the file structure corresponding to the file descriptor. */
ret = fs_getfilep(fd, &filep);
if (ret < 0)
{
return ret;
}
DEBUGASSERT(filep != NULL);
/* Let file_dup() do the real work */
return file_dup(filep, 0);
}
/****************************************************************************
* Name: dup
*
@ -123,14 +87,30 @@ int nx_dup(int fd)
int dup(int fd)
{
FAR struct file *filep;
int ret;
ret = nx_dup(fd);
/* Get the file structure corresponding to the file descriptor. */
ret = fs_getfilep(fd, &filep);
if (ret < 0)
{
set_errno(-ret);
ret = ERROR;
goto err;
}
DEBUGASSERT(filep != NULL);
/* Let file_dup() do the real work */
ret = file_dup(filep, 0);
if (ret < 0)
{
goto err;
}
return ret;
err:
set_errno(-ret);
return ERROR;
}

View File

@ -788,24 +788,6 @@ int files_duplist(FAR struct filelist *plist, FAR struct filelist *clist);
int file_dup(FAR struct file *filep, int minfd);
/****************************************************************************
* Name: nx_dup
*
* Description:
* nx_dup() is similar to the standard 'dup' interface except that is
* not a cancellation point and it does not modify the errno variable.
*
* nx_dup() is an internal NuttX interface and should not be called from
* applications.
*
* Returned Value:
* The new file descriptor is returned on success; a negated errno value is
* returned on any failure.
*
****************************************************************************/
int nx_dup(int fd);
/****************************************************************************
* Name: file_dup2
*