This is an automated email from the ASF dual-hosted git repository. pkarashchenko pushed a commit to branch master in repository https://gitbox.apache.org/repos/asf/incubator-nuttx.git
commit b22cc1e2b8661ec8e96717c082d2a1acc8449b56 Author: Xiang Xiao <xiaoxi...@xiaomi.com> AuthorDate: Wed Oct 26 17:28:39 2022 +0800 fs: Remove the unused nx_dup to prefer file_dup for kernel Signed-off-by: Xiang Xiao <xiaoxi...@xiaomi.com> --- fs/vfs/fs_dup.c | 40 ++++++++++------------------------------ include/nuttx/fs/fs.h | 18 ------------------ 2 files changed, 10 insertions(+), 48 deletions(-) diff --git a/fs/vfs/fs_dup.c b/fs/vfs/fs_dup.c index e815afde96..0662ab22f5 100644 --- a/fs/vfs/fs_dup.c +++ b/fs/vfs/fs_dup.c @@ -78,22 +78,14 @@ int file_dup(FAR struct file *filep, int minfd) } /**************************************************************************** - * Name: nx_dup + * Name: 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. + * Clone a file or socket descriptor to an arbitrary descriptor number * ****************************************************************************/ -int nx_dup(int fd) +int dup(int fd) { FAR struct file *filep; int ret; @@ -103,34 +95,22 @@ int nx_dup(int fd) ret = fs_getfilep(fd, &filep); if (ret < 0) { - return ret; + goto err; } DEBUGASSERT(filep != NULL); /* Let file_dup() do the real work */ - return file_dup(filep, 0); -} - -/**************************************************************************** - * Name: dup - * - * Description: - * Clone a file or socket descriptor to an arbitrary descriptor number - * - ****************************************************************************/ - -int dup(int fd) -{ - int ret; - - ret = nx_dup(fd); + ret = file_dup(filep, 0); if (ret < 0) { - set_errno(-ret); - ret = ERROR; + goto err; } return ret; + +err: + set_errno(-ret); + return ERROR; } diff --git a/include/nuttx/fs/fs.h b/include/nuttx/fs/fs.h index 973bbd89f9..93db9a34e0 100644 --- a/include/nuttx/fs/fs.h +++ b/include/nuttx/fs/fs.h @@ -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 *