Skip to content

Commit

Permalink
fs: Remove file_detach since it is unefficient to call open and file_…
Browse files Browse the repository at this point in the history
…detach

the kernel user should call file_open directly instead

Signed-off-by: Xiang Xiao <[email protected]>
Change-Id: I5bf7f661006f5d43739bc8618abfb4b983fde78d
  • Loading branch information
xiaoxiang781216 authored and Ouss4 committed Jan 11, 2021
1 parent 0032ddb commit 1604fe0
Show file tree
Hide file tree
Showing 4 changed files with 4 additions and 180 deletions.
1 change: 0 additions & 1 deletion fs/inode/Make.defs
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,6 @@
CSRCS += fs_files.c fs_foreachinode.c fs_inode.c fs_inodeaddref.c
CSRCS += fs_inodebasename.c fs_inodefind.c fs_inodefree.c fs_inoderelease.c
CSRCS += fs_inoderemove.c fs_inodereserve.c fs_inodesearch.c
CSRCS += fs_filedetach.c

# Include inode/utils build support

Expand Down
147 changes: 0 additions & 147 deletions fs/inode/fs_filedetach.c

This file was deleted.

5 changes: 2 additions & 3 deletions fs/vfs/fs_close.c
Original file line number Diff line number Diff line change
Expand Up @@ -60,12 +60,11 @@
* Name: file_close
*
* Description:
* Close a file that was previously opend with file_open() (or detached
* with file_detach()).
* Close a file that was previously opened with file_open().
*
* Input Parameters:
* filep - A pointer to a user provided memory location containing the
* open file data returned by file_detach().
* open file data returned by file_open().
*
* Returned Value:
* Zero (OK) is returned on success; A negated errno value is returned on
Expand Down
31 changes: 2 additions & 29 deletions include/nuttx/fs/fs.h
Original file line number Diff line number Diff line change
Expand Up @@ -881,42 +881,15 @@ int nx_open(FAR const char *path, int oflags, ...);

int fs_getfilep(int fd, FAR struct file **filep);

/****************************************************************************
* Name: file_detach
*
* Description:
* This function is used to device drivers to create a task-independent
* handle to an entity in the file system. file_detach() duplicates the
* 'struct file' that underlies the file descriptor, then closes the file
* descriptor.
*
* This function will fail if fd is not a valid file descriptor. In
* particular, it will fail if fd is a socket descriptor.
*
* Input Parameters:
* fd - The file descriptor to be detached. This descriptor will be
* closed and invalid if the file was successfully detached.
* filep - A pointer to a user provided memory location in which to
* received the duplicated, detached file structure.
*
* Returned Value:
* Zero (OK) is returned on success; A negated errno value is returned on
* any failure to indicate the nature of the failure.
*
****************************************************************************/

int file_detach(int fd, FAR struct file *filep);

/****************************************************************************
* Name: file_close
*
* Description:
* Close a file that was previously opened with file_open() (or detached
* with file_detach()).
* Close a file that was previously opened with file_open().
*
* Input Parameters:
* filep - A pointer to a user provided memory location containing the
* open file data returned by file_detach().
* open file data returned by file_open().
*
* Returned Value:
* Zero (OK) is returned on success; A negated errno value is returned on
Expand Down

0 comments on commit 1604fe0

Please sign in to comment.